//
// jpeg_write_marker from 0xbf1d74 to 0xbf1e2c (184 bytes)
//
// 1 xrefs:
// > ??> @ 0x7bd50
//
// 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_marker(__int64 a1, __int64 a2, unsigned __int8 *a3, int a4)
{
int v7; // w2
__int64 result; // x0
__int64 (__fastcall *v9)(__int64, _QWORD); // x22
unsigned __int8 *v10; // x21
unsigned int v11; // t1
void (__fastcall **v12)(__int64); // x3
v7 = *(_DWORD *)(a1 + 36);
if ( *(_DWORD *)(a1 + 344) || (unsigned int)(v7 - 101) > 2 )
{
v12 = *(void (__fastcall ***)(__int64))a1;
*((_DWORD *)v12 + 11) = v7;
*((_DWORD *)v12 + 10) = 21;
(**(void (__fastcall ***)(__int64))a1)(a1);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a1 + 528) + 40LL))(a1);
result = *(_QWORD *)(a1 + 528);
v9 = *(__int64 (__fastcall **)(__int64, _QWORD))(result + 48);
if ( a4 )
{
v10 = &a3[a4 - 1 + 1];
do
{
v11 = *a3++;
result = v9(a1, v11);
}
while ( a3 != v10 );
}
return result;
}