//
// jpeg_read_coefficients from 0xe8be2c to 0xe8bfe8 (444 bytes)
//
// 1 xrefs:
// > ??> @ 0xe6c98
//
// 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:53 +0000
//
__int64 __fastcall jpeg_read_coefficients(__int64 a1)
{
int v1; // w1
void (__fastcall **v4)(_QWORD); // x2
__int64 v5; // x1
int v6; // w0
__int64 v7; // x2
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x2
v1 = *(_DWORD *)(a1 + 36);
switch ( v1 )
{
case 202:
*(_DWORD *)(a1 + 88) = 1;
jpeg_core_output_dimensions(a1);
if ( *(_DWORD *)(a1 + 320) )
jinit_arith_decoder(a1);
else
jinit_huff_decoder(a1);
jinit_d_coef_controller(a1, 1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a1 + 8) + 48LL))(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a1 + 608) + 16LL))(a1);
v5 = *(_QWORD *)(a1 + 16);
if ( v5 )
{
if ( *(_DWORD *)(a1 + 316) )
{
v9 = 3 * *(_DWORD *)(a1 + 56) + 2;
}
else
{
v9 = 1;
if ( *(_DWORD *)(*(_QWORD *)(a1 + 608) + 32LL) )
v9 = *(int *)(a1 + 56);
}
v10 = *(unsigned int *)(a1 + 432);
*(_QWORD *)(v5 + 8) = 0;
*(_DWORD *)(v5 + 24) = 0;
*(_QWORD *)(v5 + 16) = v10 * v9;
*(_DWORD *)(v5 + 28) = 1;
}
*(_DWORD *)(a1 + 36) = 209;
break;
case 209:
v5 = *(_QWORD *)(a1 + 16);
break;
case 207:
case 210:
goto LABEL_5;
default:
goto LABEL_7;
}
LABEL_9:
if ( v5 )
(*(void (__fastcall **)(__int64))v5)(a1);
while ( 1 )
{
v6 = (**(__int64 (__fastcall ***)(__int64))(a1 + 608))(a1);
if ( !v6 )
return 0;
if ( v6 == 2 )
break;
v5 = *(_QWORD *)(a1 + 16);
if ( v5 )
{
if ( (v6 & 0xFFFFFFFD) == 1 )
{
v7 = *(_QWORD *)(v5 + 16);
v8 = *(_QWORD *)(v5 + 8) + 1LL;
*(_QWORD *)(v5 + 8) = v8;
if ( v8 >= v7 )
*(_QWORD *)(v5 + 16) = v7 + *(unsigned int *)(a1 + 432);
}
goto LABEL_9;
}
}
v1 = 210;
*(_DWORD *)(a1 + 36) = 210;
LABEL_5:
if ( *(_DWORD *)(a1 + 88) )
return *(_QWORD *)(*(_QWORD *)(a1 + 592) + 32LL);
LABEL_7:
v4 = *(void (__fastcall ***)(_QWORD))a1;
*((_DWORD *)v4 + 11) = v1;
*((_DWORD *)v4 + 10) = 21;
(**(void (__fastcall ***)(__int64))a1)(a1);
return 0;
}