//
// sub_1005EBF58 from 0x1005ebf58 to 0x1005ec018 (192 bytes)
//
// 4 xrefs:
// > ??> @ 0x1009abd08
// > ??> @ 0x1009abeb0
// > ??> @ 0x1009ac058
// > ??> @ 0x1009ac1e8
//
// 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:45 +0000
//
__int64 __fastcall sub_1005EBF58(__int64 a1, int a2, __int64 **a3)
{
__int64 result; // x0
__int64 *v7; // x9
__int64 *v8; // x8
int v9; // w10
int v10; // [xsp+Ch] [xbp-24h] BYREF
result = (*(__int64 (__fastcall **)(__int64, int *))(*(_QWORD *)a1 + 232LL))(a1, &v10);
if ( !(_DWORD)result )
{
result = 31;
if ( (a2 & 0x80000000) == 0 && a3 && v10 > a2 )
{
v7 = *(__int64 **)(a1 + 248);
v8 = **(__int64 ***)(a1 + 240);
if ( v8 == v7 )
return 0;
v9 = 0;
while ( 1 )
{
if ( !*(_QWORD *)(a1 + 168) || *(_DWORD *)(a1 + 192) == *((unsigned __int16 *)v8 + 24) )
{
if ( v9 >= a2 )
{
*a3 = v8;
return 0;
}
++v9;
}
v8 = (__int64 *)*v8;
if ( v8 == v7 )
return 0;
}
}
}
return result;
}