int main(int argc, char** args){ int64_t* n; _DECL_DEALLOC(n); int64_t max; int64_t size; int64_t repeats; int64_t index; _DECL_1DARRAY(arr); _DECL_DEALLOC(arr); int64_t* _7; _DECL_DEALLOC(_7); _DECL_2DARRAY(_8); _DECL_DEALLOC(_8); int64_t _9; _DECL_1DARRAY(_10); _DECL_DEALLOC(_10); int64_t _11; int64_t _12; int64_t _13; int64_t _14; _DECL_1DARRAY(_15); _DECL_DEALLOC(_15); int64_t _16; int64_t _17; int64_t _18; _DECL_1DARRAY(_19); _DECL_DEALLOC(_19); void* _20; int64_t _22; int64_t _23; int64_t _24; void* _25; int64_t _27; int64_t _28; void* _29; _DECL_1DARRAY(_31); _DECL_DEALLOC(_31); void* _32; void* _34; _DECL_1DARRAY(_36); _DECL_DEALLOC(_36); //fieldload %8 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} _DEALLOC_2DARRAY(_8); _CONV_ARGS(_8); _8_dealloc = true; //const %9 = 0 : int _9 = 0; //indexof %10 = %8, %9 : int[][] _10=_8[_9]; _10_size = _8_size_size; _10_dealloc = false; //invoke (%7) = (%10) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int) { _STR_TO_INT(_7, _10); _7_dealloc = true; _10_dealloc = false; } //assign %1 = %7 : null|int // isCopyEliminated = true _DEALLOC(n); n = _7; _TRANSFER_DEALLOC_POST(n, _7); //ifis %1, null goto blklab4 : null|int if(n == NULL) { goto blklab4;} //const %11 = 1 : int _11 = 1; //assign %2 = %11 : int // isCopyEliminated = true max = _11; //assign %3 = %1 : int // isCopyEliminated = true size = *n; //const %12 = 0 : int _12 = 0; //assign %4 = %12 : int // isCopyEliminated = true repeats = _12; //loop (%4, %5, %6, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28) while(true){ //ifge %4, %2 goto blklab5 : int if(repeats>=max){goto blklab5;} //const %13 = 0 : int _13 = 0; //assign %5 = %13 : int // isCopyEliminated = true index = _13; //const %14 = 0 : int _14 = 0; //arraygen %15 = [14; 3] : int[] _NEW1DARRAY_DEALLOC(_15, _14, size, int64_t); //assign %6 = %15 : int[] // isCopyEliminated = true _TRANSFER_DEALLOC(arr, _15); //loop (%5, %6, %16, %17, %18) while(true){ //ifge %5, %3 goto blklab7 : int if(index>=size){goto blklab7;} //sub %16 = %3, %5 : int _16=size-index; //update %6[%5] = %16 : int[] -> int[] arr[index] = _16; //const %17 = 1 : int _17 = 1; //add %18 = %5, %17 : int _18=index+_17; //assign %5 = %18 : int // isCopyEliminated = true index = _18; //.blklab8 blklab8:; } //.blklab7 blklab7:; //invoke (%19) = (%6) Reverse_original:reverse : function(int[])->(int[]) { _FUNCTIONCALL_NO_COPY_PRE(_19, arr, 0, "liveness: arr = false, readonly: arr = true, return:arr = NEVER_RETURN" , "reverse"); _DEALLOC(_19); // isCopyEliminated of 'arr at 0' = true _19 = _reverse_(arr, arr_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_19)); _19_dealloc = true; } //assign %6 = %19 : int[] // isCopyEliminated = true _TRANSFER_DEALLOC(arr, _19); //fieldload %20 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %21 = %20 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %22 = 1 : int _22 = 1; //sub %23 = %3, %22 : int _23=size-_22; //indexof %24 = %6, %23 : int[] _24=arr[_23]; //indirectinvoke () = %21 (%24) : method(any)->() { printf("%"PRId64"\n", _24); } //fieldload %25 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %26 = %25 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %26 (%4) : method(any)->() { printf("%"PRId64"\n", repeats); } //const %27 = 1 : int _27 = 1; //add %28 = %4, %27 : int _28=repeats+_27; //assign %4 = %28 : int // isCopyEliminated = true repeats = _28; //.blklab6 blklab6:; } //.blklab5 blklab5:; //fieldload %29 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %30 = %29 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %31 = [78,117,109,98,101,114,32,111,102,32,114,101,112,101,97,116,115,58,32] : int[] _DEALLOC(_31); _NEW_1DARRAY_int64_t(_31, 19, 0); _31[0] = 78; _31[1] = 117; _31[2] = 109; _31[3] = 98; _31[4] = 101; _31[5] = 114; _31[6] = 32; _31[7] = 111; _31[8] = 102; _31[9] = 32; _31[10] = 114; _31[11] = 101; _31[12] = 112; _31[13] = 101; _31[14] = 97; _31[15] = 116; _31[16] = 115; _31[17] = 58; _31[18] = 32; _31_dealloc = true; //indirectinvoke () = %30 (%31) : method(int[])->() { printf_s(_31, _31_size); } //fieldload %32 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %33 = %32 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %33 (%4) : method(any)->() { printf("%"PRId64"\n", repeats); } //fieldload %34 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %35 = %34 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %36 = [80,97,115,115,32,82,101,118,101,114,115,101,32,116,101,115,116,32,99,97,115,101,32] : int[] _DEALLOC(_36); _NEW_1DARRAY_int64_t(_36, 23, 0); _36[0] = 80; _36[1] = 97; _36[2] = 115; _36[3] = 115; _36[4] = 32; _36[5] = 82; _36[6] = 101; _36[7] = 118; _36[8] = 101; _36[9] = 114; _36[10] = 115; _36[11] = 101; _36[12] = 32; _36[13] = 116; _36[14] = 101; _36[15] = 115; _36[16] = 116; _36[17] = 32; _36[18] = 99; _36[19] = 97; _36[20] = 115; _36[21] = 101; _36[22] = 32; _36_dealloc = true; //indirectinvoke () = %35 (%36) : method(int[])->() { println_s(_36, _36_size); } //.blklab4 blklab4:; //return _DEALLOC(n); _DEALLOC(arr); _DEALLOC(_7); _FREE_ARGS(_8); _DEALLOC(_10); _DEALLOC(_15); _DEALLOC(_19); _DEALLOC(_31); _DEALLOC(_36); exit(0); }
int main(int argc, char** args){ _DECL_1DARRAY(rs); int64_t max; int64_t index; _DECL_1DARRAY(arr); _DECL_1DARRAY(_5); int64_t _6; int64_t _7; int64_t _8; int64_t _9; int64_t _10; _DECL_1DARRAY(_11); int64_t _12; int64_t _13; int64_t _14; int64_t _15; int64_t _16; _DECL_1DARRAY(_17); int64_t _18; int64_t _19; int64_t _20; int64_t _21; int64_t _22; _DECL_1DARRAY(_23); int64_t _24; int64_t _25; int64_t _26; _DECL_1DARRAY(_27); int64_t _28; int64_t _29; int64_t _30; int64_t _31; void* _32; _DECL_1DARRAY(_34); //const %6 = 1 : int _6 = 1; //const %7 = 2 : int _7 = 2; //const %8 = 3 : int _8 = 3; //const %9 = 4 : int _9 = 4; //const %10 = 5 : int _10 = 5; //newlist %11 = (%6, %7, %8, %9, %10) : int[] _NEW_1DARRAY_int64_t(_11, 5, 0); _11[0] = _6; _11[1] = _7; _11[2] = _8; _11[3] = _9; _11[4] = _10; //invoke (%5) = (%11) reverse:reverse : function(int[])->(int[]) { void* tmp_ls; _COPY_1DARRAY_PARAM(_11, tmp_ls, int64_t); _5 = _reverse_(tmp_ls, _11_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_5)); } //assign %1 = %5 : int[] _COPY_1DARRAY_int64_t(rs, _5); //assert { //const %12 = 5 : int _12 = 5; //const %13 = 4 : int _13 = 4; //const %14 = 3 : int _14 = 3; //const %15 = 2 : int _15 = 2; //const %16 = 1 : int _16 = 1; //newlist %17 = (%12, %13, %14, %15, %16) : int[] _NEW_1DARRAY_int64_t(_17, 5, 0); _17[0] = _12; _17[1] = _13; _17[2] = _14; _17[3] = _15; _17[4] = _16; //ifeq %1, %17 goto blklab4 : int[] _IFEQ_ARRAY_int64_t(rs, _17, blklab4); //fail fprintf(stderr,"fail"); exit(-1); //.blklab4 blklab4:; //assert } //const %18 = 10 : int _18 = 10; //assign %2 = %18 : int max = _18; //const %19 = 0 : int _19 = 0; //assign %3 = %19 : int index = _19; //const %20 = 0 : int _20 = 0; //const %21 = 1 : int _21 = 1; //add %22 = %2, %21 : int _22=max+_21; //arraygen %23 = [20; 22] : int[] _NEW_1DARRAY_int64_t(_23, _22, _20); //assign %4 = %23 : int[] _COPY_1DARRAY_int64_t(arr, _23); //loop (%3, %4, %24, %25, %26) while(true){ //ifgt %3, %2 goto blklab5 : int if(index>max){goto blklab5;} //sub %24 = %2, %3 : int _24=max-index; //update %4[%3] = %24 : int[] -> int[] arr[index] = _24; //const %25 = 1 : int _25 = 1; //add %26 = %3, %25 : int _26=index+_25; //assign %3 = %26 : int index = _26; //.blklab6 blklab6:; } //.blklab5 blklab5:; //invoke (%27) = (%4) reverse:reverse : function(int[])->(int[]) { void* tmp_ls; _COPY_1DARRAY_PARAM(arr, tmp_ls, int64_t); _27 = _reverse_(tmp_ls, arr_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_27)); } //assign %4 = %27 : int[] _COPY_1DARRAY_int64_t(arr, _27); //assert { //const %28 = 0 : int _28 = 0; //indexof %29 = %4, %28 : int[] _29=arr[_28]; //const %30 = 0 : int _30 = 0; //ifeq %29, %30 goto blklab7 : int if(_29==_30){goto blklab7;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab7 blklab7:; //assert } //assert { //indexof %31 = %4, %2 : int[] _31=arr[max]; //ifeq %31, %2 goto blklab8 : int if(_31==max){goto blklab8;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab8 blklab8:; //assert } //fieldload %32 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %33 = %32 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %34 = [80,97,115,115,32,114,101,118,101,114,115,101,32,116,101,115,116,32,99,97,115,101] : int[] _NEW_1DARRAY_int64_t(_34, 22, 0); _34[0] = 80; _34[1] = 97; _34[2] = 115; _34[3] = 115; _34[4] = 32; _34[5] = 114; _34[6] = 101; _34[7] = 118; _34[8] = 101; _34[9] = 114; _34[10] = 115; _34[11] = 101; _34[12] = 32; _34[13] = 116; _34[14] = 101; _34[15] = 115; _34[16] = 116; _34[17] = 32; _34[18] = 99; _34[19] = 97; _34[20] = 115; _34[21] = 101; //indirectinvoke () = %33 (%34) : method(int[])->() { printf_s(_34, _34_size); } //return exit(0); }