// // sub_6C0574 from 0x6c0574 to 0x6c13f4 (3712 bytes) // // 9 xrefs: // > sub_6C6AF4 @ 0x6c6cd4 // > sub_6C6AF4 @ 0x6c6cd8 // > sub_6C6AF4 @ 0x6c6ce4 // > sub_6C6AF4 @ 0x6c6ce8 // > sub_6C6AF4 @ 0x6c6cf4 // > sub_6C6AF4 @ 0x6c6cf8 // > @ 0x6c6dc4 // > @ 0x6c6dc8 // > @ 0x6c6dcc // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // int __fastcall sub_6C0574(_DWORD *a1, int a2, int a3) { int v5; // [sp+Ch] [bp-50h] int v8; // [sp+1Ch] [bp-40h] int v9; // [sp+20h] [bp-3Ch] signed int v10; // [sp+24h] [bp-38h] unsigned int v11; // [sp+28h] [bp-34h] int v12; // [sp+2Ch] [bp-30h] signed int v13; // [sp+30h] [bp-2Ch] unsigned __int8 *v14; // [sp+34h] [bp-28h] unsigned __int8 *v15; // [sp+38h] [bp-24h] signed int *v16; // [sp+3Ch] [bp-20h] _DWORD *v17; // [sp+3Ch] [bp-20h] _DWORD *v18; // [sp+3Ch] [bp-20h] _DWORD *v19; // [sp+3Ch] [bp-20h] signed int *v20; // [sp+40h] [bp-1Ch] int v21; // [sp+44h] [bp-18h] int v22; // [sp+48h] [bp-14h] char *v23; // [sp+4Ch] [bp-10h] char *v24; // [sp+4Ch] [bp-10h] v5 = a3; v8 = a1[144]; v10 = *(_DWORD *)(v8 + 12); v22 = *(_DWORD *)(v8 + 44); if ( a3 % *(_DWORD *)(v8 + 8) ) { TIFFErrorExt(a1[157], (int)"Fax3Decode1D", "Fractional scanlines cannot be read"); return -1; } v11 = *(_DWORD *)(v8 + 48); v12 = *(_DWORD *)(v8 + 52); v21 = *(_DWORD *)(v8 + 56); v14 = (unsigned __int8 *)a1[151]; v15 = &v14[a1[152]]; v20 = *(signed int **)(v8 + 72); LABEL_100: if ( v5 <= 0 ) { *(_DWORD *)(v8 + 52) = v12; *(_DWORD *)(v8 + 48) = v11; *(_DWORD *)(v8 + 56) = v21; a1[152] += a1[151] - (_DWORD)v14; a1[151] = v14; return 1; } v9 = 0; v13 = 0; v16 = v20; if ( v21 ) goto LABEL_15; while ( 1 ) { if ( v12 > 10 ) goto LABEL_13; if ( v14 >= v15 ) break; v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; if ( v12 <= 10 ) { if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; } else { v12 = 11; } } LABEL_13: if ( (v11 & 0x7FF) == 0 ) { while ( 1 ) { LABEL_15: if ( v12 <= 7 ) { if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; } else { if ( !v12 ) goto LABEL_86; v12 = 8; } } if ( (_BYTE)v11 ) { while ( (v11 & 1) == 0 ) { --v12; v11 >>= 1; } --v12; v11 >>= 1; v21 = 0; while ( 1 ) { if ( v12 <= 11 ) { if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; if ( v12 <= 11 ) { if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; } else { v12 = 12; } } } else { if ( !v12 ) goto LABEL_55; v12 = 12; } } v23 = (char *)&TIFFFaxWhiteTable + 8 * (v11 & 0xFFF); v12 -= (unsigned __int8)v23[1]; v11 >>= v23[1]; switch ( *v23 ) { case 7: *v16++ = *((_DWORD *)v23 + 1) + v13; v9 += *((_DWORD *)v23 + 1); v13 = 0; if ( v9 >= v10 ) goto LABEL_70; while ( 2 ) { if ( v12 > 12 ) goto LABEL_47; if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; if ( v12 <= 12 ) { if ( v14 < v15 ) { v11 |= *(unsigned __int8 *)(v22 + *v14++) << v12; v12 += 8; } else { v12 = 13; } } } else { if ( !v12 ) { LABEL_55: sub_6C04B8((int)"Fax3Decode1D", a1, *(_DWORD *)(v8 + 92), v9); if ( v13 ) { *v16++ = v13; v13 = 0; } if ( v9 != v10 ) { sub_6C03B8((int)"Fax3Decode1D", a1, *(_DWORD *)(v8 + 92), v9, v10); while ( v9 > v10 && v16 > v20 ) v9 -= *--v16; if ( v9 >= v10 ) { if ( v9 > v10 ) { *v16 = v13 + v10; v17 = v16 + 1; *v17 = 0; v16 = v17 + 1; } } else { if ( v9 < 0 ) v9 = 0; if ( ((v16 - v20) & 1) != 0 ) { *v16++ = v13; v13 = 0; } *v16++ = v10 - v9 + v13; } } goto LABEL_99; } v12 = 13; } LABEL_47: v24 = (char *)&TIFFFaxBlackTable + 8 * (v11 & 0x1FFF); v12 -= (unsigned __int8)v24[1]; v11 >>= v24[1]; switch ( *v24 ) { case 8: *v16++ = *((_DWORD *)v24 + 1) + v13; v9 += *((_DWORD *)v24 + 1); v13 = 0; if ( v9 >= v10 ) goto LABEL_70; if ( !*(v16 - 1) && !*(v16 - 2) ) v16 -= 2; break; case 10: case 11: v9 += *((_DWORD *)v24 + 1); v13 += *((_DWORD *)v24 + 1); continue; case 12: v21 = 1; goto LABEL_70; default: goto LABEL_38; } break; } break; case 9: case 11: v9 += *((_DWORD *)v23 + 1); v13 += *((_DWORD *)v23 + 1); continue; case 12: v21 = 1; goto LABEL_70; default: LABEL_38: sub_6C0240((int)"Fax3Decode1D", a1, *(_DWORD *)(v8 + 92), v9); LABEL_70: if ( v13 ) { *v16++ = v13; v13 = 0; } if ( v9 != v10 ) { sub_6C03B8((int)"Fax3Decode1D", a1, *(_DWORD *)(v8 + 92), v9, v10); while ( v9 > v10 && v16 > v20 ) v9 -= *--v16; if ( v9 >= v10 ) { if ( v9 > v10 ) { *v16 = v13 + v10; v18 = v16 + 1; *v18 = 0; v16 = v18 + 1; } } else { if ( v9 < 0 ) v9 = 0; if ( ((v16 - v20) & 1) != 0 ) { *v16++ = v13; v13 = 0; } *v16++ = v10 - v9 + v13; } } (*(void (__fastcall **)(int, signed int *, signed int *, signed int))(v8 + 60))(a2, v20, v16, v10); a2 += *(_DWORD *)(v8 + 8); v5 -= *(_DWORD *)(v8 + 8); ++*(_DWORD *)(v8 + 92); goto LABEL_100; } } } v12 -= 8; v11 >>= 8; } } --v12; v11 >>= 1; } if ( v12 ) { v12 = 11; goto LABEL_13; } LABEL_86: if ( v10 ) { sub_6C03B8((int)"Fax3Decode1D", a1, *(_DWORD *)(v8 + 92), 0, v10); while ( v9 > v10 && v16 > v20 ) v9 -= *--v16; if ( v9 >= v10 ) { if ( v9 > v10 ) { *v16 = v10; v19 = v16 + 1; *v19 = 0; v16 = v19 + 1; } } else { if ( v9 < 0 ) v9 = 0; if ( ((v16 - v20) & 1) != 0 ) *v16++ = 0; *v16++ = v10 - v9; } } LABEL_99: (*(void (__fastcall **)(int, signed int *, signed int *, signed int))(v8 + 60))(a2, v20, v16, v10); *(_DWORD *)(v8 + 52) = v12; *(_DWORD *)(v8 + 48) = v11; *(_DWORD *)(v8 + 56) = v21; a1[152] += a1[151] - (_DWORD)v14; a1[151] = v14; return -1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source