//
// sub_A8C20 from 0xa8c20 to 0xa8cde (190 bytes)
//
// 2 xrefs:
// > sub_45D1A @ 0x45d8e
// > sub_61B58 @ 0x61d96
//
// 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_A8C20(int a1, int a2, int a3, int a4, int a5, int a6)
{
int v7; // r0
int result; // r0
unsigned int *v11; // r0
_DWORD *v12; // r1
unsigned int v13; // r1
int v14; // r6
int i; // r5
int v16; // [sp+0h] [bp-30h]
_DWORD **v17; // [sp+Ch] [bp-24h] BYREF
_BYTE *v18; // [sp+10h] [bp-20h] BYREF
v16 = a4;
v7 = *(_DWORD *)(a1 + 92);
__dmb(0xBu);
if ( (v7 & 0x100) != 0 || !a6 )
{
if ( a5 )
{
v14 = *(__int16 *)(a1 + 280);
for ( i = 0; i < v14; ++i )
{
v17 = nullptr;
sub_A733A(a1, i, &v17, nullptr, 0, 0);
((void (__fastcall *)(_DWORD **, _DWORD, int, int))**v17)(v17, **v17, a3, a4);
}
}
(**(void (__fastcall ***)(int, _DWORD, int, int, int))a1)(a1, **(_DWORD **)a1, a3, a4, v16);
return 0;
}
result = sub_61E9C(*(_DWORD *)(a1 + 128), &v18, 24, 1);
if ( !result )
{
v11 = (unsigned int *)(a1 + 92);
*v18 = 12;
v12 = v18;
v18[16] = a5;
v12[1] = a1;
v12[2] = a3;
v12[3] = a4;
*(_DWORD *)(a1 + 296) = a3;
*(_DWORD *)(a1 + 300) = a4;
__dmb(0xBu);
do
v13 = __ldrex(v11);
while ( __strex(v13 | 0x800, v11) );
__dmb(0xBu);
result = sub_61F04(*(_DWORD *)(a1 + 128), (int)v18, 1);
if ( !result )
return 0;
}
return result;
}