//
// jpeg_finish_compress from 0xe67dc8 to 0xe67f34 (364 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_saveImageToJPG @ 0xd7deb8
// > cocos2d::CCImage::_saveImageToJPG @ 0xd7e004
// > ??> @ 0x8e108
//
// 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:32 +0000
//
__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);
}