//
// sub_1004EE658 from 0x1004ee658 to 0x1004ee724 (204 bytes)
//
// 1 xrefs:
// > sub_1004EE2C0 @ 0x1004ee504
//
// 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:06:44 +0000
//
__int64 __fastcall sub_1004EE658(_QWORD *a1, __int64 a2)
{
__int64 result; // x0
__int64 v5; // x8
__int64 v6; // x9
__int64 (__fastcall *v7)(_QWORD *, __int64); // x8
__int64 v8; // x11
char v9; // w21
_QWORD *v10; // x9
_QWORD *v11; // x0
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
if ( (result & 0x80000000) == 0 )
{
v5 = a1[85];
if ( (int)result < (int)(-1431655765 * ((unsigned __int64)(a1[86] - v5) >> 4)) )
{
v6 = v5 + 48LL * (unsigned int)result;
v7 = *(__int64 (__fastcall **)(_QWORD *, __int64))(v6 + 24);
v8 = *(_QWORD *)(v6 + 32);
v9 = *(_BYTE *)(v6 + 40);
if ( *(_QWORD *)(v6 + 16) )
v10 = *(_QWORD **)(v6 + 16);
else
v10 = a1;
v11 = (_QWORD *)((char *)v10 + (v8 >> 1));
if ( (v8 & 1) != 0 )
v7 = *(__int64 (__fastcall **)(_QWORD *, __int64))(*v11 + (unsigned int)v7);
result = v7(v11, a2);
if ( (v9 & 1) != 0 )
{
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1072LL))(a1, 0);
return (*(__int64 (__fastcall **)(_QWORD *, __int64))(*a1 + 528LL))(a1, 1);
}
}
}
return result;
}