//
// sub_A8984 from 0xa8984 to 0xa8acc (328 bytes)
//
// 3 xrefs:
// > ??> @ 0xa8982
// > sub_A7964 @ 0xa79c2
// > sub_AB87E @ 0xab8d8
//
// 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_A8984(int a1, int a2, int a3, int *a4, _DWORD *a5, _DWORD *a6)
{
int v8; // r5
int v9; // r0
int v10; // r0
_BOOL4 v11; // r12
float v12; // s0
int v13; // r0
int v14; // r3
int v15; // r1
int v16; // r0
int v17; // r0
int (__fastcall *v18)(int, _DWORD, _DWORD *, _DWORD *, _BOOL4, int, int, int); // r5
int v19; // r0
int v21; // [sp+8h] [bp-50h] BYREF
int v22; // [sp+Ch] [bp-4Ch] BYREF
_DWORD v23[6]; // [sp+10h] [bp-48h] BYREF
_DWORD v24[5]; // [sp+28h] [bp-30h] BYREF
int v25; // [sp+3Ch] [bp-1Ch] BYREF
int v26; // [sp+40h] [bp-18h] BYREF
int v27; // [sp+44h] [bp-14h] BYREF
v8 = a3;
v26 = a3;
v27 = a2;
if ( !(a3 | a2) )
{
v9 = *(_DWORD *)(a1 + 164);
if ( !v9 || *(_DWORD *)(v9 + 40) || *(_DWORD *)(v9 + 60) || *(_DWORD *)(a1 + 180) == 1001 )
{
sub_A8B34(a1, &v27, &v26, 0);
v8 = v26;
a2 = v27;
}
}
v25 = a2;
if ( !*(_DWORD *)(a1 + 200) || (v10 = *(_DWORD *)(a1 + 92), __dmb(0xBu), v10 << 31) )
{
if ( a6 )
*a6 = 6;
}
else
{
memset(v24, 0, sizeof(v24));
memset(v23, 0, 0x14u);
v11 = 0;
if ( !*(_DWORD *)(a1 + 208) )
v11 = *(_DWORD *)(a1 + 232) == 0;
v21 = 0;
v22 = 0;
v12 = *(float *)(a1 + 308);
if ( fabsf(v12) < 0.00002 && v12 == *(float *)(a1 + 320) )
v11 = 1;
v13 = *(_DWORD *)(a1 + 164);
if ( v13 )
{
v14 = *(_DWORD *)(v13 + 40);
v15 = 0;
}
else
{
v15 = 1;
v14 = 1;
}
v24[2] = &v22;
v24[0] = v14;
v24[1] = &v27;
v24[4] = v26;
if ( v15 )
v16 = 1;
else
v16 = *(_DWORD *)(v13 + 44);
v23[2] = &v21;
v23[0] = v16;
v23[4] = v8;
v23[1] = &v25;
v17 = a1 + 132;
*(_DWORD *)(a1 + 132) = a1;
v18 = *(int (__fastcall **)(int, _DWORD, _DWORD *, _DWORD *, _BOOL4, int, int, int))(a1 + 200);
if ( a6 )
*a6 = v18(v17, *(unsigned __int16 *)(a1 + 82), v24, v23, v11, 1, v21, v22);
else
v18(v17, 0, v24, v23, 0, 1, v21, v22);
v19 = v25;
if ( v25 >= 32 )
v19 = 32;
v25 = v19;
v8 = v23[4];
}
if ( a4 )
*a4 = v25;
if ( a5 )
*a5 = v8;
return 0;
}