//
// sub_1005EBCC0 from 0x1005ebcc0 to 0x1005ebd90 (208 bytes)
//
// 4 xrefs:
// > ??> @ 0x1009abce8
// > ??> @ 0x1009abe90
// > ??> @ 0x1009ac038
// > ??> @ 0x1009ac1c8
//
// 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_1005EBCC0(__int64 a1, unsigned __int64 a2)
{
__int64 v4; // x20
void *v5; // x0
void (__fastcall *v6)(__int64); // x8
__int64 v7; // x20
__int64 v8; // x0
__int64 result; // x0
void (__fastcall *v10)(_QWORD, __int64, _QWORD, __int64); // x8
int v11; // [xsp+Ch] [xbp-24h] BYREF
v4 = *(_QWORD *)(a1 + 96);
if ( v4 )
{
*(_DWORD *)(v4 + 344) = 0;
v5 = *(void **)(v4 + 320);
if ( v5 )
bzero(v5, *(unsigned int *)(v4 + 340));
v6 = *(void (__fastcall **)(__int64))(v4 + 176);
if ( v6 )
v6(v4);
}
v7 = *(unsigned int *)(a1 + 192);
v8 = *(_QWORD *)(a1 + 96);
if ( !*(_QWORD *)(v8 + 368) && (*(_BYTE *)(v8 + 45) & 4) == 0 )
return 14;
*(_DWORD *)(a1 + 64) = a2;
result = sub_100585CA4(v8, v7, a2, 2);
if ( !(_DWORD)result )
{
if ( !(unsigned int)sub_100585FE0(*(_QWORD *)(a1 + 96), &v11, 2) )
*(_DWORD *)(a1 + 64) = v11;
v10 = *(void (__fastcall **)(_QWORD, __int64, _QWORD, __int64))(a1 + 336);
if ( v10 )
v10(*(_QWORD *)(a1 + 344), v7, *(unsigned int *)(a1 + 64), 2);
return 0;
}
return result;
}