//
// sub_69EFD0 from 0x69efd0 to 0x69f0a6 (214 bytes)
//
// 2 xrefs:
// > sub_69F0A8 @ 0x69f0ae
// > sub_69F0A8 @ 0x69f0b6
//
// 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
//
_DWORD *__fastcall sub_69EFD0(_DWORD *result, unsigned int a2)
{
int v2; // r6
_DWORD *v4; // r7
_DWORD *v5; // r8
_DWORD *v6; // r3
_DWORD *v7; // r4
int v8; // r5
_DWORD *v9; // r3
_DWORD *v10; // r4
int v11; // r5
int i; // r4
int v13; // r5
v2 = (int)result;
v4 = (_DWORD *)result[1];
if ( a2 <= 1 )
{
if ( a2 == 1 )
{
for ( i = v4[17]; i; i = *(_DWORD *)(i + 44) )
{
while ( !*(_DWORD *)(i + 40) )
{
i = *(_DWORD *)(i + 44);
if ( !i )
goto LABEL_14;
}
*(_DWORD *)(i + 40) = 0;
result = (_DWORD *)(*(int (__fastcall **)(int, int))(i + 56))(v2, i + 48);
}
LABEL_14:
v13 = v4[18];
for ( v4[17] = 0; v13; v13 = *(_DWORD *)(v13 + 44) )
{
while ( !*(_DWORD *)(v13 + 40) )
{
v13 = *(_DWORD *)(v13 + 44);
if ( !v13 )
goto LABEL_19;
}
*(_DWORD *)(v13 + 40) = 0;
result = (_DWORD *)(*(int (__fastcall **)(int, int))(v13 + 56))(v2, v13 + 48);
}
LABEL_19:
v4[18] = 0;
}
}
else
{
*(_DWORD *)(*result + 20) = 15;
*(_DWORD *)(*result + 24) = a2;
result = (_DWORD *)(*(int (__fastcall **)(_DWORD *))*result)(result);
}
v5 = &v4[a2];
v6 = (_DWORD *)v5[15];
v5[15] = 0;
if ( v6 )
{
do
{
v7 = (_DWORD *)*v6;
v8 = v6[1] + v6[2] + 16;
result = (_DWORD *)jpeg_free_large(v2, v6);
v6 = v7;
v4[19] -= v8;
}
while ( v7 );
}
v9 = (_DWORD *)v5[13];
v5[13] = 0;
if ( v9 )
{
do
{
v10 = (_DWORD *)*v9;
v11 = v9[1] + v9[2] + 16;
result = (_DWORD *)jpeg_free_small(v2, v9);
v9 = v10;
v4[19] -= v11;
}
while ( v10 );
}
return result;
}