|
| 1 | +extern crate libcc2rs; |
| 2 | +use libcc2rs::*; |
| 3 | +use std::cell::RefCell; |
| 4 | +use std::collections::BTreeMap; |
| 5 | +use std::io::prelude::*; |
| 6 | +use std::io::{Read, Seek, Write}; |
| 7 | +use std::os::fd::AsFd; |
| 8 | +use std::rc::{Rc, Weak}; |
| 9 | +#[derive()] |
| 10 | +pub struct S { |
| 11 | + pub head: Value<i32>, |
| 12 | + pub tail: Value<Box<[i32]>>, |
| 13 | + pub buf: Value<Box<[u8]>>, |
| 14 | +} |
| 15 | +impl Default for S { |
| 16 | + fn default() -> Self { |
| 17 | + S { |
| 18 | + head: <Value<i32>>::default(), |
| 19 | + tail: Rc::new(RefCell::new( |
| 20 | + (0..3).map(|_| <i32>::default()).collect::<Box<[i32]>>(), |
| 21 | + )), |
| 22 | + buf: Rc::new(RefCell::new( |
| 23 | + (0..4).map(|_| <u8>::default()).collect::<Box<[u8]>>(), |
| 24 | + )), |
| 25 | + } |
| 26 | + } |
| 27 | +} |
| 28 | +impl ByteRepr for S {} |
| 29 | +thread_local!( |
| 30 | + pub static s_0: Value<S> = Rc::new(RefCell::new(S { |
| 31 | + head: Rc::new(RefCell::new(5)), |
| 32 | + tail: Rc::new(RefCell::new(Box::new([0; 3]))), |
| 33 | + buf: Rc::new(RefCell::new(Box::new([0; 4]))), |
| 34 | + })); |
| 35 | +); |
| 36 | +pub fn main() { |
| 37 | + std::process::exit(main_0()); |
| 38 | +} |
| 39 | +fn main_0() -> i32 { |
| 40 | + assert!(((((*(*s_0.with(Value::clone).borrow()).head.borrow()) == 5) as i32) != 0)); |
| 41 | + let i: Value<i32> = Rc::new(RefCell::new(0)); |
| 42 | + 'loop_: while ((((*i.borrow()) < 3) as i32) != 0) { |
| 43 | + assert!( |
| 44 | + ((((*(*s_0.with(Value::clone).borrow()).tail.borrow())[(*i.borrow()) as usize] == 0) |
| 45 | + as i32) |
| 46 | + != 0) |
| 47 | + ); |
| 48 | + (*i.borrow_mut()).postfix_inc(); |
| 49 | + } |
| 50 | + let i: Value<i32> = Rc::new(RefCell::new(0)); |
| 51 | + 'loop_: while ((((*i.borrow()) < 4) as i32) != 0) { |
| 52 | + assert!( |
| 53 | + (((((*(*s_0.with(Value::clone).borrow()).buf.borrow())[(*i.borrow()) as usize] as i32) |
| 54 | + == 0) as i32) |
| 55 | + != 0) |
| 56 | + ); |
| 57 | + (*i.borrow_mut()).postfix_inc(); |
| 58 | + } |
| 59 | + return 0; |
| 60 | +} |
0 commit comments