signed int __cdecl decompress_segment(unsigned char *output, unsigned int output_size, unsigned char *input, unsigned char **input_end) { signed int v4; // esi@1 int v5; // edi@1 signed int result; // eax@2 unsigned int v7; // ecx@8 int v8; // edx@9 unsigned int v9; // ebx@9 int v10; // ebx@12 unsigned int v11; // ecx@12 int v12; // edx@13 int v13; // ecx@13 char v14; // al@13 int v15; // eax@18 unsigned int v16; // ecx@21 int v17; // ecx@22 int v18; // esi@25 unsigned int v19; // ecx@25 int v20; // edx@26 int v21; // ecx@26 char v22; // al@26 int v23; // ebx@26 unsigned int v24; // ecx@30 int v25; // edx@31 int v26; // ecx@31 char v27; // al@31 unsigned int v28; // ecx@38 int v29; // edx@39 int v30; // ecx@39 char v31; // al@39 unsigned int v32; // ecx@43 int v33; // edx@44 int v34; // ecx@44 char v35; // al@44 unsigned int v36; // ecx@47 int v37; // edx@48 int v38; // ecx@48 char v39; // al@48 signed int v40; // ebx@52 int v41; // esi@54 unsigned int v42; // edx@55 int v43; // ecx@55 int v44; // edx@55 char v45; // al@55 signed int v46; // eax@57 signed int v47; // eax@59 int v48; // ebx@59 unsigned int v49; // ecx@59 int v50; // edx@60 int v51; // ecx@60 char v52; // al@60 int v53; // esi@60 unsigned int v54; // ecx@64 int v55; // edx@65 int v56; // ecx@65 char v57; // al@65 unsigned int v58; // ecx@72 int v59; // edx@73 int v60; // ecx@73 char v61; // al@73 unsigned int v62; // ecx@77 int v63; // edx@78 int v64; // ecx@78 char v65; // al@78 unsigned int v66; // ecx@81 int v67; // edx@82 int v68; // ecx@82 char v69; // al@82 int v70; // ecx@87 int v71; // eax@90 int v72; // eax@96 int v73; // eax@98 int v74; // eax@100 int v75; // eax@101 int v76; // eax@104 int v77; // eax@106 int v78; // eax@107 int v79; // eax@109 int v80; // eax@111 int v81; // eax@112 int v82; // eax@119 int v83; // eax@121 int v84; // eax@123 int v85; // eax@125 char *v86; // [sp+14h] [bp-D04h]@11 int v87; // [sp+18h] [bp-D00h]@59 signed int v88; // [sp+1Ch] [bp-CFCh]@7 char *v89; // [sp+20h] [bp-CF8h]@59 signed int v90; // [sp+24h] [bp-CF4h]@52 char *v91; // [sp+28h] [bp-CF0h]@25 signed int v92; // [sp+2Ch] [bp-CECh]@20 char *v93; // [sp+30h] [bp-CE8h]@24 signed int v94; // [sp+34h] [bp-CE4h]@9 int v95; // [sp+38h] [bp-CE0h]@1 unsigned int v96; // [sp+3Ch] [bp-CDCh]@1 char *v97; // [sp+40h] [bp-CD8h]@8 int v98; // [sp+44h] [bp-CD4h]@1 int v99; // [sp+48h] [bp-CD0h]@1 char v100; // [sp+4Ch] [bp-CCCh]@1 char v101[3272]; // [sp+50h] [bp-CC8h]@7 v95 = 0; v4 = 0; v96 = -1; v99 = (int)((char *)output + output_size); v98 = (int)input; v100 = *(unsigned char *)input; v5 = (*(unsigned char *)(input + 1) << 24) | (*(unsigned char *)(input + 2) << 16) | (*(unsigned char *)(input + 3) << 8) | *(unsigned char *)(input + 4); if ( *(unsigned char *)input >= 0 ) { memset(v101, 128, 0xCA8u); v88 = 0; while ( 1 ) { while ( 1 ) { v97 = &v101[v95]; v7 = (unsigned char)v101[v95 + 2920]; if ( !(v96 >> 24) ) { v71 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v71; } v8 = v7 - (v7 >> 3); v9 = v7 * (v96 >> 8); v94 = v5 < v9; if ( v5 < v9 ) break; v96 -= v9; v5 -= v9; v97[2920] = v8; v95 = (v95 - 1) & ((unsigned __int64)~(v95 - 1) >> 32); if ( output == (void *)v99 ) return -2; v86 = &v101[255 * ((((((unsigned char)output & 7) << 8) | v4 & 0xFFFFF8FFu) >> v100) & 7)]; v4 = 1; do { v10 = (int)&v86[v4]; v11 = (unsigned char)v86[v4 - 1]; if ( !(v96 >> 24) ) { v15 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v15; } v4 *= 2; v12 = v11 * (v96 >> 8); v13 = v11 - (v11 >> 3); v14 = v13; if ( v5 < (unsigned int)v12 ) { v96 = v12; ++v4; v14 = v13 + 31; } else { v96 -= v12; v5 -= v12; } *(unsigned char *)(v10 - 1) = v14; } while ( v4 <= 255 ); output = (unsigned char *)output + 1; ++v88; *((unsigned char *)output - 1) = v4; } v96 = v7 * (v96 >> 8); v97[2920] = v8 + 31; v92 = -1; while ( 1 ) { v16 = (unsigned char)v97[2928]; if ( !(v9 >> 24) ) { v80 = *(unsigned char *)(v98++ + 5); v96 = v9 << 8; v5 = (v5 << 8) + v80; } v97 += 8; v9 = v16 * (v96 >> 8); v17 = v16 - (v16 >> 3); if ( v5 >= v9 ) break; v96 = v9; v97[2920] = v17 + 31; ++v92; if ( v92 == 6 ) goto LABEL_24; } v96 -= v9; v5 -= v9; v97[2920] = v17; LABEL_24: v93 = &v101[v92]; if ( v92 >= 0 ) { v91 = &v101[v95 & 7 | 8 * (((unsigned int)output << v92) & 3) | 32 * v92]; v18 = v92 - 3; v19 = (unsigned char)v91[2984]; if ( !(v96 >> 24) ) { v73 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v73; } v20 = v19 * (v96 >> 8); v21 = v19 - (v19 >> 3); v22 = v21; v23 = 2; if ( v5 >= (unsigned int)v20 ) { v96 -= v20; v5 -= v20; } else { v96 = v20; v23 = 3; v22 = v21 + 31; } if ( v18 < 0 ) { v91[2984] = v22; } else { if ( v18 <= 0 ) { v91[2984] = v22; } else { v24 = (unsigned char)v22; if ( !(v96 >> 24) ) { v83 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v83; } v23 *= 2; v25 = v24 * (v96 >> 8); v26 = v24 - (v24 >> 3); v27 = v26; if ( v5 >= (unsigned int)v25 ) { v96 -= v25; v5 -= v25; } else { v96 = v25; ++v23; v27 = v26 + 31; } v91[2984] = v27; if ( v18 != 1 ) { if ( !(v96 >> 24) ) { v81 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v81; } do { v96 >>= 1; v23 = (v5 < v96) + 2 * v23; if ( v5 >= v96 ) v5 -= v96; --v18; } while ( v18 != 1 ); } } v28 = (unsigned char)v91[3008]; if ( !(v96 >> 24) ) { v82 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v82; } v23 *= 2; v29 = v28 * (v96 >> 8); v30 = v28 - (v28 >> 3); v31 = v30; if ( v5 >= (unsigned int)v29 ) { v96 -= v29; v5 -= v29; } else { v96 = v29; ++v23; v31 = v30 + 31; } v91[3008] = v31; } if ( v92 > 0 ) { v32 = (unsigned char)v91[2992]; if ( !(v96 >> 24) ) { v85 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v85; } v23 *= 2; v33 = v32 * (v96 >> 8); v34 = v32 - (v32 >> 3); v35 = v34; if ( v5 >= (unsigned int)v33 ) { v96 -= v33; v5 -= v33; } else { v96 = v33; ++v23; v35 = v34 + 31; } v91[2992] = v35; if ( v92 != 1 ) { v36 = (unsigned char)v91[3000]; if ( !(v96 >> 24) ) { v84 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v84; } v23 *= 2; v37 = v36 * (v96 >> 8); v38 = v36 - (v36 >> 3); v39 = v38; if ( v5 >= (unsigned int)v37 ) { v96 -= v37; v5 -= v37; } else { v96 = v37; ++v23; v39 = v38 + 31; } v91[3000] = v39; } } v94 = v23; if ( v23 == 255 ) break; } v40 = 8; v90 = 352; if ( v94 <= 2 ) { v93 += 248; v90 = 64; } do { v41 = (int)&v93[v40]; if ( !(v96 >> 24) ) { v72 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v72; } v42 = *(unsigned char *)(v41 + 2033); v40 *= 2; v43 = v42 * (v96 >> 8); v44 = v42 - (v42 >> 3); v45 = v44; if ( v5 < (unsigned int)v43 ) { v96 = v43; v45 = v44 + 31; v40 += 8; } else { v96 -= v43; v5 -= v43; } *(unsigned char *)(v41 + 2033) = v45; v46 = v40 - v90; } while ( v40 - v90 < 0 ); if ( v40 != v90 ) { v47 = v46 >> 3; v87 = v47 - 1; v48 = v47 - 4; v89 = &v101[32 * (v47 - 1)]; v49 = (unsigned char)v89[2344]; if ( !(v96 >> 24) ) { v78 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v78; } v50 = v49 * (v96 >> 8); v51 = v49 - (v49 >> 3); v52 = v51; v53 = 2; if ( v5 >= (unsigned int)v50 ) { v96 -= v50; v5 -= v50; } else { v96 = v50; v53 = 3; v52 = v51 + 31; } if ( v48 < 0 ) { v89[2344] = v52; } else { if ( v48 <= 0 ) { v89[2344] = v52; } else { v54 = (unsigned char)v52; if ( !(v96 >> 24) ) { v79 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v79; } v53 *= 2; v55 = v54 * (v96 >> 8); v56 = v54 - (v54 >> 3); v57 = v56; if ( v5 >= (unsigned int)v55 ) { v96 -= v55; v5 -= v55; } else { v96 = v55; ++v53; v57 = v56 + 31; } v89[2344] = v57; if ( v48 != 1 ) { if ( !(v96 >> 24) ) { v75 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v75; } do { v96 >>= 1; v53 = (v5 < v96) + 2 * v53; if ( v5 >= v96 ) v5 -= v96; --v48; } while ( v48 != 1 ); } } v58 = (unsigned char)v89[2368]; if ( !(v96 >> 24) ) { v74 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v74; } v53 *= 2; v59 = v58 * (v96 >> 8); v60 = v58 - (v58 >> 3); v61 = v60; if ( v5 >= (unsigned int)v59 ) { v96 -= v59; v5 -= v59; } else { v96 = v59; ++v53; v61 = v60 + 31; } v89[2368] = v61; } if ( v87 > 0 ) { v62 = (unsigned char)v89[2352]; if ( !(v96 >> 24) ) { v77 = *(unsigned char *)(v98++ + 5); v96 <<= 8; v5 = (v5 << 8) + v77; } v53 *= 2; v63 = v62 * (v96 >> 8); v64 = v62 - (v62 >> 3); v65 = v64; if ( v5 >= (unsigned int)v63 ) { v96 -= v63; v5 -= v63; } else { v96 = v63; ++v53; v65 = v64 + 31; } v89[2352] = v65; if ( v87 != 1 ) { v66 = (unsigned char)v89[2360]; if ( !(v96 >> 24) ) { v76 = *(unsigned char *)(v98 + 5); v96 <<= 8; ++v98; v5 = (v5 << 8) + v76; } v53 *= 2; v67 = v66 * (v96 >> 8); v68 = v66 - (v66 >> 3); v69 = v68; if ( v5 >= (unsigned int)v67 ) { v96 -= v67; v5 -= v67; } else { v96 = v67; ++v53; v69 = v68 + 31; } v89[2360] = v69; } } v46 = v53 - 1; } if ( v88 <= (unsigned int)v46 ) return -1; *((unsigned char*)&(v4)) = *((unsigned char *)output + -v46 - 1); v70 = (int)((char *)output + v94); v95 = (((unsigned char)v94 + (unsigned char)output) & 1) + 6; if ( (unsigned int)((char *)output + v94) >= v99 ) return -2; do { output = (unsigned char *)output + 1; ++v88; *((unsigned char *)output - 1) = v4; v4 = *((unsigned char *)output + -v46 - 1); } while ( output != (void *)v70 ); output = (unsigned char *)output + 1; ++v88; *((unsigned char *)output - 1) = v4; } if ( input_end ) *(unsigned int *)input_end = v98 + 5; result = v88; } else { result = -2; if ( v5 <= output_size ) { memcpy(output, (const void *)(input + 5), v5); if ( input_end ) *(unsigned int *)input_end = (unsigned int)(input + v5 + 5); result = v5; } } return result; }