BYTE* _append_(BYTE* items, size_t items_size, BYTE item, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(nitems); int64_t i; BYTE _4; int64_t _5; int64_t _6; int64_t _7; _DECL_1DARRAY_BYTE(_8); int64_t _9; int64_t _10; BYTE _11; int64_t _12; int64_t _13; //const %4 = 00000000b : byte _4 = 0b00000000; //lengthof %5 = %0 : byte[] _5 = items_size; //const %6 = 1 : int _6 = 1; //add %7 = %5, %6 : int _7=_5+_6; //arraygen %8 = [4; 7] : byte[] _NEW_1DARRAY_BYTE(_8, _7, _4); //assign %2 = %8 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(nitems, _8); //const %9 = 0 : int _9 = 0; //assign %3 = %9 : int // isCopyEliminated = true i = _9; //loop (%2, %3, %10, %11, %12, %13) while(true){ //lengthof %10 = %0 : byte[] _10 = items_size; //ifge %3, %10 goto blklab1 : int if(i>=_10){goto blklab1;} //indexof %11 = %0, %3 : byte[] _11=items[i]; //update %2[%3] = %11 : byte[] -> byte[] nitems[i] = _11; //const %12 = 1 : int _12 = 1; //add %13 = %3, %12 : int _13=i+_12; //assign %3 = %13 : int // isCopyEliminated = true i = _13; //.blklab2 blklab2:; } //.blklab1 blklab1:; //update %2[%3] = %1 : byte[] -> byte[] nitems[i] = item; //return %2 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(nitems); return nitems; //return }
int main(int argc, char** args){ _DECL_1DARRAY_BYTE(input); _DECL_1DARRAY_BYTE(arr); _DECL_1DARRAY_BYTE(arr1); BYTE _4; BYTE _5; BYTE _6; _DECL_1DARRAY_BYTE(_7); _DECL_1DARRAY_BYTE(_8); _DECL_1DARRAY_BYTE(_9); void* _10; void* _12; //const %4 = 01100001b : byte _4 = 0b01100001; //const %5 = 01100010b : byte _5 = 0b01100010; //const %6 = 01100011b : byte _6 = 0b01100011; //newlist %7 = (%4, %5, %6) : byte[] _NEW_1DARRAY_BYTE(_7, 3, 0b0); _7[0] = _4; _7[1] = _5; _7[2] = _6; //assign %1 = %7 : byte[] _COPY_1DARRAY_BYTE(input, _7); //invoke (%8) = (%1) appendarray1:f_append : function(byte[])->(byte[]) { void* tmp_input; _COPY_1DARRAY_PARAM(input, tmp_input, BYTE); _8 = _f_append_(tmp_input, input_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_8)); } //assign %2 = %8 : byte[] _COPY_1DARRAY_BYTE(arr, _8); //invoke (%9) = (%1) appendarray1:f_resize : function(byte[])->(byte[]) { void* tmp_input; _COPY_1DARRAY_PARAM(input, tmp_input, BYTE); _9 = _f_resize_(tmp_input, input_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_9)); } //assign %3 = %9 : byte[] _COPY_1DARRAY_BYTE(arr1, _9); //fieldload %10 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %11 = %10 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %11 (%2) : method(any)->() { _PRINT_1DARRAY_BYTE(arr); } //fieldload %12 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %13 = %12 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %13 (%3) : method(any)->() { _PRINT_1DARRAY_BYTE(arr1); } //return exit(0); }
BYTE* _resize_(BYTE* items, size_t items_size, _DECL_DEALLOC_PARAM(items), int64_t size, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(nitems); _DECL_DEALLOC(nitems); int64_t i; BYTE _4; _DECL_1DARRAY_BYTE(_5); _DECL_DEALLOC(_5); int64_t _6; BYTE _7; int64_t _8; int64_t _9; //const %4 = 00000000b : byte _4 = 0b00000000; //arraygen %5 = [4; 1] : byte[] _DEALLOC(_5); _NEW_1DARRAY_BYTE(_5, size, _4); _ADD_DEALLOC(_5); //assign %2 = %5 : byte[] _DEALLOC(nitems); _COPY_1DARRAY_BYTE(nitems, _5); _ADD_DEALLOC(nitems); //const %6 = 0 : int _6 = 0; //assign %3 = %6 : int i = _6; //loop (%2, %3, %7, %8, %9) while(true){ //ifge %3, %1 goto blklab5 : int if(i>=size){goto blklab5;} //indexof %7 = %0, %3 : byte[] _7=items[i]; //update %2[%3] = %7 : byte[] -> byte[] nitems[i] = _7; //const %8 = 1 : int _8 = 1; //add %9 = %3, %8 : int _9=i+_8; //assign %3 = %9 : int i = _9; //.blklab6 blklab6:; } //.blklab5 blklab5:; //return %2 _DEALLOC(items); _DEALLOC(_5); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(nitems); return nitems; //return }
int main(int argc, char** args){ _DECL_1DARRAY_BYTE(data); _DECL_1DARRAY_BYTE(arr); BYTE _3; BYTE _4; BYTE _5; _DECL_1DARRAY_BYTE(_6); _DECL_1DARRAY_BYTE(_7); BYTE _8; BYTE _9; BYTE _10; BYTE _11; BYTE _12; BYTE _13; _DECL_1DARRAY_BYTE(_14); void* _15; int64_t _17; //const %3 = 01100001b : byte _3 = 0b01100001; //const %4 = 01100010b : byte _4 = 0b01100010; //const %5 = 01100011b : byte _5 = 0b01100011; //newlist %6 = (%3, %4, %5) : byte[] _NEW_1DARRAY_BYTE(_6, 3, 0b0); _6[0] = _3; _6[1] = _4; _6[2] = _5; //assign %1 = %6 : byte[] _COPY_1DARRAY_BYTE(data, _6); //invoke (%7) = (%1) appendarray:f : function(byte[])->(byte[]) { void* tmp_data; _COPY_1DARRAY_PARAM(data, tmp_data, BYTE); _7 = _f_(tmp_data, data_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_7)); } //assign %2 = %7 : byte[] _COPY_1DARRAY_BYTE(arr, _7); //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 : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //lengthof %17 = %2 : byte[] _17 = arr_size; //indirectinvoke () = %16 (%17) : method(any)->() { printf("%"PRId64, _17); } //return exit(0); }
BYTE* _f_(BYTE* data, size_t data_size, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); int64_t pos; BYTE item; BYTE length; int64_t _5; BYTE _6; int64_t _7; _DECL_1DARRAY_BYTE(_8); int64_t _9; BYTE _10; BYTE _11; int64_t _12; int64_t _13; _DECL_1DARRAY_BYTE(_14); _DECL_1DARRAY_BYTE(_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; _DECL_1DARRAY_BYTE(_25); //const %5 = 0 : int _5 = 0; //assign %2 = %5 : int pos = _5; //const %6 = 00000000b : byte _6 = 0b00000000; //const %7 = 0 : int _7 = 0; //const %16 = 2 : int _16 = 2; //lengthof %17 = %0 : byte[] _17 = data_size; //mul %18 = %16, %17 : int _18=_16*_17; //arraygen %8 = [6; 18] : byte[] _NEW_1DARRAY_BYTE(_8, _18, _6); //const %19 = 0 : int _19 = 0; //assign %20 = %19 : int _20 = _19; //assign %1 = %8 : byte[] _COPY_1DARRAY_BYTE(output, _8); //loop (%1, %2, %3, %4, %9, %10, %11, %12, %13, %14, %15, %20) while(true){ //lengthof %9 = %0 : byte[] _9 = data_size; //ifge %2, %9 goto blklab7 : int if(pos>=_9){goto blklab7;} //indexof %10 = %0, %2 : byte[] _10=data[pos]; //assign %3 = %10 : byte item = _10; //invoke (%11) = (%2) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _11 = (BYTE)pos; } //assign %4 = %11 : byte length = _11; //const %12 = 1 : int _12 = 1; //add %13 = %2, %12 : int _13=pos+_12; //assign %2 = %13 : int pos = _13; //update %1[%20] = %4 : byte[] -> byte[] output[_20] = length; //const %21 = 1 : int _21 = 1; //add %22 = %20, %21 : int _22=_20+_21; //assign %20 = %22 : int _20 = _22; //update %1[%20] = %3 : byte[] -> byte[] output[_20] = item; //const %23 = 1 : int _23 = 1; //add %24 = %20, %23 : int _24=_20+_23; //assign %20 = %24 : int _20 = _24; //.blklab8 blklab8:; } //.blklab7 blklab7:; //invoke (%25) = (%1, %20) appendarray:resize : function(byte[],int)->(byte[]) { void* tmp_items; _COPY_1DARRAY_PARAM(output, tmp_items, BYTE); _25 = _resize_(tmp_items, output_size, _20, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_25)); } //assign %1 = %25 : byte[] _COPY_1DARRAY_BYTE(output, _25); //return %1 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
int main(int argc, char** args){ _DECL_1DARRAY_BYTE(b); int64_t inspos; BYTE item; _DECL_1DARRAY_BYTE(a); BYTE _5; int64_t _6; _DECL_1DARRAY_BYTE(_7); int64_t _8; BYTE _9; int64_t _10; _DECL_1DARRAY_BYTE(_11); int64_t _12; BYTE _13; BYTE _14; int64_t _15; BYTE _16; int64_t _17; BYTE _18; int64_t _19; BYTE _20; BYTE _21; int64_t _22; int64_t _23; int64_t _24; int64_t _25; void* _26; _DECL_1DARRAY(_28); void* _29; int64_t _31; BYTE _32; void* _33; _DECL_1DARRAY(_35); void* _36; int64_t _38; void* _39; _DECL_1DARRAY(_41); //const %5 = 00000000b : byte _5 = 0b00000000; //const %6 = 3 : int _6 = 3; //arraygen %7 = [5; 6] : byte[] _NEW_1DARRAY_BYTE(_7, _6, _5); //assign %1 = %7 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(b, _7); //const %8 = 3 : int _8 = 3; //assign %2 = %8 : int // isCopyEliminated = true inspos = _8; //const %10 = 1 : int _10 = 1; //invoke (%9) = (%10) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _9 = (BYTE)_10; } //assign %3 = %9 : byte // isCopyEliminated = true item = _9; //invoke (%11) = (%1, %2, %3) opt_append:opt_append : function(byte[],opt_append:nat,byte)->(byte[]) { void* tmp_items; _COPY_1DARRAY_PARAM(b, tmp_items, BYTE); // isCopyEliminated of 'b at 0' = false _11 = _opt_append_(tmp_items, b_size, inspos, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_11)); } //assign %4 = %11 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(a, _11); //assert { //const %12 = 2 : int _12 = 2; //indexof %13 = %1, %12 : byte[] _13=b[_12]; //const %14 = 00000000b : byte _14 = 0b00000000; //ifeq %13, %14 goto blklab14 : byte if(_13==_14){goto blklab14;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab14 blklab14:; //assert } //assert { //const %15 = 2 : int _15 = 2; //indexof %16 = %4, %15 : byte[] _16=a[_15]; //const %17 = 2 : int _17 = 2; //indexof %18 = %1, %17 : byte[] _18=b[_17]; //ifeq %16, %18 goto blklab15 : byte if(_16==_18){goto blklab15;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab15 blklab15:; //assert } //assert { //const %19 = 3 : int _19 = 3; //indexof %20 = %4, %19 : byte[] _20=a[_19]; //const %21 = 00000001b : byte _21 = 0b00000001; //ifeq %20, %21 goto blklab16 : byte if(_20==_21){goto blklab16;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab16 blklab16:; //assert } //assert { //lengthof %22 = %1 : byte[] _22 = b_size; //const %23 = 3 : int _23 = 3; //ifeq %22, %23 goto blklab17 : int if(_22==_23){goto blklab17;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab17 blklab17:; //assert } //assert { //lengthof %24 = %4 : byte[] _24 = a_size; //const %25 = 7 : int _25 = 7; //ifeq %24, %25 goto blklab18 : int if(_24==_25){goto blklab18;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab18 blklab18:; //assert } //fieldload %26 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %27 = %26 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %28 = [97,91,51,93,61] : int[] _NEW_1DARRAY_int64_t(_28, 5, 0); _28[0] = 97; _28[1] = 91; _28[2] = 51; _28[3] = 93; _28[4] = 61; //indirectinvoke () = %27 (%28) : method(int[])->() { printf_s(_28, _28_size); } //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 = 3 : int _31 = 3; //indexof %32 = %4, %31 : byte[] _32=a[_31]; //indirectinvoke () = %30 (%32) : method(any)->() { printf("%"PRIu8"\n", _32); } //fieldload %33 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %34 = %33 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %35 = [65,114,114,97,121,32,97,58,32] : int[] _NEW_1DARRAY_int64_t(_35, 9, 0); _35[0] = 65; _35[1] = 114; _35[2] = 114; _35[3] = 97; _35[4] = 121; _35[5] = 32; _35[6] = 97; _35[7] = 58; _35[8] = 32; //indirectinvoke () = %34 (%35) : method(int[])->() { printf_s(_35, _35_size); } //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 : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //lengthof %38 = %4 : byte[] _38 = a_size; //indirectinvoke () = %37 (%38) : method(any)->() { printf("%"PRId64, _38); } //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_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %41 = [98,121,116,101,115] : int[] _NEW_1DARRAY_int64_t(_41, 5, 0); _41[0] = 98; _41[1] = 121; _41[2] = 116; _41[3] = 101; _41[4] = 115; //indirectinvoke () = %40 (%41) : method(int[])->() { println_s(_41, _41_size); } //return exit(0); }
BYTE* _opt_append_(BYTE* items, size_t items_size, int64_t inspos, BYTE item, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_1DARRAY_BYTE(nitems); int64_t index; int64_t _6; BYTE _7; int64_t _8; int64_t _9; int64_t _10; int64_t _11; int64_t _12; _DECL_1DARRAY_BYTE(_13); int64_t _14; int64_t _15; int64_t _16; int64_t _17; int64_t _18; int64_t _19; int64_t _20; BYTE _21; BYTE _22; int64_t _23; BYTE _24; int64_t _25; int64_t _26; //lengthof %6 = %0 : byte[] _6 = items_size; //ifge %1, %6 goto blklab6 : int if(inspos>=_6){goto blklab6;} //update %0[%1] = %2 : byte[] -> byte[] items[inspos] = item; //return %0 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(items); return items; //goto blklab7 goto blklab7; //.blklab6 blklab6:; //const %7 = 00000000b : byte _7 = 0b00000000; //lengthof %8 = %0 : byte[] _8 = items_size; //const %9 = 2 : int _9 = 2; //mul %10 = %8, %9 : int _10=_8*_9; //const %11 = 1 : int _11 = 1; //add %12 = %10, %11 : int _12=_10+_11; //arraygen %13 = [7; 12] : byte[] _NEW_1DARRAY_BYTE(_13, _12, _7); //assign %4 = %13 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(nitems, _13); //const %14 = 0 : int _14 = 0; //assign %5 = %14 : int // isCopyEliminated = true index = _14; //loop (%4, %5, %15, %16, %18, %19, %20, %21, %22, %23, %24, %25, %26) while(true){ //lengthof %23 = %0 : byte[] _23 = items_size; //ifge %5, %23 goto blklab8 : int if(index>=_23){goto blklab8;} //indexof %24 = %0, %5 : byte[] _24=items[index]; //update %4[%5] = %24 : byte[] -> byte[] nitems[index] = _24; //const %25 = 1 : int _25 = 1; //add %26 = %5, %25 : int _26=index+_25; //assign %5 = %26 : int // isCopyEliminated = true index = _26; //.blklab9 blklab9:; } //.blklab8 blklab8:; //update %4[%5] = %2 : byte[] -> byte[] nitems[index] = item; //return %4 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(nitems); return nitems; //.blklab7 blklab7:; //return }
int main(int argc, char** args){ _DECL_1DARRAY_BYTE(input); _DECL_DEALLOC(input); _DECL_1DARRAY_BYTE(arr); _DECL_DEALLOC(arr); _DECL_1DARRAY_BYTE(arr1); _DECL_DEALLOC(arr1); BYTE _4; BYTE _5; BYTE _6; _DECL_1DARRAY_BYTE(_7); _DECL_DEALLOC(_7); _DECL_1DARRAY_BYTE(_8); _DECL_DEALLOC(_8); _DECL_1DARRAY_BYTE(_9); _DECL_DEALLOC(_9); void* _10; void* _12; //const %4 = 01100001b : byte _4 = 0b01100001; //const %5 = 01100010b : byte _5 = 0b01100010; //const %6 = 01100011b : byte _6 = 0b01100011; //newlist %7 = (%4, %5, %6) : byte[] _DEALLOC(_7); _NEW_1DARRAY_BYTE(_7, 3, 0b0); _7[0] = _4; _7[1] = _5; _7[2] = _6; _ADD_DEALLOC(_7); //assign %1 = %7 : byte[] _DEALLOC(input); _COPY_1DARRAY_BYTE(input, _7); _ADD_DEALLOC(input); //invoke (%8) = (%1) appendarray1:f_append : function(byte[])->(byte[]) { void* input_tmp; _DEALLOC(_8); _8 = _f_append_(_COPY_1DARRAY_PARAM_BYTE(input), true, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_8)); _CALLEE_DEALLOC(input, "false-false-true" , "f_append"); _8_dealloc = true; } //assign %2 = %8 : byte[] _DEALLOC(arr); _COPY_1DARRAY_BYTE(arr, _8); _ADD_DEALLOC(arr); //invoke (%9) = (%1) appendarray1:f_resize : function(byte[])->(byte[]) { void* input_tmp; _DEALLOC(_9); _9 = _f_resize_(_COPY_1DARRAY_PARAM_BYTE(input), true, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_9)); _CALLEE_DEALLOC(input, "false-false-false" , "f_resize"); _9_dealloc = true; } //assign %3 = %9 : byte[] _DEALLOC(arr1); _COPY_1DARRAY_BYTE(arr1, _9); _ADD_DEALLOC(arr1); //assert { //ifeq %2, %3 goto blklab12 : byte[] _IFEQ_ARRAY_BYTE(arr, arr1, blklab12); //fail fprintf(stderr,"fail"); exit(-1); //.blklab12 blklab12:; //assert } //fieldload %10 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %11 = %10 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %11 (%2) : method(any)->() { _PRINT_1DARRAY_BYTE(arr); } //fieldload %12 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %13 = %12 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //indirectinvoke () = %13 (%3) : method(any)->() { _PRINT_1DARRAY_BYTE(arr1); } //return _DEALLOC(input); _DEALLOC(arr); _DEALLOC(arr1); _DEALLOC(_7); _DEALLOC(_8); _DEALLOC(_9); exit(0); }
BYTE* _f_resize_(BYTE* input, size_t input_size, _DECL_DEALLOC_PARAM(input), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_DEALLOC(output); int64_t pos; int64_t size; BYTE index; BYTE item; int64_t _6; BYTE _7; int64_t _8; int64_t _9; int64_t _10; _DECL_1DARRAY_BYTE(_11); _DECL_DEALLOC(_11); int64_t _12; int64_t _13; BYTE _14; BYTE _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; _DECL_1DARRAY_BYTE(_25); _DECL_DEALLOC(_25); //const %6 = 0 : int _6 = 0; //assign %2 = %6 : int pos = _6; //const %7 = 00000000b : byte _7 = 0b00000000; //const %8 = 2 : int _8 = 2; //lengthof %9 = %0 : byte[] _9 = input_size; //mul %10 = %8, %9 : int _10=_8*_9; //arraygen %11 = [7; 10] : byte[] _DEALLOC(_11); _NEW_1DARRAY_BYTE(_11, _10, _7); _ADD_DEALLOC(_11); //assign %1 = %11 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _11); _ADD_DEALLOC(output); //const %12 = 0 : int _12 = 0; //assign %3 = %12 : int size = _12; //loop (%1, %2, %3, %4, %5, %13, %14, %15, %16, %17, %18, %19, %20, %21) while(true){ //lengthof %13 = %0 : byte[] _13 = input_size; //ifge %2, %13 goto blklab9 : int if(pos>=_13){goto blklab9;} //invoke (%14) = (%2) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _14 = (BYTE)pos; } //assign %4 = %14 : byte index = _14; //indexof %15 = %0, %2 : byte[] _15=input[pos]; //assign %5 = %15 : byte item = _15; //update %1[%3] = %4 : byte[] -> byte[] output[size] = index; //const %16 = 1 : int _16 = 1; //add %17 = %3, %16 : int _17=size+_16; //assign %3 = %17 : int size = _17; //update %1[%3] = %5 : byte[] -> byte[] output[size] = item; //const %18 = 1 : int _18 = 1; //add %19 = %3, %18 : int _19=size+_18; //assign %3 = %19 : int size = _19; //const %20 = 1 : int _20 = 1; //add %21 = %2, %20 : int _21=pos+_20; //assign %2 = %21 : int pos = _21; //.blklab10 blklab10:; } //.blklab9 blklab9:; //assert { //const %22 = 2 : int _22 = 2; //lengthof %23 = %0 : byte[] _23 = input_size; //mul %24 = %22, %23 : int _24=_22*_23; //ifle %3, %24 goto blklab11 : int if(size<=_24){goto blklab11;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab11 blklab11:; //assert } //invoke (%25) = (%1, %3) appendarray1:resize : function(byte[],int)->(byte[]) { void* output_tmp; _DEALLOC(_25); _25 = _resize_(_COPY_1DARRAY_PARAM_BYTE(output), true, size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_25)); _CALLEE_DEALLOC(output, "false-false-false" , "resize"); _25_dealloc = true; } //assign %1 = %25 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _25); _ADD_DEALLOC(output); //return %1 _DEALLOC(input); _DEALLOC(_11); _DEALLOC(_25); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
int main(int argc, char** args){ int64_t* n; _DECL_DEALLOC(n); int64_t max = 0; _DECL_1DARRAY_BYTE(data); _DECL_DEALLOC(data); _DECL_1DARRAY_BYTE(arr); _DECL_DEALLOC(arr); int64_t* _5; _DECL_DEALLOC(_5); _DECL_2DARRAY(_6); _DECL_DEALLOC(_6); int64_t _7 = 0; _DECL_1DARRAY(_8); _DECL_DEALLOC(_8); BYTE _9; _DECL_1DARRAY_BYTE(_10); _DECL_DEALLOC(_10); _DECL_1DARRAY_BYTE(_11); _DECL_DEALLOC(_11); int64_t _12 = 0; int64_t _13 = 0; int64_t _14 = 0; int64_t _15 = 0; void* _16; int64_t _18 = 0; //fieldload %6 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} _DEALLOC_2DARRAY_int64_t(_6); _CONV_ARGS(_6); _ADD_DEALLOC(_6); //const %7 = 0 : int _7 = 0; //indexof %8 = %6, %7 : int[][] _8=_6[_7]; _8_size = _6_size_size; _REMOVE_DEALLOC(_8); //invoke (%5) = (%8) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int) { _STR_TO_INT(_5, _8); _ADD_DEALLOC(_5); _REMOVE_DEALLOC(_8); } //assign %1 = %5 : null|int _DEALLOC(n); _NEW_INTEGER_POINTER(n, _5); _ADD_DEALLOC(n); //ifis %1, null goto blklab9 : null|int if(n == NULL) { goto blklab9;} //assign %2 = %1 : int max = *n; //const %9 = 01100001b : byte _9 = 0b01100001; //arraygen %10 = [9; 2] : byte[] _DEALLOC(_10); _NEW_1DARRAY_BYTE(_10, max, _9); _ADD_DEALLOC(_10); //assign %3 = %10 : byte[] _DEALLOC(data); _COPY_1DARRAY_BYTE(data, _10); _ADD_DEALLOC(data); //invoke (%11) = (%3) AppendArrayPattern_original:comp : function(byte[])->(byte[]) { void* data_tmp; _DEALLOC(_11); _11 = _comp_(_COPY_1DARRAY_PARAM_BYTE(data), true, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_11)); _CALLEE_DEALLOC(data, "false-false-false" , "comp"); _ADD_DEALLOC(_11); } //assign %4 = %11 : byte[] _DEALLOC(arr); _COPY_1DARRAY_BYTE(arr, _11); _ADD_DEALLOC(arr); //assert { //lengthof %12 = %4 : byte[] _12 = arr_size; //const %13 = 2 : int _13 = 2; //lengthof %14 = %3 : byte[] _14 = data_size; //mul %15 = %13, %14 : int _15=_13*_14; //ifeq %12, %15 goto blklab10 : int if(_12==_15){goto blklab10;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab10 blklab10:; //assert } //fieldload %16 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %17 = %16 print : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //lengthof %18 = %4 : byte[] _18 = arr_size; //indirectinvoke () = %17 (%18) : method(any)->() { printf("%"PRId64, _18); } //.blklab9 blklab9:; //return _DEALLOC(n); _DEALLOC(data); _DEALLOC(arr); _DEALLOC(_5); _DEALLOC_2DARRAY_int64_t(_6); _DEALLOC(_8); _DEALLOC(_10); _DEALLOC(_11); exit(0); }
BYTE* _decompress_(BYTE* data, size_t data_size, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_1DARRAY_BYTE(items); int64_t inspos; int64_t pos; BYTE header; BYTE item; int64_t offset; int64_t len; int64_t start; int64_t i; BYTE _11; int64_t _12; _DECL_1DARRAY_BYTE(_13); int64_t _14; int64_t _15; int64_t _16; int64_t _17; int64_t _18; BYTE _19; int64_t _20; int64_t _21; BYTE _22; int64_t _23; int64_t _24; BYTE _25; _DECL_1DARRAY_BYTE(_26); int64_t _27; int64_t _28; int64_t _29; int64_t _30; int64_t _31; int64_t _32; BYTE _33; _DECL_1DARRAY_BYTE(_34); int64_t _35; int64_t _36; int64_t _37; int64_t _38; _DECL_1DARRAY_BYTE(_39); //const %11 = 00000000b : byte _11 = 0b00000000; //const %12 = 0 : int _12 = 0; //arraygen %13 = [11; 12] : byte[] _NEW_1DARRAY_BYTE(_13, _12, _11); //assign %2 = %13 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(items, _13); //const %14 = 0 : int _14 = 0; //assign %3 = %14 : int // isCopyEliminated = true inspos = _14; //const %15 = 0 : int _15 = 0; //assign %4 = %15 : int // isCopyEliminated = true pos = _15; //loop (%2, %3, %4, %5, %6, %7, %8, %9, %10, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38) while(true){ //const %16 = 1 : int _16 = 1; //add %17 = %4, %16 : int _17=pos+_16; //lengthof %18 = %0 : byte[] _18 = data_size; //ifge %17, %18 goto blklab18 : int if(_17>=_18){goto blklab18;} //indexof %19 = %0, %4 : byte[] _19=data[pos]; //assign %5 = %19 : byte // isCopyEliminated = true header = _19; //const %20 = 1 : int _20 = 1; //add %21 = %4, %20 : int _21=pos+_20; //indexof %22 = %0, %21 : byte[] _22=data[_21]; //assign %6 = %22 : byte // isCopyEliminated = true item = _22; //const %23 = 2 : int _23 = 2; //add %24 = %4, %23 : int _24=pos+_23; //assign %4 = %24 : int // isCopyEliminated = true pos = _24; //const %25 = 00000000b : byte _25 = 0b00000000; //ifne %5, %25 goto blklab20 : byte if(header!=_25){goto blklab20;} //invoke (%26) = (%2, %3, %6) lz77_opt_decompress:opt_append : function(byte[],lz77_opt_decompress:nat,byte)->(byte[]) { // isCopyEliminated of 'items at 0' = true _26 = _opt_append_(items, items_size, inspos, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_26)); } //assign %2 = %26 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(items, _26); //const %27 = 1 : int _27 = 1; //add %28 = %3, %27 : int _28=inspos+_27; //assign %3 = %28 : int // isCopyEliminated = true inspos = _28; //goto blklab21 goto blklab21; //.blklab20 blklab20:; //invoke (%29) = (%5) whiley/lang/Byte:toUnsignedInt : function(byte)->(whiley/lang/Int:uint) { _29 = (unsigned int)header; } //assign %7 = %29 : int // isCopyEliminated = true offset = _29; //invoke (%30) = (%6) whiley/lang/Byte:toUnsignedInt : function(byte)->(whiley/lang/Int:uint) { _30 = (unsigned int)item; } //assign %8 = %30 : int // isCopyEliminated = true len = _30; //sub %31 = %3, %7 : int _31=inspos-offset; //assign %9 = %31 : int // isCopyEliminated = true start = _31; //assign %10 = %9 : int // isCopyEliminated = false i = start; //loop (%2, %3, %6, %10, %32, %33, %34, %35, %36, %37, %38) while(true){ //add %32 = %9, %8 : int _32=start+len; //ifge %10, %32 goto blklab22 : int if(i>=_32){goto blklab22;} //indexof %33 = %2, %10 : byte[] _33=items[i]; //assign %6 = %33 : byte // isCopyEliminated = true item = _33; //invoke (%34) = (%2, %3, %6) lz77_opt_decompress:opt_append : function(byte[],lz77_opt_decompress:nat,byte)->(byte[]) { // isCopyEliminated of 'items at 0' = true _34 = _opt_append_(items, items_size, inspos, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_34)); } //assign %2 = %34 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(items, _34); //const %35 = 1 : int _35 = 1; //add %36 = %3, %35 : int _36=inspos+_35; //assign %3 = %36 : int // isCopyEliminated = true inspos = _36; //const %37 = 1 : int _37 = 1; //add %38 = %10, %37 : int _38=i+_37; //assign %10 = %38 : int // isCopyEliminated = true i = _38; //.blklab23 blklab23:; } //.blklab22 blklab22:; //.blklab21 blklab21:; //.blklab19 blklab19:; } //.blklab18 blklab18:; //invoke (%39) = (%2, %3) lz77_opt_decompress:resize : function(byte[],int)->(byte[]) { // isCopyEliminated of 'items at 0' = true _39 = _resize_(items, items_size, inspos, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_39)); } //assign %1 = %39 : byte[] // isCopyEliminated = true _UPDATE_1DARRAY(output, _39); //return %1 _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
BYTE* _compress_(BYTE* data, size_t data_size, _DECL_DEALLOC_PARAM(data), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_DEALLOC(output); int64_t pos; Match* m; _DECL_DEALLOC(m); BYTE offset; BYTE length; int64_t _6; BYTE _7; int64_t _8; _DECL_1DARRAY_BYTE(_9); _DECL_DEALLOC(_9); int64_t _10; Match* _11; _DECL_DEALLOC(_11); BYTE _12; int64_t _13; BYTE _14; int64_t _15; BYTE _16; BYTE _17; int64_t _18; int64_t _19; int64_t _20; int64_t _21; _DECL_1DARRAY_BYTE(_22); _DECL_DEALLOC(_22); _DECL_1DARRAY_BYTE(_23); _DECL_DEALLOC(_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; _DECL_1DARRAY_BYTE(_33); _DECL_DEALLOC(_33); //const %6 = 0 : int _6 = 0; //assign %2 = %6 : int pos = _6; //const %7 = 00000000b : byte _7 = 0b00000000; //const %8 = 0 : int _8 = 0; //const %24 = 2 : int _24 = 2; //lengthof %25 = %0 : byte[] _25 = data_size; //mul %26 = %24, %25 : int _26=_24*_25; //arraygen %9 = [7; 26] : byte[] _DEALLOC(_9); _NEW_1DARRAY_BYTE(_9, _26, _7); _ADD_DEALLOC(_9); //const %27 = 0 : int _27 = 0; //assign %28 = %27 : int _28 = _27; //assign %1 = %9 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _9); _ADD_DEALLOC(output); //loop (%1, %2, %3, %4, %5, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %28) while(true){ //lengthof %10 = %0 : byte[] _10 = data_size; //ifge %2, %10 goto blklab12 : int if(pos>=_10){goto blklab12;} //invoke (%11) = (%0, %2) lz77_compress:findLongestMatch : function(byte[],lz77_compress:nat)->(lz77_compress:Match) { void* tmp_data; _COPY_1DARRAY_PARAM(data, tmp_data, BYTE); _DEALLOC_STRUCT(_11, Match); _11 = _findLongestMatch_(tmp_data, data_size, true, pos); _CALLEE_DEALLOC(data, "false-false-true" , "findLongestMatch"); _CALLEE_DEALLOC_POST(_11, data); } //assign %3 = %11 : {int len,int offset} _DEALLOC_STRUCT(m, Match); m = copy_Match(_11); _ADD_DEALLOC(m); //fieldload %13 = %3 offset : {int len,int offset} _13 = m->offset; //invoke (%12) = (%13) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _12 = (BYTE)_13; } //assign %4 = %12 : byte offset = _12; //fieldload %15 = %3 len : {int len,int offset} _15 = m->len; //invoke (%14) = (%15) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _14 = (BYTE)_15; } //assign %5 = %14 : byte length = _14; //const %16 = 00000000b : byte _16 = 0b00000000; //ifne %4, %16 goto blklab14 : byte if(offset!=_16){goto blklab14;} //indexof %17 = %0, %2 : byte[] _17=data[pos]; //assign %5 = %17 : byte length = _17; //const %18 = 1 : int _18 = 1; //add %19 = %2, %18 : int _19=pos+_18; //assign %2 = %19 : int pos = _19; //goto blklab15 goto blklab15; //.blklab14 blklab14:; //fieldload %20 = %3 len : {int len,int offset} _20 = m->len; //add %21 = %2, %20 : int _21=pos+_20; //assign %2 = %21 : int pos = _21; //.blklab15 blklab15:; //update %1[%28] = %4 : byte[] -> byte[] output[_28] = offset; //const %29 = 1 : int _29 = 1; //add %30 = %28, %29 : int _30=_28+_29; //assign %28 = %30 : int _28 = _30; //update %1[%28] = %5 : byte[] -> byte[] output[_28] = length; //const %31 = 1 : int _31 = 1; //add %32 = %28, %31 : int _32=_28+_31; //assign %28 = %32 : int _28 = _32; //.blklab13 blklab13:; } //.blklab12 blklab12:; //invoke (%33) = (%1, %28) lz77_compress:resize : function(byte[],int)->(byte[]) { void* tmp_items; _COPY_1DARRAY_PARAM(output, tmp_items, BYTE); _DEALLOC(_33); _33 = _resize_(tmp_items, output_size, true, _28, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_33)); _CALLEE_DEALLOC(output, "false-false-false" , "resize"); _CALLEE_DEALLOC_POST(_33, output); } //assign %1 = %33 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _33); _ADD_DEALLOC(output); //return %1 _DEALLOC(data); _DEALLOC_STRUCT(m, Match); _DEALLOC(_9); _DEALLOC_STRUCT(_11, Match); _DEALLOC(_22); _DEALLOC(_23); _DEALLOC(_33); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
int main(int argc, char** args){ int* n; _DECL_DEALLOC(n); int width; int height; int size; _DECL_1DARRAY_BYTE(pixels); _DECL_DEALLOC(pixels); int i; _DECL_1DARRAY_BYTE(newPixels); _DECL_DEALLOC(newPixels); int* _8; _DECL_DEALLOC(_8); _DECL_2DARRAY(_9); _DECL_DEALLOC(_9); int _10; _DECL_1DARRAY(_11); _DECL_DEALLOC(_11); int _12; int _13; BYTE _14; _DECL_1DARRAY_BYTE(_15); _DECL_DEALLOC(_15); int _16; BYTE _17; int _18; int _19; int _20; int _21; void* _22; _DECL_1DARRAY(_24); _DECL_DEALLOC(_24); void* _25; int _27; BYTE _28; _DECL_1DARRAY_BYTE(_29); _DECL_DEALLOC(_29); void* _30; _DECL_1DARRAY(_32); _DECL_DEALLOC(_32); void* _33; int _35; void* _36; _DECL_1DARRAY(_38); _DECL_DEALLOC(_38); void* _39; _DECL_1DARRAY(_41); _DECL_DEALLOC(_41); void* _42; int _44; BYTE _45; //fieldload %9 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} _DEALLOC_2DARRAY_int64_t(_9); _CONV_ARGS(_9); _ADD_DEALLOC(_9); //const %10 = 0 : int _10 = 0; //indexof %11 = %9, %10 : int[][] _11=_9[_10]; _11_size = _9_size_size; _REMOVE_DEALLOC(_11); //invoke (%8) = (%11) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int) { _STR_TO_INT(_8, _11); _ADD_DEALLOC(_8); _REMOVE_DEALLOC(_11); } //assign %1 = %8 : null|int _DEALLOC(n); // isCopyEliminated = true n = _8; _TRANSFER_DEALLOC(n, _8); //ifis %1, null goto blklab19 : null|int if(n == NULL) { goto blklab19;} //const %12 = 2000 : int _12 = 2000; //assign %2 = %12 : int // isCopyEliminated = true width = _12; //assign %3 = %1 : int // isCopyEliminated = true height = *n; //mul %13 = %2, %3 : int _13=width*height; //assign %4 = %13 : int // isCopyEliminated = true size = _13; //const %14 = 00100000b : byte _14 = 0b00100000; //arraygen %15 = [14; 4] : byte[] _DEALLOC(_15); _NEW_1DARRAY_BYTE(_15, size, _14); _ADD_DEALLOC(_15); //assign %5 = %15 : byte[] _DEALLOC(pixels); // isCopyEliminated = true _UPDATE_1DARRAY(pixels, _15); _TRANSFER_DEALLOC(pixels, _15); //const %16 = 0 : int _16 = 0; //assign %6 = %16 : int // isCopyEliminated = true i = _16; //loop (%5, %6, %17, %18, %19, %20, %21) while(true){ //ifge %6, %4 goto blklab20 : int if(i>=size){goto blklab20;} //const %18 = 256 : int _18 = 256; //rem %19 = %6, %18 : int _19=i%_18; //invoke (%17) = (%19) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _17 = (BYTE)_19; } //update %5[%6] = %17 : byte[] -> byte[] pixels[i] = _17; //const %20 = 1 : int _20 = 1; //add %21 = %6, %20 : int _21=i+_20; //assign %6 = %21 : int // isCopyEliminated = true i = _21; //.blklab21 blklab21:; } //.blklab20 blklab20:; //fieldload %22 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %23 = %22 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %24 = [112,105,120,101,108,115,91,49,48,48,48,93,61] : int[] _DEALLOC(_24); _NEW_1DARRAY_int64_t(_24, 13, 0); _24[0] = 112; _24[1] = 105; _24[2] = 120; _24[3] = 101; _24[4] = 108; _24[5] = 115; _24[6] = 91; _24[7] = 49; _24[8] = 48; _24[9] = 48; _24[10] = 48; _24[11] = 93; _24[12] = 61; _ADD_DEALLOC(_24); //indirectinvoke () = %23 (%24) : method(int[])->() { printf_s(_24, _24_size); } //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} //const %27 = 1000 : int _27 = 1000; //indexof %28 = %5, %27 : byte[] _28=pixels[_27]; //indirectinvoke () = %26 (%28) : method(any)->() { printf("%"PRIu8"\n", _28); } //invoke (%29) = (%5, %2, %3) SobelEdge_large:sobelEdgeDetection : function(byte[],int,int)->(byte[]) { _DEALLOC(_29); // isCopyEliminated of '_5' = true _29 = _sobelEdgeDetection_(pixels, pixels_size, false, width, height, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_29)); _RETAIN_DEALLOC(pixels, "false-false-false" , "sobelEdgeDetection"); _RETAIN_DEALLOC_POST(_29, pixels); } //assign %7 = %29 : byte[] _DEALLOC(newPixels); // isCopyEliminated = true _UPDATE_1DARRAY(newPixels, _29); _TRANSFER_DEALLOC(newPixels, _29); //fieldload %30 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %31 = %30 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %32 = [66,108,117,114,114,101,100,32,73,109,97,103,101,32,115,105,122,101,115,58,32,32,32] : int[] _DEALLOC(_32); _NEW_1DARRAY_int64_t(_32, 23, 0); _32[0] = 66; _32[1] = 108; _32[2] = 117; _32[3] = 114; _32[4] = 114; _32[5] = 101; _32[6] = 100; _32[7] = 32; _32[8] = 73; _32[9] = 109; _32[10] = 97; _32[11] = 103; _32[12] = 101; _32[13] = 32; _32[14] = 115; _32[15] = 105; _32[16] = 122; _32[17] = 101; _32[18] = 115; _32[19] = 58; _32[20] = 32; _32[21] = 32; _32[22] = 32; _ADD_DEALLOC(_32); //indirectinvoke () = %31 (%32) : method(int[])->() { println_s(_32, _32_size); } //fieldload %33 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %34 = %33 print : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //lengthof %35 = %7 : byte[] _35 = newPixels_size; //indirectinvoke () = %34 (%35) : method(any)->() { printf("%d", _35); } //fieldload %36 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %37 = %36 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %38 = [32,98,121,116,101,115] : int[] _DEALLOC(_38); _NEW_1DARRAY_int64_t(_38, 6, 0); _38[0] = 32; _38[1] = 98; _38[2] = 121; _38[3] = 116; _38[4] = 101; _38[5] = 115; _ADD_DEALLOC(_38); //indirectinvoke () = %37 (%38) : method(int[])->() { println_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 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %41 = [110,101,119,80,105,120,101,108,115,91,49,48,48,48,93,61] : int[] _DEALLOC(_41); _NEW_1DARRAY_int64_t(_41, 16, 0); _41[0] = 110; _41[1] = 101; _41[2] = 119; _41[3] = 80; _41[4] = 105; _41[5] = 120; _41[6] = 101; _41[7] = 108; _41[8] = 115; _41[9] = 91; _41[10] = 49; _41[11] = 48; _41[12] = 48; _41[13] = 48; _41[14] = 93; _41[15] = 61; _ADD_DEALLOC(_41); //indirectinvoke () = %40 (%41) : method(int[])->() { printf_s(_41, _41_size); } //fieldload %42 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out} //fieldload %43 = %42 print : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} //const %44 = 1000 : int _44 = 1000; //indexof %45 = %7, %44 : byte[] _45=newPixels[_44]; //indirectinvoke () = %43 (%45) : method(any)->() { printf("%d", _45); } //.blklab19 blklab19:; //return _DEALLOC(n); _DEALLOC(pixels); _DEALLOC(newPixels); _DEALLOC(_8); _FREE_ARGS(_9); _DEALLOC(_11); _DEALLOC(_15); _DEALLOC(_24); _DEALLOC(_29); _DEALLOC(_32); _DEALLOC(_38); _DEALLOC(_41); exit(0); }
BYTE* _sobelEdgeDetection_(BYTE* pixels, size_t pixels_size, _DECL_DEALLOC_PARAM(pixels), int width, int height, _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(_3); _DECL_DEALLOC(_3); int size; _DECL_1DARRAY_BYTE(newPixels); _DECL_DEALLOC(newPixels); _DECL_1DARRAY(v_sobel); _DECL_DEALLOC(v_sobel); _DECL_1DARRAY(h_sobel); _DECL_DEALLOC(h_sobel); int x; int y; int pos; int v_g; int h_g; int t_g; int _14; BYTE _15; _DECL_1DARRAY_BYTE(_16); _DECL_DEALLOC(_16); int _17; int _18; int _19; int _20; int _21; int _22; int _23; int _24; int _25; int _26; int _27; int _28; _DECL_1DARRAY(_29); _DECL_DEALLOC(_29); int _30; int _31; int _32; int _33; int _34; int _35; int _36; int _37; int _38; int _39; int _40; int _41; _DECL_1DARRAY(_42); _DECL_DEALLOC(_42); int _43; int _44; int _45; int _46; int _47; int _48; int _49; int _50; int _51; int _52; BYTE _53; int _54; int _55; int _56; int _57; //mul %14 = %1, %2 : int _14=width*height; //assign %4 = %14 : int // isCopyEliminated = true size = _14; //const %15 = 00100000b : byte _15 = 0b00100000; //arraygen %16 = [15; 4] : byte[] _DEALLOC(_16); _NEW_1DARRAY_BYTE(_16, size, _15); _ADD_DEALLOC(_16); //assign %5 = %16 : byte[] _DEALLOC(newPixels); // isCopyEliminated = true _UPDATE_1DARRAY(newPixels, _16); _TRANSFER_DEALLOC(newPixels, _16); //const %17 = 1 : int _17 = 1; //neg %18 = %17 : int _18= -_17; //const %19 = 0 : int _19 = 0; //const %20 = 1 : int _20 = 1; //const %21 = 2 : int _21 = 2; //neg %22 = %21 : int _22= -_21; //const %23 = 0 : int _23 = 0; //const %24 = 2 : int _24 = 2; //const %25 = 1 : int _25 = 1; //neg %26 = %25 : int _26= -_25; //const %27 = 0 : int _27 = 0; //const %28 = 1 : int _28 = 1; //newlist %29 = (%18, %19, %20, %22, %23, %24, %26, %27, %28) : int[] _DEALLOC(_29); _NEW_1DARRAY_int64_t(_29, 9, 0); _29[0] = _18; _29[1] = _19; _29[2] = _20; _29[3] = _22; _29[4] = _23; _29[5] = _24; _29[6] = _26; _29[7] = _27; _29[8] = _28; _ADD_DEALLOC(_29); //assign %6 = %29 : int[] _DEALLOC(v_sobel); // isCopyEliminated = true _UPDATE_1DARRAY(v_sobel, _29); _TRANSFER_DEALLOC(v_sobel, _29); //const %30 = 1 : int _30 = 1; //const %31 = 2 : int _31 = 2; //const %32 = 1 : int _32 = 1; //const %33 = 0 : int _33 = 0; //const %34 = 0 : int _34 = 0; //const %35 = 0 : int _35 = 0; //const %36 = 1 : int _36 = 1; //neg %37 = %36 : int _37= -_36; //const %38 = 2 : int _38 = 2; //neg %39 = %38 : int _39= -_38; //const %40 = 1 : int _40 = 1; //neg %41 = %40 : int _41= -_40; //newlist %42 = (%30, %31, %32, %33, %34, %35, %37, %39, %41) : int[] _DEALLOC(_42); _NEW_1DARRAY_int64_t(_42, 9, 0); _42[0] = _30; _42[1] = _31; _42[2] = _32; _42[3] = _33; _42[4] = _34; _42[5] = _35; _42[6] = _37; _42[7] = _39; _42[8] = _41; _ADD_DEALLOC(_42); //assign %7 = %42 : int[] _DEALLOC(h_sobel); // isCopyEliminated = true _UPDATE_1DARRAY(h_sobel, _42); _TRANSFER_DEALLOC(h_sobel, _42); //const %43 = 0 : int _43 = 0; //assign %8 = %43 : int // isCopyEliminated = true x = _43; //loop (%5, %8, %9, %10, %11, %12, %13, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55, %56, %57) while(true){ //ifge %8, %1 goto blklab8 : int if(x>=width){goto blklab8;} //const %44 = 0 : int _44 = 0; //assign %9 = %44 : int // isCopyEliminated = true y = _44; //loop (%5, %9, %10, %11, %12, %13, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54, %55) while(true){ //ifge %9, %2 goto blklab10 : int if(y>=height){goto blklab10;} //mul %45 = %9, %1 : int _45=y*width; //add %46 = %45, %8 : int _46=_45+x; //assign %10 = %46 : int // isCopyEliminated = true pos = _46; //invoke (%47) = (%0, %1, %2, %8, %9, %6) SobelEdge_large:convolution : function(byte[],int,int,int,int,int[])->(int) { // isCopyEliminated of '_0' = true // isCopyEliminated of '_6' = true _47 = _convolution_(pixels, pixels_size, false, width, height, x, y, v_sobel, v_sobel_size, false); _RETAIN_DEALLOC(pixels, "false-false-true" , "convolution"); _RETAIN_DEALLOC(v_sobel, "false-false-true" , "convolution"); } //assign %11 = %47 : int // isCopyEliminated = true v_g = _47; //invoke (%48) = (%0, %1, %2, %8, %9, %7) SobelEdge_large:convolution : function(byte[],int,int,int,int,int[])->(int) { // isCopyEliminated of '_0' = true // isCopyEliminated of '_7' = true _48 = _convolution_(pixels, pixels_size, false, width, height, x, y, h_sobel, h_sobel_size, false); _RETAIN_DEALLOC(pixels, "false-false-true" , "convolution"); _RETAIN_DEALLOC(h_sobel, "false-false-true" , "convolution"); } //assign %12 = %48 : int // isCopyEliminated = true h_g = _48; //mul %49 = %11, %11 : int _49=v_g*v_g; //mul %50 = %12, %12 : int _50=h_g*h_g; //add %51 = %49, %50 : int _51=_49+_50; //assign %13 = %51 : int // isCopyEliminated = true t_g = _51; //const %52 = 640000 : int _52 = 640000; //ifle %13, %52 goto blklab12 : int if(t_g<=_52){goto blklab12;} //const %53 = 01100010b : byte _53 = 0b01100010; //update %5[%10] = %53 : byte[] -> byte[] newPixels[pos] = _53; //.blklab12 blklab12:; //const %54 = 1 : int _54 = 1; //add %55 = %9, %54 : int _55=y+_54; //assign %9 = %55 : int // isCopyEliminated = true y = _55; //.blklab11 blklab11:; } //.blklab10 blklab10:; //const %56 = 1 : int _56 = 1; //add %57 = %8, %56 : int _57=x+_56; //assign %8 = %57 : int // isCopyEliminated = true x = _57; //.blklab9 blklab9:; } //.blklab8 blklab8:; //return %5 _DEALLOC(pixels); _DEALLOC(_3); _DEALLOC(v_sobel); _DEALLOC(h_sobel); _DEALLOC(_16); _DEALLOC(_29); _DEALLOC(_42); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(newPixels); return newPixels; //return }
BYTE* _f_append_(BYTE* input, size_t input_size, _DECL_DEALLOC_PARAM(input), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_DEALLOC(output); int64_t pos; BYTE index; BYTE item; int64_t _5; BYTE _6; int64_t _7; _DECL_1DARRAY_BYTE(_8); _DECL_DEALLOC(_8); int64_t _9; BYTE _10; BYTE _11; _DECL_1DARRAY_BYTE(_12); _DECL_DEALLOC(_12); _DECL_1DARRAY_BYTE(_13); _DECL_DEALLOC(_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; int64_t _24; _DECL_1DARRAY_BYTE(_25); _DECL_DEALLOC(_25); //const %5 = 0 : int _5 = 0; //assign %2 = %5 : int pos = _5; //const %6 = 00000000b : byte _6 = 0b00000000; //const %7 = 0 : int _7 = 0; //const %16 = 2 : int _16 = 2; //lengthof %17 = %0 : byte[] _17 = input_size; //mul %18 = %16, %17 : int _18=_16*_17; //arraygen %8 = [6; 18] : byte[] _DEALLOC(_8); _NEW_1DARRAY_BYTE(_8, _18, _6); _ADD_DEALLOC(_8); //const %19 = 0 : int _19 = 0; //assign %20 = %19 : int _20 = _19; //assign %1 = %8 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _8); _ADD_DEALLOC(output); //loop (%1, %2, %3, %4, %9, %10, %11, %12, %13, %14, %15, %20) while(true){ //lengthof %9 = %0 : byte[] _9 = input_size; //ifge %2, %9 goto blklab7 : int if(pos>=_9){goto blklab7;} //invoke (%10) = (%2) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _10 = (BYTE)pos; } //assign %3 = %10 : byte index = _10; //indexof %11 = %0, %2 : byte[] _11=input[pos]; //assign %4 = %11 : byte item = _11; //update %1[%20] = %3 : byte[] -> byte[] output[_20] = index; //const %21 = 1 : int _21 = 1; //add %22 = %20, %21 : int _22=_20+_21; //assign %20 = %22 : int _20 = _22; //update %1[%20] = %4 : byte[] -> byte[] output[_20] = item; //const %23 = 1 : int _23 = 1; //add %24 = %20, %23 : int _24=_20+_23; //assign %20 = %24 : int _20 = _24; //const %14 = 1 : int _14 = 1; //add %15 = %2, %14 : int _15=pos+_14; //assign %2 = %15 : int pos = _15; //.blklab8 blklab8:; } //.blklab7 blklab7:; //assert { //ifle %20, %18 goto blklab13 : int if(_20<=_18){goto blklab13;} //fail fprintf(stderr,"fail"); exit(-1); //.blklab13 blklab13:; //assert } //invoke (%25) = (%1, %20) appendarray1:resize : function(byte[],int)->(byte[]) { void* output_tmp; _DEALLOC(_25); _25 = _resize_(_COPY_1DARRAY_PARAM_BYTE(output), true, _20, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_25)); _CALLEE_DEALLOC(output, "false-false-false" , "resize"); _25_dealloc = true; } //assign %1 = %25 : byte[] _DEALLOC(output); _COPY_1DARRAY_BYTE(output, _25); _ADD_DEALLOC(output); //return %1 _DEALLOC(input); _DEALLOC(_8); _DEALLOC(_12); _DEALLOC(_13); _DEALLOC(_25); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
BYTE* _decompress_(BYTE* data, size_t data_size, _DECL_DEALLOC_PARAM(data), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_DEALLOC(output); int64_t pos; BYTE header; BYTE item; int64_t offset; int64_t len; int64_t start; int64_t i; BYTE _9; int64_t _10; _DECL_1DARRAY_BYTE(_11); _DECL_DEALLOC(_11); int64_t _12; int64_t _13; int64_t _14; int64_t _15; BYTE _16; int64_t _17; int64_t _18; BYTE _19; int64_t _20; int64_t _21; BYTE _22; _DECL_1DARRAY_BYTE(_23); _DECL_DEALLOC(_23); int64_t _24; int64_t _25; int64_t _26; int64_t _27; int64_t _28; BYTE _29; _DECL_1DARRAY_BYTE(_30); _DECL_DEALLOC(_30); int64_t _31; int64_t _32; //const %9 = 00000000b : byte _9 = 0b00000000; //const %10 = 0 : int _10 = 0; //arraygen %11 = [9; 10] : byte[] _DEALLOC(_11); _NEW_1DARRAY_BYTE(_11, _10, _9); _ADD_DEALLOC(_11); //assign %1 = %11 : byte[] _DEALLOC(output); // isCopyEliminated = true _UPDATE_1DARRAY(output, _11); _TRANSFER_DEALLOC(output, _11); //const %12 = 0 : int _12 = 0; //assign %2 = %12 : int // isCopyEliminated = true pos = _12; //loop (%1, %2, %3, %4, %5, %6, %7, %8, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32) while(true){ //const %13 = 1 : int _13 = 1; //add %14 = %2, %13 : int _14=pos+_13; //lengthof %15 = %0 : byte[] _15 = data_size; //ifge %14, %15 goto blklab3 : int if(_14>=_15){goto blklab3;} //indexof %16 = %0, %2 : byte[] _16=data[pos]; //assign %3 = %16 : byte // isCopyEliminated = true header = _16; //const %17 = 1 : int _17 = 1; //add %18 = %2, %17 : int _18=pos+_17; //indexof %19 = %0, %18 : byte[] _19=data[_18]; //assign %4 = %19 : byte // isCopyEliminated = true item = _19; //const %20 = 2 : int _20 = 2; //add %21 = %2, %20 : int _21=pos+_20; //assign %2 = %21 : int // isCopyEliminated = true pos = _21; //const %22 = 00000000b : byte _22 = 0b00000000; //ifne %3, %22 goto blklab5 : byte if(header!=_22){goto blklab5;} //invoke (%23) = (%1, %4) LZ77_decompress:append : function(byte[],byte)->(byte[]) { // isCopyEliminated of '_1' = true _23 = _append_(output, output_size, false, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_23)); _RETAIN_DEALLOC(output, "false-false-false" , "append"); _RETAIN_DEALLOC_POST(_23, output); } //assign %1 = %23 : byte[] _DEALLOC(output); // isCopyEliminated = true _UPDATE_1DARRAY(output, _23); _TRANSFER_DEALLOC(output, _23); //goto blklab6 goto blklab6; //.blklab5 blklab5:; //invoke (%24) = (%3) whiley/lang/Byte:toUnsignedInt : function(byte)->(whiley/lang/Int:uint) { _24 = (unsigned int)header; } //assign %5 = %24 : int // isCopyEliminated = true offset = _24; //invoke (%25) = (%4) whiley/lang/Byte:toUnsignedInt : function(byte)->(whiley/lang/Int:uint) { _25 = (unsigned int)item; } //assign %6 = %25 : int // isCopyEliminated = true len = _25; //lengthof %26 = %1 : byte[] _26 = output_size; //sub %27 = %26, %5 : int _27=_26-offset; //assign %7 = %27 : int // isCopyEliminated = true start = _27; //assign %8 = %7 : int // isCopyEliminated = false i = start; //loop (%1, %4, %8, %28, %29, %30, %31, %32) while(true){ //add %28 = %7, %6 : int _28=start+len; //ifge %8, %28 goto blklab7 : int if(i>=_28){goto blklab7;} //indexof %29 = %1, %8 : byte[] _29=output[i]; //assign %4 = %29 : byte // isCopyEliminated = true item = _29; //invoke (%30) = (%1, %4) LZ77_decompress:append : function(byte[],byte)->(byte[]) { // isCopyEliminated of '_1' = true _30 = _append_(output, output_size, false, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_30)); _RETAIN_DEALLOC(output, "false-false-false" , "append"); _RETAIN_DEALLOC_POST(_30, output); } //assign %1 = %30 : byte[] _DEALLOC(output); // isCopyEliminated = true _UPDATE_1DARRAY(output, _30); _TRANSFER_DEALLOC(output, _30); //const %31 = 1 : int _31 = 1; //add %32 = %8, %31 : int _32=i+_31; //assign %8 = %32 : int // isCopyEliminated = true i = _32; //.blklab8 blklab8:; } //.blklab7 blklab7:; //.blklab6 blklab6:; //.blklab4 blklab4:; } //.blklab3 blklab3:; //return %1 _DEALLOC(data); _DEALLOC(_11); _DEALLOC(_23); _DEALLOC(_30); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }
BYTE* _comp_(BYTE* data, size_t data_size, _DECL_DEALLOC_PARAM(data), _DECL_1DARRAYSIZE_PARAM_CALLBYREFERENCE){ _DECL_1DARRAY_BYTE(output); _DECL_DEALLOC(output); int64_t pos = 0; BYTE item; BYTE length; int64_t _5 = 0; BYTE _6; int64_t _7 = 0; _DECL_1DARRAY_BYTE(_8); _DECL_DEALLOC(_8); int64_t _9 = 0; BYTE _10; BYTE _11; int64_t _12 = 0; int64_t _13 = 0; _DECL_1DARRAY_BYTE(_14); _DECL_DEALLOC(_14); _DECL_1DARRAY_BYTE(_15); _DECL_DEALLOC(_15); //const %5 = 0 : int _5 = 0; //assign %2 = %5 : int pos = _5; //const %6 = 00000000b : byte _6 = 0b00000000; //const %7 = 0 : int _7 = 0; //arraygen %8 = [6; 7] : byte[] _DEALLOC(_8); _NEW_1DARRAY_BYTE(_8, _7, _6); _ADD_DEALLOC(_8); //assign %1 = %8 : byte[] _DEALLOC(output); _UPDATE_1DARRAY(output, _8); _TRANSFER_DEALLOC(output, _8); //loop (%1, %2, %3, %4, %9, %10, %11, %12, %13, %14, %15) while(true){ //lengthof %9 = %0 : byte[] _9 = data_size; //ifge %2, %9 goto blklab7 : int if(pos>=_9){goto blklab7;} //indexof %10 = %0, %2 : byte[] _10=data[pos]; //assign %3 = %10 : byte item = _10; //invoke (%11) = (%2) whiley/lang/Int:toUnsignedByte : function(whiley/lang/Int:u8)->(byte) { _11 = (BYTE)pos; } //assign %4 = %11 : byte length = _11; //const %12 = 1 : int _12 = 1; //add %13 = %2, %12 : int _13=pos+_12; //assign %2 = %13 : int pos = _13; //invoke (%14) = (%1, %4) AppendArrayPattern_original:append : function(byte[],byte)->(byte[]) { _DEALLOC(_14); _14 = _append_(_1DARRAY_PARAM(output), false, length, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_14)); _RETAIN_DEALLOC(output, "false-false-false" , "append"); _ADD_DEALLOC(_14); } //assign %1 = %14 : byte[] _DEALLOC(output); _UPDATE_1DARRAY(output, _14); _TRANSFER_DEALLOC(output, _14); //invoke (%15) = (%1, %3) AppendArrayPattern_original:append : function(byte[],byte)->(byte[]) { _DEALLOC(_15); _15 = _append_(_1DARRAY_PARAM(output), false, item, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_15)); _RETAIN_DEALLOC(output, "false-false-false" , "append"); _ADD_DEALLOC(_15); } //assign %1 = %15 : byte[] _DEALLOC(output); _UPDATE_1DARRAY(output, _15); _TRANSFER_DEALLOC(output, _15); //.blklab8 blklab8:; } //.blklab7 blklab7:; //return %1 _DEALLOC(data); _DEALLOC(_8); _DEALLOC(_14); _DEALLOC(_15); _UPDATE_1DARRAYSZIE_PARAM_CALLBYREFERENCE(output); return output; //return }