//
// sub_A8B34 from 0xa8b34 to 0xa8bdc (168 bytes)
//
// 2 xrefs:
// > sub_A7964 @ 0xa7dc6
// > sub_A8984 @ 0xa89c0
//
// 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
//
int __fastcall sub_A8B34(int a1, unsigned int *a2, int *a3, int a4)
{
int v6; // r2
unsigned int v7; // r1
int v8; // r6
int v10; // r2
unsigned int v11; // r0
if ( a4 && *(unsigned __int8 *)(a4 + 72) << 31 )
v6 = *(__int16 *)(a1 + 288);
else
v6 = *(__int16 *)(a1 + 280) - *(__int16 *)(a1 + 288);
v7 = *(unsigned __int16 *)(a1 + 192);
if ( *(_WORD *)(a1 + 192) )
{
v8 = *(_DWORD *)(a1 + 144);
goto LABEL_9;
}
if ( *(_DWORD *)(a1 + 208) )
{
v8 = *(_DWORD *)(a1 + 220);
v7 = *(_DWORD *)(a1 + 216);
goto LABEL_9;
}
if ( v6 > 1 )
{
v8 = *a3;
if ( !*a3 )
v8 = *(_DWORD *)(*(_DWORD *)(a1 + 128) + 69188);
if ( v8 == 1 )
{
v8 = 1;
v7 = *(_DWORD *)(*(_DWORD *)(a1 + 128) + 1188);
}
else
{
v7 = sub_537B4(v8);
}
}
else
{
if ( a4 )
{
if ( *(_DWORD *)(a4 + 32) )
{
v7 = *(__int16 *)(a4 + 30);
if ( *(_WORD *)(a4 + 30) )
{
v8 = 0;
goto LABEL_9;
}
}
else
{
v10 = *(_DWORD *)(a4 + 44);
v7 = *(_DWORD *)(v10 + 216);
if ( v7 )
{
v8 = *(_DWORD *)(v10 + 220);
goto LABEL_9;
}
}
}
v7 = *(_DWORD *)(a1 + 304);
v11 = __clz(v7);
if ( !v7 )
v7 = 1;
v8 = 2 * (v11 >> 5);
}
LABEL_9:
if ( a2 )
*a2 = v7;
if ( a3 )
*a3 = v8;
return 0;
}