//
// sub_1005EB31C from 0x1005eb31c to 0x1005eb47c (352 bytes)
//
// 4 xrefs:
// > ??> @ 0x1009abc90
// > ??> @ 0x1009abe38
// > ??> @ 0x1009abfe0
// > ??> @ 0x1009ac170
//
// 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_1005EB31C(__int64 a1, __int64 a2, _QWORD *a3)
{
__int64 result; // x0
unsigned int v6; // w21
__int64 v7; // x22
__int64 v8; // x8
char v9; // w10
char v10; // w9
unsigned int v11; // w10
unsigned int v12; // w9
unsigned int v13; // w9
int v14; // w10
int v15; // w8
char v16; // w12
int v17; // w12
int v18; // w8
__int64 v21; // x0
_QWORD v22[2]; // [xsp+8h] [xbp-38h] BYREF
int v23; // [xsp+18h] [xbp-28h]
result = 31;
if ( (a2 & 0x80000000) == 0 && a3 )
{
v6 = a2;
if ( *(_DWORD *)(a1 + 176) <= (int)a2 )
return 31;
*a3 = 0;
v7 = *(_QWORD *)(*(_QWORD *)(a1 + 160) + 8LL * (unsigned int)a2);
if ( !v7 || !*(_QWORD *)(v7 + 168) )
goto LABEL_27;
v8 = *(_QWORD *)(v7 + 184);
v9 = atomic_load((unsigned int *)(v7 + 88));
if ( (v9 & 4) == 0 || (v10 = atomic_load((unsigned int *)(v7 + 88)), (v10 & 0x40) != 0) )
{
if ( (*(_BYTE *)(a1 + 46) & 1) == 0 )
{
result = sub_1005EB514(v7, a2);
if ( (_DWORD)result )
return result;
if ( *(_DWORD *)(v7 + 192) != *(_DWORD *)(*(_QWORD *)(v7 + 96) + 284LL)
&& !(unsigned int)sub_1005E843C(v7, 0, 2) )
{
sub_1005E83A8(v7);
}
goto LABEL_27;
}
v11 = atomic_load((unsigned int *)(v7 + 272));
if ( v11 != 5 )
{
v12 = atomic_load((unsigned int *)(v7 + 272));
if ( v12 != 7 )
{
v13 = *(_DWORD *)(*(_QWORD *)(v7 + 384) + 68LL);
if ( *(_DWORD *)(v7 + 68) < v13 )
v13 = *(_DWORD *)(v7 + 68);
v14 = *(_DWORD *)(v8 + 192);
v15 = *(_DWORD *)(v8 + 404);
v16 = atomic_load((unsigned int *)(v7 + 88));
v17 = v16 & 0x10;
v18 = v15 + v13;
if ( v14 != (_DWORD)a2 || *(_DWORD *)(v7 + 64) != v18 || v17 != 0 )
{
v21 = *(_QWORD *)(*(_QWORD *)(v7 + 264) + 16LL);
v22[0] = a1;
v22[1] = v7;
v23 = a2;
sub_1005EB47C(v21, v7, v22);
}
LABEL_27:
*a3 = *(_QWORD *)(*(_QWORD *)(a1 + 160) + 8LL * v6);
return 0;
}
}
}
return 46;
}
return result;
}