//
// sub_724500 from 0x724500 to 0x724636 (310 bytes)
//
// 4 xrefs:
// > sub_71ED0C @ 0x71efdc
// > sub_71ED0C @ 0x71effa
// > sub_71ED0C @ 0x71f428
// > sub_71ED0C @ 0x71fcec
//
// 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_724500(_DWORD *a1, int a2, int a3)
{
int v3; // r6
_DWORD *v4; // r8
size_t v7; // r2
_DWORD *result; // r0
int v9; // r3
unsigned int v10; // r2
int v11; // r2
int v12; // r3
int v13; // r3
_DWORD *v14; // r2
_DWORD *v15; // r2
_DWORD *v16; // r3
signed int v17; // r3
unsigned int v18; // r2
signed int v19; // r2
unsigned int v20; // r1
_DWORD v21[3]; // [sp+4h] [bp-Ch] BYREF
if ( a3 < 0 )
v3 = a1[809];
else
v3 = a3;
if ( a3 >= 0 )
a1[809] = a3;
v4 = (_DWORD *)*a1;
if ( v3 <= 0 )
v7 = 4400;
else
v7 = 1 << v3;
if ( v3 > 0 )
v7 = 4 * (v7 + 1100);
memset(a1, 0, v7);
a1[809] = v3;
*a1 = v4;
result = sub_71EC08(v21, a2);
LABEL_12:
v9 = v21[0];
while ( v9 )
{
if ( *(_BYTE *)v9 )
{
if ( *(_BYTE *)v9 == 1 )
{
++*(_DWORD *)(*a1 + 4 * (*(_DWORD *)(v9 + 4) + 280));
}
else
{
v10 = *(unsigned __int16 *)(v9 + 2);
if ( v10 >= 0x200 )
{
v19 = v10 - 1;
v20 = __clz(v19) ^ 0x1F;
v11 = ((v19 >> (v20 - 1)) & 1) + 2 * v20;
}
else
{
v11 = byte_A037B0[2 * v10];
}
result = (_DWORD *)*a1;
++*(_DWORD *)(*a1 + 4 * (v11 + 256));
v12 = *(_DWORD *)(v9 + 4);
if ( v12 >= 512 )
{
v17 = v12 - 1;
v18 = __clz(v17) ^ 0x1F;
v13 = ((v17 >> (v18 - 1)) & 1) + 2 * v18;
}
else
{
v13 = byte_A037B0[2 * v12];
}
++a1[v13 + 769];
}
}
else
{
v14 = &a1[*(unsigned __int8 *)(v9 + 7)];
++v14[513];
v15 = &a1[*(unsigned __int8 *)(v9 + 6)];
++v15[1];
result = (_DWORD *)*(unsigned __int8 *)(v9 + 5);
++*(_DWORD *)(*a1 + 4 * (_DWORD)result);
v16 = &a1[*(unsigned __int8 *)(v9 + 4)];
++v16[257];
}
v9 = v21[0] + 8;
v21[0] = v9;
if ( v9 == v21[2] )
{
result = (_DWORD *)sub_71EC28((int)v21);
goto LABEL_12;
}
}
return result;
}