int main(int argc, char** args){ _DECL_1DARRAY(empty); _DECL_1DARRAY(till); _DECL_1DARRAY(_3); _DECL_1DARRAY(_4); int64_t _5; int64_t _6; int64_t _7; int64_t _8; int64_t _9; int64_t _10; int64_t _11; int64_t _12; _DECL_1DARRAY(_13); //invoke (%3) = () FunctionOverload2:Cash : function()->(FunctionOverload2:Cash) { _3 = _Cash_(_1DARRAYSIZE_PARAM_CALLBYREFERENCE(_3)); } //assign %1 = %3 : int[] _COPY_1DARRAY_int64_t(empty, _3); //const %5 = 5 : int _5 = 5; //const %6 = 3 : int _6 = 3; //const %7 = 3 : int _7 = 3; //const %8 = 1 : int _8 = 1; //const %9 = 1 : int _9 = 1; //const %10 = 3 : int _10 = 3; //const %11 = 0 : int _11 = 0; //const %12 = 0 : int _12 = 0; //newlist %13 = (%5, %6, %7, %8, %9, %10, %11, %12) : int[] _NEW_1DARRAY_int64_t(_13, 8, 0); _13[0] = _5; _13[1] = _6; _13[2] = _7; _13[3] = _8; _13[4] = _9; _13[5] = _10; _13[6] = _11; _13[7] = _12; //invoke (%4) = (%13) FunctionOverload2:Cash : function(FunctionOverload2:nat[])->(FunctionOverload2:Cash) { void* tmp_coins; _COPY_1DARRAY_PARAM(_13, tmp_coins, int64_t); _4 = _Cash_1_(tmp_coins, _13_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_4)); } //assign %2 = %4 : int[] _COPY_1DARRAY_int64_t(till, _4); //return exit(0); }
int64_t* _func_(_DECL_1DARRAY_PARAM(s), int64_t n, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY(_2); _DECL_1DARRAY(t); int64_t _4; int64_t _5; int64_t _6; //const %4 = 5 : int _4 = 5; //ifle %1, %4 goto blklab0 : int if(n<=_4){goto blklab0;} //assign %3 = %0 : int[] _COPY_1DARRAY_int64_t(t, s); //const %5 = 3 : int _5 = 3; //const %6 = 2 : int _6 = 2; //update %3[%6] = %5 : int[] -> int[] t[_6] = _5; //return %3 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(t); return t; //goto blklab1 goto blklab1; //.blklab0 blklab0:; //return %0 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(s); return s; //.blklab1 blklab1:; //return }
int64_t* _Cash_1_(_DECL_1DARRAY_PARAM(coins), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY(_1); _DECL_1DARRAY(cash); int64_t i; int64_t coin; int64_t _5; int64_t _6; int64_t _7; int64_t _8; int64_t _9; int64_t _10; int64_t _11; int64_t _12; _DECL_1DARRAY(_13); int64_t _14; int64_t _15; _DECL_1DARRAY(_16); int64_t _17; int64_t _18; int64_t _19; int64_t _20; int64_t _21; int64_t _22; int64_t _23; int64_t _24; int64_t _25; int64_t _26; int64_t _27; int64_t _28; int64_t _29; //const %5 = 0 : int _5 = 0; //const %6 = 0 : int _6 = 0; //const %7 = 0 : int _7 = 0; //const %8 = 0 : int _8 = 0; //const %9 = 0 : int _9 = 0; //const %10 = 0 : int _10 = 0; //const %11 = 0 : int _11 = 0; //const %12 = 0 : int _12 = 0; //newlist %13 = (%5, %6, %7, %8, %9, %10, %11, %12) : int[] _NEW_1DARRAY_int64_t(_13, 8, 0); _13[0] = _5; _13[1] = _6; _13[2] = _7; _13[3] = _8; _13[4] = _9; _13[5] = _10; _13[6] = _11; _13[7] = _12; //assign %2 = %13 : int[] _COPY_1DARRAY_int64_t(cash, _13); //const %14 = 0 : int _14 = 0; //assign %3 = %14 : int i = _14; //loop (%2, %3, %4, %15, %16, %17, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29) while(true){ //lengthof %23 = %0 : int[] _23 = coins_size; //ifge %3, %23 goto blklab4 : int if(i>=_23){goto blklab4;} //indexof %24 = %0, %3 : int[] _24=coins[i]; //assign %4 = %24 : int coin = _24; //indexof %25 = %2, %4 : int[] _25=cash[coin]; //const %26 = 1 : int _26 = 1; //add %27 = %25, %26 : int _27=_25+_26; //update %2[%4] = %27 : int[] -> int[] cash[coin] = _27; //const %28 = 1 : int _28 = 1; //add %29 = %3, %28 : int _29=i+_28; //assign %3 = %29 : int i = _29; //.blklab5 blklab5:; } //.blklab4 blklab4:; //return %2 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(cash); return cash; //return }
int main(int argc, char** args){ int64_t n; _DECL_1DARRAY(moves); int64_t sum_alice; int64_t _4; int64_t _5; int64_t _6; _DECL_1DARRAY(_7); _DECL_1DARRAY(_8); int64_t _9; int64_t _10; int64_t _11; int64_t _12; void* _13; _DECL_1DARRAY(_15); void* _16; void* _18; _DECL_1DARRAY(_20); //const %4 = 10 : int _4 = 10; //assign %1 = %4 : int n = _4; //const %5 = 0 : int _5 = 0; //mul %6 = %1, %1 : int _6=n*n; //arraygen %7 = [5; 6] : int[] _NEW_1DARRAY_int64_t(_7, _6, _5); //assign %2 = %7 : int[] _COPY_1DARRAY_int64_t(moves, _7); //invoke (%8) = (%2, %1) CoinGame2:findMoves : function(int[],int)->(int[]) { void* tmp_moves; _COPY_1DARRAY_PARAM(moves, tmp_moves, int64_t); _8 = _findMoves_(tmp_moves, moves_size, n, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_8)); } //assign %2 = %8 : int[] _COPY_1DARRAY_int64_t(moves, _8); //const %9 = 1 : int _9 = 1; //sub %10 = %1, %9 : int _10=n-_9; //indexof %11 = %2, %10 : int[] _11=moves[_10]; //assign %3 = %11 : int sum_alice = _11; //assert { //const %12 = 25 : int _12 = 25; //ifeq %3, %12 goto blklab11 : int if(sum_alice==_12){goto blklab11;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab11 blklab11:; //assert } //fieldload %13 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %14 = %13 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %15 = [84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,109,111,110,101,121,32,40,109,97,120,105,109,117,109,41,32,65,108,105,99,101,32,103,101,116,115,32,105,115,32] : int[] _NEW_1DARRAY_int64_t(_15, 50, 0); _15[0] = 84; _15[1] = 104; _15[2] = 101; _15[3] = 32; _15[4] = 116; _15[5] = 111; _15[6] = 116; _15[7] = 97; _15[8] = 108; _15[9] = 32; _15[10] = 97; _15[11] = 109; _15[12] = 111; _15[13] = 117; _15[14] = 110; _15[15] = 116; _15[16] = 32; _15[17] = 111; _15[18] = 102; _15[19] = 32; _15[20] = 109; _15[21] = 111; _15[22] = 110; _15[23] = 101; _15[24] = 121; _15[25] = 32; _15[26] = 40; _15[27] = 109; _15[28] = 97; _15[29] = 120; _15[30] = 105; _15[31] = 109; _15[32] = 117; _15[33] = 109; _15[34] = 41; _15[35] = 32; _15[36] = 65; _15[37] = 108; _15[38] = 105; _15[39] = 99; _15[40] = 101; _15[41] = 32; _15[42] = 103; _15[43] = 101; _15[44] = 116; _15[45] = 115; _15[46] = 32; _15[47] = 105; _15[48] = 115; _15[49] = 32; //indirectinvoke () = %14 (%15) : method(int[])->() { printf_s(_15, _15_size); } //fieldload %16 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %17 = %16 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %17 (%3) : method(any)->() { printf("%"PRId64"\n", sum_alice); } //fieldload %18 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %19 = %18 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %20 = [80,97,115,115,32,67,111,105,110,71,97,109,101,32,116,101,115,116,32,99,97,115,101] : int[] _NEW_1DARRAY_int64_t(_20, 23, 0); _20[0] = 80; _20[1] = 97; _20[2] = 115; _20[3] = 115; _20[4] = 32; _20[5] = 67; _20[6] = 111; _20[7] = 105; _20[8] = 110; _20[9] = 71; _20[10] = 97; _20[11] = 109; _20[12] = 101; _20[13] = 32; _20[14] = 116; _20[15] = 101; _20[16] = 115; _20[17] = 116; _20[18] = 32; _20[19] = 99; _20[20] = 97; _20[21] = 115; _20[22] = 101; //indirectinvoke () = %19 (%20) : method(int[])->() { println_s(_20, _20_size); } //return exit(0); }
int64_t* _findMoves_(_DECL_1DARRAY_PARAM(moves), int64_t n, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY(_2); int64_t s; _DECL_1DARRAY(x); _DECL_1DARRAY(y); _DECL_1DARRAY(z); int64_t j; int64_t i; int64_t _9; int64_t _10; _DECL_1DARRAY(_11); int64_t _12; _DECL_1DARRAY(_13); int64_t _14; _DECL_1DARRAY(_15); int64_t _16; int64_t _17; int64_t _18; int64_t _19; int64_t _20; int64_t _21; int64_t _22; int64_t _23; int64_t _24; int64_t _25; int64_t _26; int64_t _27; int64_t _28; int64_t _29; int64_t _30; int64_t _31; int64_t _32; int64_t _33; int64_t _34; int64_t _35; int64_t _36; int64_t _37; int64_t _38; int64_t _39; int64_t _40; int64_t _41; int64_t _42; int64_t _43; int64_t _44; int64_t _45; int64_t _46; int64_t _47; int64_t _48; int64_t _49; int64_t _50; int64_t _51; int64_t _52; int64_t _53; int64_t _54; int64_t _55; int64_t _56; int64_t _57; int64_t _58; int64_t _59; int64_t _60; int64_t _61; int64_t _62; int64_t _63; int64_t _64; int64_t _65; int64_t _66; int64_t _67; int64_t _68; int64_t _69; int64_t _70; //const %9 = 0 : int _9 = 0; //assign %3 = %9 : int s = _9; //loop (%0, %3, %4, %5, %6, %7, %8, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68, %69, %70) while(true){ //ifge %3, %1 goto blklab0 : int if(s>=n){goto blklab0;} //const %10 = 0 : int _10 = 0; //arraygen %11 = [10; 1] : int[] _NEW_1DARRAY_int64_t(_11, n, _10); //assign %4 = %11 : int[] _COPY_1DARRAY_int64_t(x, _11); //const %12 = 0 : int _12 = 0; //arraygen %13 = [12; 1] : int[] _NEW_1DARRAY_int64_t(_13, n, _12); //assign %5 = %13 : int[] _COPY_1DARRAY_int64_t(y, _13); //const %14 = 0 : int _14 = 0; //arraygen %15 = [14; 1] : int[] _NEW_1DARRAY_int64_t(_15, n, _14); //assign %6 = %15 : int[] _COPY_1DARRAY_int64_t(z, _15); //assign %7 = %3 : int j = s; //const %16 = 0 : int _16 = 0; //assign %8 = %16 : int i = _16; //loop (%0, %4, %5, %6, %7, %8, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40, %41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57, %58, %59, %60, %61, %62, %63, %64, %65, %66, %67, %68) while(true){ //ifge %7, %1 goto blklab2 : int if(j>=n){goto blklab2;} //const %17 = 0 : int _17 = 0; //update %5[%8] = %17 : int[] -> int[] y[i] = _17; //const %18 = 1 : int _18 = 1; //add %19 = %8, %18 : int _19=i+_18; //ifge %19, %1 goto blklab4 : int if(_19>=n){goto blklab4;} //const %20 = 1 : int _20 = 1; //sub %21 = %7, %20 : int _21=j-_20; //const %22 = 0 : int _22 = 0; //iflt %21, %22 goto blklab4 : int if(_21<_22){goto blklab4;} //const %23 = 1 : int _23 = 1; //add %24 = %8, %23 : int _24=i+_23; //mul %25 = %24, %1 : int _25=_24*n; //add %26 = %25, %7 : int _26=_25+j; //const %27 = 1 : int _27 = 1; //sub %28 = %26, %27 : int _28=_26-_27; //indexof %29 = %0, %28 : int[] _29=moves[_28]; //update %5[%8] = %29 : int[] -> int[] y[i] = _29; //.blklab4 blklab4:; //const %30 = 0 : int _30 = 0; //update %4[%8] = %30 : int[] -> int[] x[i] = _30; //const %31 = 2 : int _31 = 2; //add %32 = %8, %31 : int _32=i+_31; //ifge %32, %1 goto blklab5 : int if(_32>=n){goto blklab5;} //const %33 = 2 : int _33 = 2; //add %34 = %8, %33 : int _34=i+_33; //mul %35 = %34, %1 : int _35=_34*n; //add %36 = %35, %7 : int _36=_35+j; //indexof %37 = %0, %36 : int[] _37=moves[_36]; //update %4[%8] = %37 : int[] -> int[] x[i] = _37; //.blklab5 blklab5:; //const %38 = 0 : int _38 = 0; //update %6[%8] = %38 : int[] -> int[] z[i] = _38; //const %39 = 1 : int _39 = 1; //sub %40 = %7, %39 : int _40=j-_39; //const %41 = 0 : int _41 = 0; //ifle %40, %41 goto blklab6 : int if(_40<=_41){goto blklab6;} //mul %42 = %8, %1 : int _42=i*n; //add %43 = %42, %7 : int _43=_42+j; //const %44 = 2 : int _44 = 2; //sub %45 = %43, %44 : int _45=_43-_44; //indexof %46 = %0, %45 : int[] _46=moves[_45]; //update %6[%8] = %46 : int[] -> int[] z[i] = _46; //.blklab6 blklab6:; //indexof %47 = %4, %8 : int[] _47=x[i]; //indexof %48 = %5, %8 : int[] _48=y[i]; //ifle %47, %48 goto blklab7 : int if(_47<=_48){goto blklab7;} //indexof %49 = %5, %8 : int[] _49=y[i]; //update %4[%8] = %49 : int[] -> int[] x[i] = _49; //.blklab7 blklab7:; //indexof %50 = %6, %8 : int[] _50=z[i]; //indexof %51 = %5, %8 : int[] _51=y[i]; //ifle %50, %51 goto blklab8 : int if(_50<=_51){goto blklab8;} //indexof %52 = %5, %8 : int[] _52=y[i]; //update %6[%8] = %52 : int[] -> int[] z[i] = _52; //.blklab8 blklab8:; //indexof %53 = %4, %8 : int[] _53=x[i]; //add %54 = %8, %53 : int _54=i+_53; //indexof %55 = %6, %8 : int[] _55=z[i]; //add %56 = %7, %55 : int _56=j+_55; //ifle %54, %56 goto blklab9 : int if(_54<=_56){goto blklab9;} //indexof %57 = %4, %8 : int[] _57=x[i]; //add %58 = %8, %57 : int _58=i+_57; //mul %59 = %8, %1 : int _59=i*n; //add %60 = %59, %7 : int _60=_59+j; //update %0[%60] = %58 : int[] -> int[] moves[_60] = _58; //goto blklab10 goto blklab10; //.blklab9 blklab9:; //indexof %61 = %6, %8 : int[] _61=z[i]; //add %62 = %7, %61 : int _62=j+_61; //mul %63 = %8, %1 : int _63=i*n; //add %64 = %63, %7 : int _64=_63+j; //update %0[%64] = %62 : int[] -> int[] moves[_64] = _62; //.blklab10 blklab10:; //const %65 = 1 : int _65 = 1; //add %66 = %7, %65 : int _66=j+_65; //assign %7 = %66 : int j = _66; //const %67 = 1 : int _67 = 1; //add %68 = %8, %67 : int _68=i+_67; //assign %8 = %68 : int i = _68; //.blklab3 blklab3:; } //.blklab2 blklab2:; //const %69 = 1 : int _69 = 1; //add %70 = %3, %69 : int _70=s+_69; //assign %3 = %70 : int s = _70; //.blklab1 blklab1:; } //.blklab0 blklab0:; //return %0 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(moves); return moves; //return }
int main(int argc, char** args){ _DECL_1DARRAY(a); _DECL_1DARRAY(b); _DECL_1DARRAY(c); int64_t _4; int64_t _5; int64_t _6; int64_t _7; int64_t _8; _DECL_1DARRAY(_9); _DECL_1DARRAY(_10); int64_t _11; int64_t _12; int64_t _13; int64_t _14; void* _15; _DECL_1DARRAY(_17); void* _18; int64_t _20; int64_t _21; int64_t _22; int64_t _23; int64_t _24; int64_t _25; int64_t _26; _DECL_1DARRAY(_27); _DECL_1DARRAY(_28); int64_t _29; int64_t _30; int64_t _31; int64_t _32; int64_t _33; int64_t _34; int64_t _35; void* _36; _DECL_1DARRAY(_38); void* _39; int64_t _41; int64_t _42; void* _43; _DECL_1DARRAY(_45); void* _46; int64_t _48; int64_t _49; //const %4 = 0 : int _4 = 0; //const %5 = 0 : int _5 = 0; //const %6 = 0 : int _6 = 0; //const %7 = 0 : int _7 = 0; //const %8 = 0 : int _8 = 0; //newlist %9 = (%4, %5, %6, %7, %8) : int[] _NEW_1DARRAY_int64_t(_9, 5, 0); _9[0] = _4; _9[1] = _5; _9[2] = _6; _9[3] = _7; _9[4] = _8; //assign %1 = %9 : int[] _COPY_1DARRAY_int64_t(a, _9); //const %11 = 6 : int _11 = 6; //invoke (%10) = (%1, %11) FunctionCall2:func : function(int[],int)->(int[]) { void* tmp_s; _COPY_1DARRAY_PARAM(a, tmp_s, int64_t); _10 = _func_(tmp_s, a_size, _11, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_10)); } //assign %1 = %10 : int[] _COPY_1DARRAY_int64_t(a, _10); //assert { //const %12 = 2 : int _12 = 2; //indexof %13 = %1, %12 : int[] _13=a[_12]; //const %14 = 3 : int _14 = 3; //ifeq %13, %14 goto blklab2 : int if(_13==_14){goto blklab2;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab2 blklab2:; //assert } //fieldload %15 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %16 = %15 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %17 = [97,91,50,93,61] : int[] _NEW_1DARRAY_int64_t(_17, 5, 0); _17[0] = 97; _17[1] = 91; _17[2] = 50; _17[3] = 93; _17[4] = 61; //indirectinvoke () = %16 (%17) : method(int[])->() { printf_s(_17, _17_size); } //fieldload %18 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %19 = %18 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %20 = 2 : int _20 = 2; //indexof %21 = %1, %20 : int[] _21=a[_20]; //indirectinvoke () = %19 (%21) : method(any)->() { printf("%"PRId64"\n", _21); } //const %22 = 0 : int _22 = 0; //const %23 = 0 : int _23 = 0; //const %24 = 0 : int _24 = 0; //const %25 = 0 : int _25 = 0; //const %26 = 0 : int _26 = 0; //newlist %27 = (%22, %23, %24, %25, %26) : int[] _NEW_1DARRAY_int64_t(_27, 5, 0); _27[0] = _22; _27[1] = _23; _27[2] = _24; _27[3] = _25; _27[4] = _26; //assign %2 = %27 : int[] _COPY_1DARRAY_int64_t(b, _27); //const %29 = 1 : int _29 = 1; //invoke (%28) = (%2, %29) FunctionCall2:func : function(int[],int)->(int[]) { void* tmp_s; _COPY_1DARRAY_PARAM(b, tmp_s, int64_t); _28 = _func_(tmp_s, b_size, _29, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_28)); } //assign %3 = %28 : int[] _COPY_1DARRAY_int64_t(c, _28); //assert { //const %30 = 2 : int _30 = 2; //indexof %31 = %2, %30 : int[] _31=b[_30]; //const %32 = 0 : int _32 = 0; //ifeq %31, %32 goto blklab3 : int if(_31==_32){goto blklab3;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab3 blklab3:; //assert } //assert { //const %33 = 2 : int _33 = 2; //indexof %34 = %3, %33 : int[] _34=c[_33]; //const %35 = 0 : int _35 = 0; //ifeq %34, %35 goto blklab4 : int if(_34==_35){goto blklab4;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab4 blklab4:; //assert } //fieldload %36 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %37 = %36 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %38 = [98,91,50,93,61] : int[] _NEW_1DARRAY_int64_t(_38, 5, 0); _38[0] = 98; _38[1] = 91; _38[2] = 50; _38[3] = 93; _38[4] = 61; //indirectinvoke () = %37 (%38) : method(int[])->() { printf_s(_38, _38_size); } //fieldload %39 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %40 = %39 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %41 = 2 : int _41 = 2; //indexof %42 = %2, %41 : int[] _42=b[_41]; //indirectinvoke () = %40 (%42) : method(any)->() { printf("%"PRId64"\n", _42); } //fieldload %43 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %44 = %43 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %45 = [99,91,50,93,61] : int[] _NEW_1DARRAY_int64_t(_45, 5, 0); _45[0] = 99; _45[1] = 91; _45[2] = 50; _45[3] = 93; _45[4] = 61; //indirectinvoke () = %44 (%45) : method(int[])->() { printf_s(_45, _45_size); } //fieldload %46 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %47 = %46 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %48 = 2 : int _48 = 2; //indexof %49 = %3, %48 : int[] _49=c[_48]; //indirectinvoke () = %47 (%49) : method(any)->() { printf("%"PRId64"\n", _49); } //return exit(0); }
int64_t* _toString_(_DECL_1DARRAY_PARAM(c), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_DEALLOC(c); _DECL_1DARRAY(_1); _DECL_DEALLOC(_1); _DECL_1DARRAY(r); _DECL_DEALLOC(r); bool firstTime; int64_t i; int64_t amt; void* _6; size_t _6_size = 0; _DECL_DEALLOC(_6); bool _7; int64_t _8; int64_t _9; int64_t _10; int64_t _11; bool _12; _DECL_1DARRAY(_13); _DECL_DEALLOC(_13); _DECL_1DARRAY(_14); _DECL_DEALLOC(_14); bool _15; _DECL_1DARRAY(_16); _DECL_DEALLOC(_16); _DECL_1DARRAY(_17); _DECL_DEALLOC(_17); _DECL_1DARRAY(_18); _DECL_DEALLOC(_18); _DECL_1DARRAY(_19); _DECL_DEALLOC(_19); _DECL_1DARRAY(_20); _DECL_DEALLOC(_20); _DECL_2DARRAY(_21); _DECL_DEALLOC(_21); _DECL_1DARRAY(_22); _DECL_DEALLOC(_22); int64_t _23; int64_t _24; void* _25; size_t _25_size = 0; _DECL_DEALLOC(_25); _DECL_1DARRAY(_26); _DECL_DEALLOC(_26); //const %6 = [] : void[] _DEALLOC(_6); _NEW_1DARRAY_int64_t(_6, 0, 0); _6_dealloc = true; //assign %2 = %6 : void[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _6); _ADD_DEALLOC_POST(r, _6); //const %7 = true : bool _7 = true; //assign %3 = %7 : bool firstTime = _7; //const %8 = 0 : int _8 = 0; //assign %4 = %8 : int i = _8; //loop (%2, %3, %4, %5, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24) while(true){ //lengthof %9 = %0 : int[] _9 = c_size; //ifge %4, %9 goto blklab2 : int if(i>=_9){goto blklab2;} //indexof %10 = %0, %4 : int[] _10=c[i]; //assign %5 = %10 : int amt = _10; //const %11 = 0 : int _11 = 0; //ifeq %5, %11 goto blklab4 : int if(amt==_11){goto blklab4;} //const %12 = true : bool _12 = true; //ifeq %3, %12 goto blklab5 : bool if(firstTime==_12){goto blklab5;} //const %14 = [44,32] : int[] _DEALLOC(_14); _NEW_1DARRAY_int64_t(_14, 2, 0); _14[0] = 44; _14[1] = 32; _14_dealloc = true; //invoke (%13) = (%2, %14) whiley/lang/Array:append : function(int[],int[])->(int[]) { _DEALLOC(_13); _13 = Array_Append(r, r_size , _14, _14_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_13)); _13_dealloc = true; } //assign %2 = %13 : int[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _13); _ADD_DEALLOC_POST(r, _13); //.blklab5 blklab5:; //const %15 = false : bool _15 = false; //assign %3 = %15 : bool firstTime = _15; //invoke (%17) = (%5) whiley/lang/Int:toString : function(int)->(whiley/lang/ASCII:string) { _DEALLOC(_17); _17 = Int_toString(amt, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_17)); _17_dealloc = true; } //invoke (%16) = (%2, %17) whiley/lang/Array:append : function(int[],int[])->(int[]) { _DEALLOC(_16); _16 = Array_Append(r, r_size , _17, _17_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_16)); _16_dealloc = true; } //assign %2 = %16 : int[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _16); _ADD_DEALLOC_POST(r, _16); //const %19 = [32,120,32] : int[] _DEALLOC(_19); _NEW_1DARRAY_int64_t(_19, 3, 0); _19[0] = 32; _19[1] = 120; _19[2] = 32; _19_dealloc = true; //invoke (%18) = (%2, %19) whiley/lang/Array:append : function(int[],int[])->(int[]) { _DEALLOC(_18); _18 = Array_Append(r, r_size , _19, _19_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_18)); _18_dealloc = true; } //assign %2 = %18 : int[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _18); _ADD_DEALLOC_POST(r, _18); //const %21 = [[49,99],[53,99],[49,48,99],[50,48,99],[53,48,99],[36,49],[36,53],[36,49,48]] : int[][] _DEALLOC_2DARRAY(_21); _NEW_2DARRAY_int64_t_EMPTY(_21, 8, 3); { int64_t tmp[] = {49, 99, '\0'}; memcpy(_21[0], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {53, 99, '\0'}; memcpy(_21[1], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {49, 48, 99}; memcpy(_21[2], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {50, 48, 99}; memcpy(_21[3], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {53, 48, 99}; memcpy(_21[4], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {36, 49, '\0'}; memcpy(_21[5], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {36, 53, '\0'}; memcpy(_21[6], tmp, 3*sizeof(int64_t)); } { int64_t tmp[] = {36, 49, 48}; memcpy(_21[7], tmp, 3*sizeof(int64_t)); } _21_dealloc = true; //indexof %22 = %21, %4 : int[][] _22=_21[i]; _22_size = _21_size_size; _22_dealloc = false; //invoke (%20) = (%2, %22) whiley/lang/Array:append : function(int[],int[])->(int[]) { _DEALLOC(_20); _20 = Array_Append(r, r_size , _22, _22_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_20)); _20_dealloc = true; } //assign %2 = %20 : int[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _20); _ADD_DEALLOC_POST(r, _20); //.blklab4 blklab4:; //const %23 = 1 : int _23 = 1; //add %24 = %4, %23 : int _24=i+_23; //assign %4 = %24 : int i = _24; //.blklab3 blklab3:; } //.blklab2 blklab2:; //const %25 = [] : void[] _DEALLOC(_25); _NEW_1DARRAY_int64_t(_25, 0, 0); _25_dealloc = true; //ifne %2, %25 goto blklab6 : int[] if(r!=_25){goto blklab6;} //const %26 = [40,110,111,116,104,105,110,103,41] : int[] _DEALLOC(_26); _NEW_1DARRAY_int64_t(_26, 9, 0); _26[0] = 40; _26[1] = 110; _26[2] = 111; _26[3] = 116; _26[4] = 104; _26[5] = 105; _26[6] = 110; _26[7] = 103; _26[8] = 41; _26_dealloc = true; //assign %2 = %26 : int[] _DEALLOC(r); _COPY_1DARRAY_int64_t(r, _26); _ADD_DEALLOC_POST(r, _26); //.blklab6 blklab6:; //return %2 _DEALLOC(c); _DEALLOC(_1); _DEALLOC(_6); _DEALLOC(_13); _DEALLOC(_14); _DEALLOC(_16); _DEALLOC(_17); _DEALLOC(_18); _DEALLOC(_19); _DEALLOC(_20); _DEALLOC_2DARRAY(_21); _DEALLOC(_22); _DEALLOC(_25); _DEALLOC(_26); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(r); return r; //return }
int main(int argc, char** args){ int64_t* n; int64_t size; int64_t width; int64_t height; _DECL_1DARRAY(A); _DECL_1DARRAY(B); _DECL_1DARRAY(C); int64_t* _8; _DECL_2DARRAY(_9); int64_t _10; _DECL_1DARRAY(_11); void* _12; _DECL_1DARRAY(_14); void* _15; int64_t _17; int64_t _18; _DECL_1DARRAY(_19); _DECL_1DARRAY(_20); int64_t _21; int64_t _22; _DECL_1DARRAY(_23); _DECL_1DARRAY(_24); int64_t _25; int64_t _26; _DECL_1DARRAY(_27); _DECL_1DARRAY(_28); void* _29; int64_t _31; int64_t _32; int64_t _33; int64_t _34; int64_t _35; int64_t _36; int64_t _37; void* _38; _DECL_1DARRAY(_40); //fieldload %9 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} _CONV_ARGS(_9); //const %10 = 0 : int _10 = 0; //indexof %11 = %9, %10 : int[][] _11=_9[_10]; _11_size = _9_size_size; //invoke (%8) = (%11) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int) { _STR_TO_INT(_8, _11); } //assign %1 = %8 : null|int _NEW_INTEGER_POINTER(n, _8); //ifis %1, null goto blklab10 : null|int if(n == NULL) { goto blklab10;} //assign %2 = %1 : int size = *n; //assign %3 = %2 : int width = size; //assign %4 = %2 : int height = size; //fieldload %12 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %13 = %12 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %14 = [115,105,122,101,32,61,32] : int[] _NEW_1DARRAY_int64_t(_14, 7, 0); _14[0] = 115; _14[1] = 105; _14[2] = 122; _14[3] = 101; _14[4] = 32; _14[5] = 61; _14[6] = 32; //indirectinvoke () = %13 (%14) : method(int[])->() { printf_s(_14, _14_size); } //fieldload %15 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %16 = %15 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %16 (%2) : method(any)->() { printf("%"PRId64"\n", size); } //const %17 = 0 : int _17 = 0; //mul %18 = %3, %4 : int _18=width*height; //arraygen %19 = [17; 18] : int[] _NEW_1DARRAY_int64_t(_19, _18, _17); //assign %5 = %19 : int[] _COPY_1DARRAY_int64_t(A, _19); //invoke (%20) = (%5, %3, %4) MatrixMult_original:init : function(int[],int,int)->(int[]) { void* tmp_data; _COPY_1DARRAY_PARAM(A, tmp_data, int64_t); _20 = _init_(tmp_data, A_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_20)); } //assign %5 = %20 : int[] _COPY_1DARRAY_int64_t(A, _20); //const %21 = 0 : int _21 = 0; //mul %22 = %3, %4 : int _22=width*height; //arraygen %23 = [21; 22] : int[] _NEW_1DARRAY_int64_t(_23, _22, _21); //assign %6 = %23 : int[] _COPY_1DARRAY_int64_t(B, _23); //invoke (%24) = (%6, %3, %4) MatrixMult_original:init : function(int[],int,int)->(int[]) { void* tmp_data; _COPY_1DARRAY_PARAM(B, tmp_data, int64_t); _24 = _init_(tmp_data, B_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_24)); } //assign %6 = %24 : int[] _COPY_1DARRAY_int64_t(B, _24); //const %25 = 0 : int _25 = 0; //mul %26 = %3, %4 : int _26=width*height; //arraygen %27 = [25; 26] : int[] _NEW_1DARRAY_int64_t(_27, _26, _25); //assign %7 = %27 : int[] _COPY_1DARRAY_int64_t(C, _27); //invoke (%28) = (%5, %6, %7, %3, %4) MatrixMult_original:mat_mult : function(int[],int[],int[],int,int)->(int[]) { void* tmp_a; _COPY_1DARRAY_PARAM(A, tmp_a, int64_t); void* tmp_b; _COPY_1DARRAY_PARAM(B, tmp_b, int64_t); void* tmp_data; _COPY_1DARRAY_PARAM(C, tmp_data, int64_t); _28 = _mat_mult_(tmp_a, A_size, tmp_b, B_size, tmp_data, C_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_28)); } //assign %7 = %28 : int[] _COPY_1DARRAY_int64_t(C, _28); //fieldload %29 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %30 = %29 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %31 = 1 : int _31 = 1; //sub %32 = %2, %31 : int _32=size-_31; //mul %33 = %32, %2 : int _33=_32*size; //add %34 = %33, %2 : int _34=_33+size; //const %35 = 1 : int _35 = 1; //sub %36 = %34, %35 : int _36=_34-_35; //indexof %37 = %7, %36 : int[] _37=C[_36]; //indirectinvoke () = %30 (%37) : method(any)->() { printf("%"PRId64"\n", _37); } //fieldload %38 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %39 = %38 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %40 = [80,97,115,115,32,77,97,116,114,105,120,77,117,108,116,32,116,101,115,116,32,99,97,115,101] : int[] _NEW_1DARRAY_int64_t(_40, 25, 0); _40[0] = 80; _40[1] = 97; _40[2] = 115; _40[3] = 115; _40[4] = 32; _40[5] = 77; _40[6] = 97; _40[7] = 116; _40[8] = 114; _40[9] = 105; _40[10] = 120; _40[11] = 77; _40[12] = 117; _40[13] = 108; _40[14] = 116; _40[15] = 32; _40[16] = 116; _40[17] = 101; _40[18] = 115; _40[19] = 116; _40[20] = 32; _40[21] = 99; _40[22] = 97; _40[23] = 115; _40[24] = 101; //indirectinvoke () = %39 (%40) : method(int[])->() { println_s(_40, _40_size); } //.blklab10 blklab10:; //return 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); }
int64_t* _reverse_(_DECL_1DARRAY_PARAM(ls), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY(_1); int64_t i; _DECL_1DARRAY(r); int64_t item; int64_t _5; int64_t _6; int64_t _7; _DECL_1DARRAY(_8); int64_t _9; int64_t _10; int64_t _11; int64_t _12; int64_t _13; int64_t _14; int64_t _15; int64_t _16; int64_t _17; //lengthof %5 = %0 : int[] _5 = ls_size; //assign %2 = %5 : int i = _5; //const %6 = 0 : int _6 = 0; //lengthof %7 = %0 : int[] _7 = ls_size; //arraygen %8 = [6; 7] : int[] _NEW_1DARRAY_int64_t(_8, _7, _6); //assign %3 = %8 : int[] _COPY_1DARRAY_int64_t(r, _8); //loop (%2, %3, %4, %9, %10, %11, %12, %13, %14, %15, %16, %17) while(true){ //const %12 = 0 : int _12 = 0; //ifle %2, %12 goto blklab0 : int if(i<=_12){goto blklab0;} //lengthof %13 = %0 : int[] _13 = ls_size; //sub %14 = %13, %2 : int _14=_13-i; //indexof %15 = %0, %14 : int[] _15=ls[_14]; //assign %4 = %15 : int item = _15; //const %16 = 1 : int _16 = 1; //sub %17 = %2, %16 : int _17=i-_16; //assign %2 = %17 : int i = _17; //update %3[%2] = %4 : int[] -> int[] r[i] = item; //.blklab1 blklab1:; } //.blklab0 blklab0:; //return %3 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(r); return r; //return }
int main(int argc, char** args){ int64_t* max; int64_t n; _DECL_1DARRAY(coins); int64_t i; _DECL_1DARRAY(moves); int64_t sum_alice; int64_t* _7; _DECL_2DARRAY(_8); int64_t _9; _DECL_1DARRAY(_10); int64_t _11; _DECL_1DARRAY(_12); int64_t _13; int64_t _14; int64_t _15; int64_t _16; int64_t _17; int64_t _18; int64_t _19; int64_t _20; int64_t _21; int64_t _22; int64_t _23; _DECL_1DARRAY(_24); _DECL_1DARRAY(_25); int64_t _26; int64_t _27; int64_t _28; void* _29; _DECL_1DARRAY(_31); void* _32; void* _34; _DECL_1DARRAY(_36); //fieldload %8 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} _CONV_ARGS(_8); //const %9 = 0 : int _9 = 0; //indexof %10 = %8, %9 : int[][] _10=_8[_9]; _10_size = _8_size_size; //invoke (%7) = (%10) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int) { _STR_TO_INT(_7, _10); } //assign %1 = %7 : null|int _NEW_INTEGER_POINTER(max, _7); //ifis %1, null goto blklab4 : null|int if(max == NULL) { goto blklab4;} //assign %2 = %1 : int n = *max; //const %11 = 0 : int _11 = 0; //arraygen %12 = [11; 2] : int[] _NEW_1DARRAY_int64_t(_12, n, _11); //assign %3 = %12 : int[] _COPY_1DARRAY_int64_t(coins, _12); //const %13 = 0 : int _13 = 0; //assign %4 = %13 : int i = _13; //loop (%3, %4, %14, %15, %16, %17) while(true){ //ifge %4, %2 goto blklab5 : int if(i>=n){goto blklab5;} //const %14 = 5 : int _14 = 5; //rem %15 = %4, %14 : int _15=i%_14; //update %3[%4] = %15 : int[] -> int[] coins[i] = _15; //const %16 = 1 : int _16 = 1; //add %17 = %4, %16 : int _17=i+_16; //assign %4 = %17 : int i = _17; //.blklab6 blklab6:; } //.blklab5 blklab5:; //const %18 = 0 : int _18 = 0; //const %19 = 2 : int _19 = 2; //add %20 = %2, %19 : int _20=n+_19; //const %21 = 2 : int _21 = 2; //add %22 = %2, %21 : int _22=n+_21; //mul %23 = %20, %22 : int _23=_20*_22; //arraygen %24 = [18; 23] : int[] _NEW_1DARRAY_int64_t(_24, _23, _18); //assign %5 = %24 : int[] _COPY_1DARRAY_int64_t(moves, _24); //invoke (%25) = (%5, %2, %3) CoinGame_original:findMoves : function(int[],int,int[])->(int[]) { void* tmp_moves; _COPY_1DARRAY_PARAM(moves, tmp_moves, int64_t); void* tmp_coins; _COPY_1DARRAY_PARAM(coins, tmp_coins, int64_t); _25 = _findMoves_(tmp_moves, moves_size, n, tmp_coins, coins_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_25)); } //assign %5 = %25 : int[] _COPY_1DARRAY_int64_t(moves, _25); //const %26 = 1 : int _26 = 1; //sub %27 = %2, %26 : int _27=n-_26; //indexof %28 = %5, %27 : int[] _28=moves[_27]; //assign %6 = %28 : int sum_alice = _28; //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 = [84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,109,111,110,101,121,32,40,109,97,120,105,109,117,109,41,32,65,108,105,99,101,32,103,101,116,115,32,105,115,32] : int[] _NEW_1DARRAY_int64_t(_31, 50, 0); _31[0] = 84; _31[1] = 104; _31[2] = 101; _31[3] = 32; _31[4] = 116; _31[5] = 111; _31[6] = 116; _31[7] = 97; _31[8] = 108; _31[9] = 32; _31[10] = 97; _31[11] = 109; _31[12] = 111; _31[13] = 117; _31[14] = 110; _31[15] = 116; _31[16] = 32; _31[17] = 111; _31[18] = 102; _31[19] = 32; _31[20] = 109; _31[21] = 111; _31[22] = 110; _31[23] = 101; _31[24] = 121; _31[25] = 32; _31[26] = 40; _31[27] = 109; _31[28] = 97; _31[29] = 120; _31[30] = 105; _31[31] = 109; _31[32] = 117; _31[33] = 109; _31[34] = 41; _31[35] = 32; _31[36] = 65; _31[37] = 108; _31[38] = 105; _31[39] = 99; _31[40] = 101; _31[41] = 32; _31[42] = 103; _31[43] = 101; _31[44] = 116; _31[45] = 115; _31[46] = 32; _31[47] = 105; _31[48] = 115; _31[49] = 32; //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 (%6) : method(any)->() { printf("%"PRId64"\n", sum_alice); } //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,67,111,105,110,71,97,109,101,32,116,101,115,116,32,99,97,115,101] : int[] _NEW_1DARRAY_int64_t(_36, 23, 0); _36[0] = 80; _36[1] = 97; _36[2] = 115; _36[3] = 115; _36[4] = 32; _36[5] = 67; _36[6] = 111; _36[7] = 105; _36[8] = 110; _36[9] = 71; _36[10] = 97; _36[11] = 109; _36[12] = 101; _36[13] = 32; _36[14] = 116; _36[15] = 101; _36[16] = 115; _36[17] = 116; _36[18] = 32; _36[19] = 99; _36[20] = 97; _36[21] = 115; _36[22] = 101; //indirectinvoke () = %35 (%36) : method(int[])->() { println_s(_36, _36_size); } //.blklab4 blklab4:; //return exit(0); }
int main(int argc, char** args){ int64_t size; int64_t width; int64_t height; _DECL_1DARRAY(A); _DECL_1DARRAY(B); _DECL_1DARRAY(C); int64_t _7; void* _8; _DECL_1DARRAY(_10); void* _11; int64_t _13; int64_t _14; _DECL_1DARRAY(_15); _DECL_1DARRAY(_16); int64_t _17; int64_t _18; _DECL_1DARRAY(_19); _DECL_1DARRAY(_20); int64_t _21; int64_t _22; _DECL_1DARRAY(_23); _DECL_1DARRAY(_24); int64_t _25; int64_t _26; int64_t _27; int64_t _28; int64_t _29; int64_t _30; int64_t _31; int64_t _32; int64_t _33; int64_t _34; int64_t _35; int64_t _36; int64_t _37; int64_t _38; int64_t _39; int64_t _40; int64_t _41; int64_t _42; int64_t _43; int64_t _44; int64_t _45; void* _46; _DECL_1DARRAY(_48); void* _49; int64_t _51; int64_t _52; int64_t _53; int64_t _54; int64_t _55; int64_t _56; int64_t _57; void* _58; _DECL_1DARRAY(_60); //const %7 = 20 : int _7 = 20; //assign %1 = %7 : int size = _7; //assign %2 = %1 : int width = size; //assign %3 = %1 : int height = size; //fieldload %8 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %9 = %8 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %10 = [115,105,122,101,32,61,32] : int[] _NEW_1DARRAY_int64_t(_10, 7, 0); _10[0] = 115; _10[1] = 105; _10[2] = 122; _10[3] = 101; _10[4] = 32; _10[5] = 61; _10[6] = 32; //indirectinvoke () = %9 (%10) : method(int[])->() { printf_s(_10, _10_size); } //fieldload %11 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %12 = %11 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %12 (%1) : method(any)->() { printf("%"PRId64"\n", size); } //const %13 = 0 : int _13 = 0; //mul %14 = %2, %3 : int _14=width*height; //arraygen %15 = [13; 14] : int[] _NEW_1DARRAY_int64_t(_15, _14, _13); //assign %4 = %15 : int[] _COPY_1DARRAY_int64_t(A, _15); //invoke (%16) = (%4, %2, %3) MatrixMult:init : function(int[],int,int)->(int[]) { void* tmp_data; _COPY_1DARRAY_PARAM(A, tmp_data, int64_t); _16 = _init_(tmp_data, A_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_16)); } //assign %4 = %16 : int[] _COPY_1DARRAY_int64_t(A, _16); //const %17 = 0 : int _17 = 0; //mul %18 = %2, %3 : int _18=width*height; //arraygen %19 = [17; 18] : int[] _NEW_1DARRAY_int64_t(_19, _18, _17); //assign %5 = %19 : int[] _COPY_1DARRAY_int64_t(B, _19); //invoke (%20) = (%5, %2, %3) MatrixMult:init : function(int[],int,int)->(int[]) { void* tmp_data; _COPY_1DARRAY_PARAM(B, tmp_data, int64_t); _20 = _init_(tmp_data, B_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_20)); } //assign %5 = %20 : int[] _COPY_1DARRAY_int64_t(B, _20); //const %21 = 0 : int _21 = 0; //mul %22 = %2, %3 : int _22=width*height; //arraygen %23 = [21; 22] : int[] _NEW_1DARRAY_int64_t(_23, _22, _21); //assign %6 = %23 : int[] _COPY_1DARRAY_int64_t(C, _23); //invoke (%24) = (%4, %5, %6, %2, %3) MatrixMult:mat_mult : function(int[],int[],int[],int,int)->(int[]) { void* tmp_a; _COPY_1DARRAY_PARAM(A, tmp_a, int64_t); void* tmp_b; _COPY_1DARRAY_PARAM(B, tmp_b, int64_t); void* tmp_data; _COPY_1DARRAY_PARAM(C, tmp_data, int64_t); _24 = _mat_mult_(tmp_a, A_size, tmp_b, B_size, tmp_data, C_size, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_24)); } //assign %6 = %24 : int[] _COPY_1DARRAY_int64_t(C, _24); //assert { //const %25 = 19 : int _25 = 19; //const %26 = 20 : int _26 = 20; //mul %27 = %25, %26 : int _27=_25*_26; //const %28 = 19 : int _28 = 19; //add %29 = %27, %28 : int _29=_27+_28; //indexof %30 = %4, %29 : int[] _30=A[_29]; //const %31 = 19 : int _31 = 19; //ifeq %30, %31 goto blklab10 : int if(_30==_31){goto blklab10;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab10 blklab10:; //assert } //assert { //const %32 = 19 : int _32 = 19; //const %33 = 20 : int _33 = 20; //mul %34 = %32, %33 : int _34=_32*_33; //const %35 = 19 : int _35 = 19; //add %36 = %34, %35 : int _36=_34+_35; //indexof %37 = %5, %36 : int[] _37=B[_36]; //const %38 = 19 : int _38 = 19; //ifeq %37, %38 goto blklab11 : int if(_37==_38){goto blklab11;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab11 blklab11:; //assert } //assert { //const %39 = 19 : int _39 = 19; //const %40 = 20 : int _40 = 20; //mul %41 = %39, %40 : int _41=_39*_40; //const %42 = 19 : int _42 = 19; //add %43 = %41, %42 : int _43=_41+_42; //indexof %44 = %6, %43 : int[] _44=C[_43]; //const %45 = 3610 : int _45 = 3610; //ifeq %44, %45 goto blklab12 : int if(_44==_45){goto blklab12;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab12 blklab12:; //assert } //fieldload %46 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %47 = %46 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %48 = [77,97,116,114,105,120,32,67,91,115,105,122,101,45,49,93,91,115,105,122,101,45,49,93,32,61,32] : int[] _NEW_1DARRAY_int64_t(_48, 27, 0); _48[0] = 77; _48[1] = 97; _48[2] = 116; _48[3] = 114; _48[4] = 105; _48[5] = 120; _48[6] = 32; _48[7] = 67; _48[8] = 91; _48[9] = 115; _48[10] = 105; _48[11] = 122; _48[12] = 101; _48[13] = 45; _48[14] = 49; _48[15] = 93; _48[16] = 91; _48[17] = 115; _48[18] = 105; _48[19] = 122; _48[20] = 101; _48[21] = 45; _48[22] = 49; _48[23] = 93; _48[24] = 32; _48[25] = 61; _48[26] = 32; //indirectinvoke () = %47 (%48) : method(int[])->() { printf_s(_48, _48_size); } //fieldload %49 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %50 = %49 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %51 = 1 : int _51 = 1; //sub %52 = %1, %51 : int _52=size-_51; //mul %53 = %52, %1 : int _53=_52*size; //add %54 = %53, %1 : int _54=_53+size; //const %55 = 1 : int _55 = 1; //sub %56 = %54, %55 : int _56=_54-_55; //indexof %57 = %6, %56 : int[] _57=C[_56]; //indirectinvoke () = %50 (%57) : method(any)->() { printf("%"PRId64"\n", _57); } //fieldload %58 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %59 = %58 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %60 = [80,97,115,115,32,77,97,116,114,105,120,77,117,108,116,32,116,101,115,116,32,99,97,115,101] : int[] _NEW_1DARRAY_int64_t(_60, 25, 0); _60[0] = 80; _60[1] = 97; _60[2] = 115; _60[3] = 115; _60[4] = 32; _60[5] = 77; _60[6] = 97; _60[7] = 116; _60[8] = 114; _60[9] = 105; _60[10] = 120; _60[11] = 77; _60[12] = 117; _60[13] = 108; _60[14] = 116; _60[15] = 32; _60[16] = 116; _60[17] = 101; _60[18] = 115; _60[19] = 116; _60[20] = 32; _60[21] = 99; _60[22] = 97; _60[23] = 115; _60[24] = 101; //indirectinvoke () = %59 (%60) : method(int[])->() { println_s(_60, _60_size); } //return exit(0); }
int main(int argc, char** args){ _DECL_1DARRAY(x); _DECL_1DARRAY(tmp); int64_t _3; int64_t _4; _DECL_1DARRAY(_5); _DECL_1DARRAY(_6); int64_t _7; int64_t _8; int64_t _9; int64_t _10; void* _11; _DECL_1DARRAY(_13); void* _14; int64_t _16; int64_t _17; //const %3 = 2 : int _3 = 2; //const %4 = 3 : int _4 = 3; //arraygen %5 = [3; 4] : int[] _NEW_1DARRAY_int64_t(_5, _4, _3); //assign %1 = %5 : int[] _COPY_1DARRAY_int64_t(x, _5); //const %7 = 11 : int _7 = 11; //invoke (%6) = (%1, %7) ResetMacro1:func : function(int[],int)->(int[]) { void* tmp_x; _COPY_1DARRAY_PARAM(x, tmp_x, int64_t); _6 = _func_(tmp_x, x_size, _7, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_6)); } //assign %2 = %6 : int[] _COPY_1DARRAY_int64_t(tmp, _6); //assign %1 = %2 : int[] _COPY_1DARRAY_int64_t(x, tmp); //assert { //const %8 = 0 : int _8 = 0; //indexof %9 = %1, %8 : int[] _9=x[_8]; //const %10 = 11 : int _10 = 11; //ifeq %9, %10 goto blklab0 : int if(_9==_10){goto blklab0;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab0 blklab0:; //assert } //fieldload %11 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %12 = %11 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %13 = [120,91,48,93,32,61,32] : int[] _NEW_1DARRAY_int64_t(_13, 7, 0); _13[0] = 120; _13[1] = 91; _13[2] = 48; _13[3] = 93; _13[4] = 32; _13[5] = 61; _13[6] = 32; //indirectinvoke () = %12 (%13) : method(int[])->() { printf_s(_13, _13_size); } //fieldload %14 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %15 = %14 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %16 = 0 : int _16 = 0; //indexof %17 = %1, %16 : int[] _17=x[_16]; //indirectinvoke () = %15 (%17) : method(any)->() { printf("%"PRId64"\n", _17); } //return exit(0); }