//
// sub_69FA04 from 0x69fa04 to 0x69fb2a (294 bytes)
//
// 0 xrefs:
//
// 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_69FA04(_DWORD *a1, unsigned int a2, int a3, int a4, int a5, int a6)
{
int v6; // r5
int v10; // r6
int v11; // r7
_DWORD *v12; // r4
unsigned int v13; // r3
unsigned int v14; // r3
unsigned int v15; // r8
unsigned int v16; // r10
int v17; // r2
_DWORD *v18; // r3
_DWORD *small; // r0
v6 = a1[1];
if ( a2 == 1 )
{
v10 = a1[1];
}
else
{
*(_DWORD *)(*a1 + 20) = 15;
*(_DWORD *)(*a1 + 24) = a2;
(*(void (__fastcall **)(_DWORD *))*a1)(a1);
v10 = a1[1];
if ( a2 > 1 )
{
*(_DWORD *)(*a1 + 20) = 15;
*(_DWORD *)(*a1 + 24) = a2;
(*(void (__fastcall **)(_DWORD *))*a1)(a1);
}
}
v11 = v10 + 4 * a2;
v12 = *(_DWORD **)(v11 + 52);
if ( v12 )
{
v13 = v12[2];
if ( v13 > 0x7F )
{
small = *(_DWORD **)(v11 + 52);
goto LABEL_20;
}
while ( 1 )
{
small = (_DWORD *)*v12;
if ( !*v12 )
break;
v13 = small[2];
v12 = (_DWORD *)*v12;
if ( v13 > 0x7F )
goto LABEL_20;
}
v14 = dword_9E0588[a2];
}
else
{
v14 = dword_9E0588[a2 + 2];
}
if ( v14 >= 0x3B9AC970 )
v14 = 999999856;
v15 = v14;
while ( 1 )
{
v16 = v15 + 144;
small = (_DWORD *)jpeg_get_small((int)a1, v15 + 144);
if ( small )
break;
while ( 1 )
{
v15 >>= 1;
if ( v15 > 0x31 )
break;
v16 = v15 + 144;
*(_DWORD *)(*a1 + 20) = 56;
*(_DWORD *)(*a1 + 24) = 2;
(*(void (__fastcall **)(_DWORD *))*a1)(a1);
small = (_DWORD *)jpeg_get_small((int)a1, v15 + 144);
if ( small )
goto LABEL_17;
}
}
LABEL_17:
*(_DWORD *)(v10 + 76) += v16;
small[2] = v15 + 128;
*small = 0;
small[1] = 0;
if ( v12 )
*v12 = small;
else
*(_DWORD *)(v11 + 52) = small;
v13 = small[2];
LABEL_20:
v17 = small[1];
small[2] = v13 - 128;
small[1] = v17 + 128;
v18 = (_DWORD *)((char *)small + v17 + 16);
*v18 = 0;
v18[2] = a4;
v18[1] = a5;
v18[10] = 0;
v18[3] = a6;
v18[8] = a3;
v18[11] = *(_DWORD *)(v6 + 68);
*(_DWORD *)(v6 + 68) = v18;
return v18;
}