//
// sub_9340C0 from 0x9340c0 to 0x9341f6 (310 bytes)
//
// 4 xrefs:
// > sub_92E8CC @ 0x92eb9c
// > sub_92E8CC @ 0x92ebba
// > sub_92E8CC @ 0x92efe8
// > sub_92E8CC @ 0x92f8ac
//
// 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:04:55 +0000
//
_DWORD *__fastcall sub_9340C0(_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_92E7C8(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_C45D48[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_C45D48[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_92E7E8((int)v21);
goto LABEL_12;
}
}
return result;
}