//
// sub_AACA0 from 0xaaca0 to 0xaae82 (482 bytes)
//
// 3 xrefs:
// > sub_61B58 @ 0x61d28
// > sub_AAA26 @ 0xaaaa8
// > sub_AB0D8 @ 0xab140
//
// 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 11:41:38 +0000
//
int __fastcall sub_AACA0(int a1, int a2, int a3)
{
int result; // r0
bool v7; // cc
bool v8; // zf
int i; // r9
unsigned int v10; // r3
int v11; // r2
unsigned int v12; // r0
bool v13; // zf
int j; // r10
unsigned int v15; // r3
int v16; // r2
unsigned int v17; // r0
_DWORD *v18; // [sp+10h] [bp-30h] BYREF
int v19; // [sp+14h] [bp-2Ch] BYREF
int v20; // [sp+18h] [bp-28h] BYREF
__int64 v21; // [sp+1Ch] [bp-24h] BYREF
result = sub_AAE82(a1, &v21, 1, a3);
if ( result )
return result;
result = sub_A8CDE(a2, (_DWORD *)&v21 + 1, 1, a3);
if ( result )
return result;
v7 = SHIDWORD(v21) <= 2;
if ( SHIDWORD(v21) >= 2 )
v7 = (int)v21 <= 1;
if ( !v7 )
return 28;
if ( !v21 )
return 0;
if ( SHIDWORD(v21) <= 1 && HIDWORD(v21) ^ 1 | (unsigned int)v21 )
{
result = 0;
if ( (_DWORD)v21 )
{
v20 = 0;
result = sub_A733A(a2, 0, &v20, nullptr, 1, a3);
v8 = result == 9;
if ( result != 9 )
v8 = result == 0;
if ( v8 && (!v20 || (result = sub_AA3A4(a2, v20, nullptr, 1, a3, 4)) == 0) )
{
for ( i = 0; i < (int)v21; ++i )
{
result = sub_A73F4(a1, 0, &v19, &v18, 1, a3);
if ( result )
return result;
result = sub_AA3A4(v19, a1, v18, 0, a3, 4);
if ( result )
return result;
if ( v20 )
{
result = sub_AA6F0(v19, v20, nullptr, 0, 0, (int)v18, a3);
}
else
{
if ( a3 )
{
v11 = 1;
}
else
{
v12 = *(_DWORD *)(a1 + 92);
__dmb(0xBu);
v11 = (v12 >> 8) & 1;
}
result = sub_5C7EA(*(_DWORD *)(a1 + 128) + 1264, (unsigned int)v18, v11, v10);
}
if ( result )
return result;
}
return 0;
}
}
}
else
{
v20 = 0;
result = sub_A73F4(a1, 0, &v20, nullptr, 1, a3);
v13 = result == 9;
if ( result != 9 )
v13 = result == 0;
if ( v13 && (!v20 || (result = sub_AA3A4(v20, a1, nullptr, 1, a3, 4)) == 0) )
{
for ( j = 0; j < SHIDWORD(v21); ++j )
{
result = sub_A733A(a2, 0, &v19, &v18, 1, a3);
if ( result )
return result;
result = sub_AA3A4(a2, v19, v18, 0, a3, 4);
if ( result )
return result;
if ( v20 )
{
result = sub_AA6F0(v20, v19, nullptr, 0, 0, (int)v18, a3);
}
else
{
if ( a3 )
{
v16 = 1;
}
else
{
v17 = *(_DWORD *)(a1 + 92);
__dmb(0xBu);
v16 = (v17 >> 8) & 1;
}
result = sub_5C7EA(*(_DWORD *)(a1 + 128) + 1264, (unsigned int)v18, v16, v15);
}
if ( result )
return result;
}
return 0;
}
}
return result;
}