//
// sub_1004EBD18 from 0x1004ebd18 to 0x1004ebdbc (164 bytes)
//
// 3 xrefs:
// > sub_1004EC8B4 @ 0x1004ecb38
// > sub_1004ED490 @ 0x1004ed548
// > sub_1004EF8F0 @ 0x1004ef9b0
//
// 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_1004EBD18(__int64 a1, __int64 a2)
{
__int64 v2; // x19
int v4; // w8
unsigned int v5; // w1
bool v6; // cc
int v7; // w0
int v8[8]; // [xsp+0h] [xbp-30h] BYREF
v2 = *(_QWORD *)(a1 + 32);
sub_10042C340((__int64)v8, *(_QWORD *)a2, *(_DWORD *)(a2 + 8));
if ( (unsigned int)sub_10042C698(v8, 1u) )
return 4294967161LL;
v4 = *(_DWORD *)(v2 + 8);
if ( v4 < 2 )
{
v5 = 0;
}
else
{
v5 = 0;
do
{
++v5;
v6 = (unsigned int)v4 > 3;
v4 = (unsigned int)v4 >> 1;
}
while ( v6 );
}
v7 = sub_10042C698(v8, v5);
if ( v7 == -1 )
return 4294967160LL;
else
return *(unsigned int *)(v2 + 4LL * **(int **)(v2 + 8LL * v7 + 32));
}