//
// jpeg_write_raw_data from 0xbf2104 to 0xbf2254 (336 bytes)
//
// 1 xrefs:
// > ??> @ 0x535e0
//
// 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_write_raw_data(void (__fastcall ***a1)(__int64), __int64 a2, unsigned int a3)
{
int v3; // w3
void (__fastcall **v6)(__int64); // x2
unsigned int v7; // w3
unsigned int v8; // w0
void (__fastcall **v9)(__int64); // x4
void (__fastcall *v10)(__int64); // x2
void (__fastcall **v11)(__int64); // x0
unsigned int v12; // w20
int v13; // w0
unsigned int v14; // w1
void (__fastcall *v16)(__int64); // x3
void (__fastcall *v17)(__int64); // x3
v3 = *((_DWORD *)a1 + 9);
if ( v3 != 102 )
{
v6 = *a1;
*((_DWORD *)v6 + 11) = v3;
*((_DWORD *)v6 + 10) = 21;
(**a1)((__int64)a1);
}
v7 = *((_DWORD *)a1 + 86);
v8 = *((_DWORD *)a1 + 13);
if ( v7 >= v8 )
{
v17 = (*a1)[1];
*((_DWORD *)*a1 + 10) = 126;
((void (__fastcall *)(void (__fastcall ***)(__int64), __int64))v17)(a1, 0xFFFFFFFFLL);
return 0;
}
else
{
v9 = a1[2];
if ( v9 )
{
v10 = *v9;
v9[2] = (void (__fastcall *)(__int64))v8;
v9[1] = (void (__fastcall *)(__int64))v7;
v10((__int64)a1);
}
v11 = a1[62];
if ( *((_DWORD *)v11 + 6) )
v11[1]((__int64)a1);
v12 = *((_DWORD *)a1 + 89) * *((_DWORD *)a1 + 91);
if ( v12 > a3 )
{
v16 = **a1;
*((_DWORD *)*a1 + 10) = 24;
v16((__int64)a1);
}
v13 = ((__int64 (__fastcall *)(__int64))a1[65][1])((__int64)a1);
v14 = 0;
if ( v13 )
{
v14 = v12;
*((_DWORD *)a1 + 86) += v12;
}
return v14;
}
}