//
// jpeg_finish_compress from 0xbf1c08 to 0xbf1d74 (364 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_saveImageToJPG @ 0xb0cf58
// > cocos2d::CCImage::_saveImageToJPG @ 0xb0d0a4
// > ??> @ 0x68df0
//
// 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_compress(void (__fastcall ***a1)(_QWORD))
{
int v1; // w1
void (__fastcall **v3)(_QWORD); // x2
void (__fastcall **i)(_QWORD); // x0
unsigned int v5; // w20
unsigned int v6; // w0
void (__fastcall **v7)(_QWORD); // x2
unsigned __int64 v8; // x3
void (__fastcall *v9)(_QWORD); // x4
void (__fastcall *v10)(_QWORD); // x2
void (__fastcall *v12)(_QWORD); // x2
v1 = *((_DWORD *)a1 + 9);
if ( (unsigned int)(v1 - 101) <= 1 )
{
if ( *((_DWORD *)a1 + 86) < *((_DWORD *)a1 + 13) )
{
v12 = **a1;
*((_DWORD *)*a1 + 10) = 69;
v12(a1);
}
a1[62][2](a1);
}
else if ( v1 != 103 )
{
v3 = *a1;
*((_DWORD *)v3 + 11) = v1;
*((_DWORD *)v3 + 10) = 21;
(**a1)(a1);
}
for ( i = a1[62]; !*((_DWORD *)i + 7); i = a1[62] )
{
v5 = 0;
(*i)(a1);
v6 = *((_DWORD *)a1 + 92);
if ( v6 )
{
do
{
while ( 1 )
{
v7 = a1[2];
v8 = v5++;
if ( v7 )
{
v9 = *v7;
v7[1] = (void (__fastcall *)(_QWORD))v8;
v7[2] = (void (__fastcall *)(_QWORD))v6;
v9(a1);
}
if ( !((unsigned int (__fastcall *)(void (__fastcall ***)(_QWORD), _QWORD))a1[65][1])(a1, 0) )
break;
v6 = *((_DWORD *)a1 + 92);
if ( v6 <= v5 )
goto LABEL_12;
}
v10 = **a1;
*((_DWORD *)*a1 + 10) = 25;
v10(a1);
v6 = *((_DWORD *)a1 + 92);
}
while ( v6 > v5 );
}
LABEL_12:
a1[62][2](a1);
}
a1[66][3](a1);
a1[5][4](a1);
return jpeg_abort(a1);
}