//
// sub_100509AE4 from 0x100509ae4 to 0x100509b58 (116 bytes)
//
// 3 xrefs:
// > ??> @ 0x100827a80
// > ??> @ 0x100827ca8
// > ??> @ 0x10082a560
//
// 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
//
__int64 __fastcall sub_100509AE4(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 v3; // x8
__int64 v4; // x9
__int64 v5; // x10
__int64 result; // x0
if ( !a2 )
return 31;
if ( a3 )
*a3 = 0;
v3 = *(_QWORD *)(a1 + 16);
if ( !v3 )
{
if ( *(_QWORD *)(a1 + 96) == a2 )
return 0;
return 9;
}
v4 = *(unsigned int *)(a1 + 24);
if ( (int)v4 < 1 )
return 9;
v5 = 0;
while ( *(_QWORD *)(v3 + 8 * v5) != a2 )
{
if ( v4 == ++v5 )
return 9;
}
result = 0;
if ( a3 )
*a3 = v5;
return result;
}