//
// sub_1005AF5BC from 0x1005af5bc to 0x1005af690 (212 bytes)
//
// 1 xrefs:
// > sub_10057C9E0 @ 0x10057cbdc
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:09:10 +0000
//
__int64 __fastcall sub_1005AF5BC(__int64 a1, _QWORD *a2)
{
__int64 v4; // x21
__int64 v5; // x0
__int64 v6; // x0
__int64 v8; // x10
char v9; // [xsp+Eh] [xbp-22h] BYREF
char v10; // [xsp+Fh] [xbp-21h] BYREF
if ( *(int *)(a1 + 12) < 1 )
return 2;
v4 = 0;
while ( 1 )
{
if ( !*(_BYTE *)(*(_QWORD *)(a1 + 32) + v4) )
{
v10 = 0;
v5 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8 * v4);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v5 + 48LL))(v5, &v10);
if ( v10 )
{
v9 = 0;
v6 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8 * v4);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v6 + 64LL))(v6, &v9);
if ( v9 )
break;
}
}
if ( ++v4 >= *(int *)(a1 + 12) )
return 2;
}
v8 = *(_QWORD *)(a1 + 24);
*(_BYTE *)(*(_QWORD *)(a1 + 32) + v4) = 1;
++*(_DWORD *)(a1 + 16);
*a2 = *(_QWORD *)(v8 + 8 * v4);
return 0;
}