//
// jpeg_finish_output from 0xc04dc8 to 0xc04e8c (196 bytes)
//
// 1 xrefs:
// > ??> @ 0x2fbf8
//
// 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 jpeg_finish_output(__int64 a1)
{
int v1; // w1
void (__fastcall **v3)(__int64); // x2
__int64 i; // x0
__int64 v5; // x1
unsigned int v6; // w20
v1 = *(_DWORD *)(a1 + 36);
if ( (unsigned int)(v1 - 205) <= 1 )
{
if ( *(_DWORD *)(a1 + 88) )
{
(*(void (**)(void))(*(_QWORD *)(a1 + 576) + 8LL))();
*(_DWORD *)(a1 + 36) = 208;
goto LABEL_6;
}
}
else if ( v1 == 208 )
{
goto LABEL_6;
}
v3 = *(void (__fastcall ***)(__int64))a1;
*((_DWORD *)v3 + 11) = v1;
*((_DWORD *)v3 + 10) = 21;
(**(void (__fastcall ***)(__int64))a1)(a1);
for ( i = a1; *(_DWORD *)(a1 + 172) <= *(_DWORD *)(a1 + 180); i = a1 )
{
v5 = *(_QWORD *)(a1 + 608);
v6 = *(_DWORD *)(v5 + 36);
if ( v6 )
break;
if ( !(*(unsigned int (__fastcall **)(__int64))v5)(i) )
return v6;
LABEL_6:
;
}
v6 = 1;
*(_DWORD *)(a1 + 36) = 207;
return v6;
}