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 }
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 }
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* _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* _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 }