//
// sub_1005E83A8 from 0x1005e83a8 to 0x1005e843c (148 bytes)
//
// 4 xrefs:
// > sub_100565B84 @ 0x100567590
// > sub_10057A84C @ 0x10057aa00
// > sub_10057EC28 @ 0x10057ef70
// > sub_1005EB31C @ 0x1005eb3c8
//
// 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:43 +0000
//
__int64 __fastcall sub_1005E83A8(__int64 a1)
{
__int64 v2; // x8
__int64 v3; // x20
__int64 v4; // x8
__int64 result; // x0
__int64 v6; // x0
unsigned int v7; // w8
unsigned int *v8; // x8
unsigned int v9; // w9
v2 = *(_QWORD *)(a1 + 384);
if ( !v2 )
goto LABEL_10;
if ( (*(_BYTE *)(a1 + 45) & 4) != 0 )
{
v4 = *(unsigned int *)(v2 + 68);
}
else
{
v3 = *(unsigned int *)(a1 + 68);
v4 = *(unsigned int *)(v2 + 68);
if ( (unsigned int)v3 <= (unsigned int)v4 )
goto LABEL_7;
}
v3 = v4;
LABEL_7:
result = sub_1005E8008(a1, 0, v3, nullptr);
if ( (result & 0xFFFFFFEF) != 0 )
return result;
v6 = *(_QWORD *)(a1 + 384);
v7 = *(_DWORD *)(v6 + 68);
if ( v7 > (unsigned int)v3 )
sub_1005EA71C(v6, v3, v7 - (unsigned int)v3);
LABEL_10:
v8 = (unsigned int *)(a1 + 88);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 & 0xFFFFFFEF, v8) );
return 0;
}