//
// jpeg_finish_output from 0x674a40 to 0x674aae (110 bytes)
//
// 0 xrefs:
//
// 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 jpeg_finish_output(_DWORD *a1)
{
int v2; // r3
_DWORD *i; // r0
int v4; // r3
int v5; // r5
v2 = a1[5];
if ( (unsigned int)(v2 - 205) <= 1 )
{
if ( a1[16] )
{
(*(void (**)(void))(a1[111] + 4))();
a1[5] = 208;
goto LABEL_6;
}
}
else if ( v2 == 208 )
{
goto LABEL_6;
}
*(_DWORD *)(*a1 + 20) = 21;
*(_DWORD *)(*a1 + 24) = a1[5];
(*(void (__fastcall **)(_DWORD *))*a1)(a1);
for ( i = a1; a1[36] <= a1[38]; i = a1 )
{
v4 = a1[115];
v5 = *(_DWORD *)(v4 + 20);
if ( v5 )
break;
if ( !(*(int (__fastcall **)(_DWORD *))v4)(i) )
return v5;
LABEL_6:
;
}
v5 = 1;
a1[5] = 207;
return v5;
}