//
// jpeg_mem_dest from 0x885904 to 0x885994 (144 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:03:13 +0000
//
void *__fastcall jpeg_mem_dest(int a1, int *a2, int *a3)
{
bool v3; // zf
_DWORD *v7; // r4
void *result; // r0
int v9; // r3
int v10; // r3
v3 = a3 == nullptr;
if ( a3 )
v3 = a2 == nullptr;
if ( v3 )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 24;
(**(void (__fastcall ***)(int))a1)(a1);
}
v7 = *(_DWORD **)(a1 + 24);
if ( !v7 )
{
v7 = (_DWORD *)(**(int (__fastcall ***)(int, _DWORD, int))(a1 + 4))(a1, 0, 40);
*(_DWORD *)(a1 + 24) = v7;
}
result = nullptr;
v7[5] = a2;
v7[6] = a3;
v7[2] = nullsub_24;
v7[3] = sub_88581C;
v7[4] = sub_8857D0;
v7[7] = 0;
v9 = *a2;
if ( !*a2 || !*a3 )
{
result = malloc(0x1000u);
*a2 = (int)result;
v7[7] = result;
if ( !result )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 56;
*(_DWORD *)(*(_DWORD *)a1 + 24) = 10;
result = (void *)(**(int (__fastcall ***)(int))a1)(a1);
}
*a3 = 4096;
v9 = *a2;
}
v7[8] = v9;
*v7 = v9;
v10 = *a3;
v7[9] = *a3;
v7[1] = v10;
return result;
}