//
// sub_C048F4 from 0xc048f4 to 0xc04a0c (280 bytes)
//
// 3 xrefs:
// > jpeg_start_decompress @ 0xc04a60
// > jpeg_start_decompress @ 0xc04b04
// > jpeg_start_output @ 0xc04d9c
//
// 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
//
__int64 __fastcall sub_C048F4(__int64 a1)
{
unsigned int v2; // w2
void (*v3)(void); // x2
unsigned int v4; // w20
__int64 v5; // x4
unsigned int v6; // w1
__int64 v7; // x3
__int64 result; // x0
int v9; // w1
if ( *(_DWORD *)(a1 + 36) != 204 )
{
(**(void (***)(void))(a1 + 576))();
*(_DWORD *)(a1 + 168) = 0;
*(_DWORD *)(a1 + 36) = 204;
}
if ( *(_DWORD *)(*(_QWORD *)(a1 + 576) + 16LL) )
{
v2 = *(_DWORD *)(a1 + 168);
do
{
while ( 1 )
{
v5 = v2;
v6 = *(_DWORD *)(a1 + 140);
if ( v6 > v2 )
break;
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a1 + 576) + 8LL))(a1);
(**(void (__fastcall ***)(__int64))(a1 + 576))(a1);
*(_DWORD *)(a1 + 168) = 0;
v2 = 0;
if ( !*(_DWORD *)(*(_QWORD *)(a1 + 576) + 16LL) )
goto LABEL_11;
}
v7 = *(_QWORD *)(a1 + 16);
if ( v7 )
{
v3 = *(void (**)(void))v7;
*(_QWORD *)(v7 + 8) = v5;
*(_QWORD *)(v7 + 16) = v6;
v3();
v4 = *(_DWORD *)(a1 + 168);
}
else
{
v4 = v2;
}
(*(void (__fastcall **)(__int64, _QWORD, __int64, _QWORD))(*(_QWORD *)(a1 + 584) + 8LL))(a1, 0, a1 + 168, 0);
v2 = *(_DWORD *)(a1 + 168);
}
while ( v2 != v4 );
return 0;
}
else
{
LABEL_11:
result = 1;
if ( *(_DWORD *)(a1 + 92) )
v9 = 206;
else
v9 = 205;
*(_DWORD *)(a1 + 36) = v9;
}
return result;
}