// // jpeg_calc_output_dimensions from 0xe893e8 to 0xe8977c (916 bytes) // // 2 xrefs: // > jinit_master_decompress @ 0xe8989c // > @ 0x86290 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 13:10:52 +0000 // unsigned __int64 __fastcall jpeg_calc_output_dimensions(__int64 a1) { int v1; // w1 void (__fastcall **v3)(_QWORD); // x2 __int64 v4; // x20 unsigned __int64 result; // x0 int v6; // w7 int v7; // w9 int v8; // w6 _DWORD *v9; // x1 _DWORD *v10; // x8 int v11; // w3 int v12; // w2 int v13; // w4 int v14; // w3 int v15; // w0 int v16; // w21 int v17; // w2 int v18; // w4 int v19; // w2 int v20; // w1 int v21; // w3 int v22; // w5 int v23; // w2 _DWORD *v24; // x3 _DWORD *v25; // x2 int v26; // w4 v1 = *(_DWORD *)(a1 + 36); if ( v1 != 202 ) { v3 = *(void (__fastcall ***)(_QWORD))a1; *((_DWORD *)v3 + 11) = v1; *((_DWORD *)v3 + 10) = 21; (**(void (__fastcall ***)(__int64))a1)(a1); } jpeg_core_output_dimensions(a1); v4 = *(_QWORD *)(a1 + 304); result = *(unsigned int *)(a1 + 56); if ( (int)result > 0 ) { v6 = *(_DWORD *)(a1 + 424); v7 = *(_DWORD *)(a1 + 100); v8 = *(_DWORD *)(a1 + 428); v9 = *(_DWORD **)(a1 + 304); v10 = (_DWORD *)(v4 + 96 * ((unsigned int)(result - 1) + 1LL)); while ( 1 ) { v11 = 1; if ( v7 ) { while ( 1 ) { v12 = v11 * v6; if ( v11 * v6 > 8 || *(_DWORD *)(a1 + 416) % (2 * v11 * v9[2]) ) break; v11 *= 2; } } else { while ( 1 ) { v12 = v11 * v6; if ( v11 * v6 > 4 || *(_DWORD *)(a1 + 416) % (2 * v11 * v9[2]) ) break; v11 *= 2; } } v9[9] = v12; v13 = 1; if ( v7 ) { while ( 1 ) { v14 = v13 * v8; if ( v13 * v8 > 8 ) break; if ( *(_DWORD *)(a1 + 420) % (2 * v13 * v9[3]) ) goto LABEL_15; v13 *= 2; } v15 = 2 * v14; v9[10] = v14; if ( 2 * v14 >= v12 ) { LABEL_39: v23 = 2 * v12; if ( v23 < v14 ) v9[10] = v23; goto LABEL_17; } } else { while ( 1 ) { v14 = v13 * v8; if ( v13 * v8 > 4 || *(_DWORD *)(a1 + 420) % (2 * v13 * v9[3]) ) break; v13 *= 2; } LABEL_15: v15 = 2 * v14; v9[10] = v14; if ( 2 * v14 >= v12 ) goto LABEL_39; } v9[9] = v15; LABEL_17: v9 += 24; if ( v9 == v10 ) { v16 = 0; do { v17 = *(_DWORD *)(v4 + 36); v4 += 96; ++v16; *(_DWORD *)(v4 - 52) = jdiv_round_up( *(unsigned int *)(a1 + 48) * (__int64)(*(_DWORD *)(v4 - 88) * v17), *(_DWORD *)(a1 + 416) * *(_DWORD *)(a1 + 556)); *(_DWORD *)(v4 - 48) = jdiv_round_up( *(unsigned int *)(a1 + 52) * (__int64)(*(_DWORD *)(v4 - 84) * *(_DWORD *)(v4 - 56)), *(_DWORD *)(a1 + 420) * *(_DWORD *)(a1 + 556)); result = *(unsigned int *)(a1 + 56); } while ( (int)result > v16 ); break; } } } v18 = *(_DWORD *)(a1 + 64); switch ( v18 ) { case 1: v19 = 1; *(_DWORD *)(a1 + 144) = 1; break; case 2: case 3: case 6: case 7: v19 = 3; *(_DWORD *)(a1 + 144) = 3; break; case 4: case 5: v19 = 4; *(_DWORD *)(a1 + 144) = 4; break; default: *(_DWORD *)(a1 + 144) = result; v19 = result; break; } v20 = 1; v21 = *(_DWORD *)(a1 + 400); if ( *(_DWORD *)(a1 + 108) ) v22 = 1; else v22 = v19; *(_DWORD *)(a1 + 148) = v22; if ( v21 || (*(_DWORD *)(a1 + 60) & 0xFFFFFFFB) != 3 ) goto LABEL_30; if ( (_DWORD)result != 3 || v18 != 2 ) { *(_DWORD *)(a1 + 152) = 1; return result; } if ( v19 != 3 ) goto LABEL_30; result = *(unsigned int *)(a1 + 396); if ( (_DWORD)result ) goto LABEL_30; result = *(_QWORD *)(a1 + 304); if ( *(_DWORD *)(result + 8) != 2 ) goto LABEL_30; v24 = (_DWORD *)(result + 96); if ( *(_DWORD *)(result + 104) != 1 ) goto LABEL_30; v20 = *(_DWORD *)(result + 200); v25 = (_DWORD *)(result + 192); if ( v20 != 1 ) goto LABEL_50; if ( *(int *)(result + 12) > 2 || *(_DWORD *)(result + 108) != 1 ) goto LABEL_30; v20 = *(_DWORD *)(result + 204); if ( v20 != 1 ) { LABEL_50: v20 = 1; LABEL_30: *(_DWORD *)(a1 + 152) = v20; return result; } v26 = *(_DWORD *)(result + 36); if ( v26 != *(_DWORD *)(a1 + 424) ) goto LABEL_30; if ( v26 != *(_DWORD *)(result + 132) ) goto LABEL_30; if ( v26 != *(_DWORD *)(result + 228) ) goto LABEL_30; result = *(unsigned int *)(result + 40); if ( (_DWORD)result != *(_DWORD *)(a1 + 428) || (_DWORD)result != v24[10] || (_DWORD)result != v25[10] ) goto LABEL_30; *(_DWORD *)(a1 + 152) = *(_DWORD *)(a1 + 420); return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source