//
// sub_1005CBF80 from 0x1005cbf80 to 0x1005cc094 (276 bytes)
//
// 6 xrefs:
// > sub_10057C944 @ 0x10057c964
// > sub_1005AEBA4 @ 0x1005aec10
// > ??> @ 0x1009aaab8
// > ??> @ 0x1009ab768
// > ??> @ 0x1009ab7d0
// > ??> @ 0x1009ab828
//
// 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:28 +0000
//
__int64 __fastcall sub_1005CBF80(__int64 a1)
{
unsigned int *v2; // x20
char v3; // w8
char v4; // w8
__int64 v5; // x0
__int64 result; // x0
__int16 v7; // w8
unsigned int v8; // w8
int *v9; // x1
int *v10; // [xsp+8h] [xbp-18h] BYREF
if ( !*(_QWORD *)(a1 + 168) )
return 0;
v2 = (unsigned int *)(a1 + 100);
v3 = atomic_load((unsigned int *)(a1 + 100));
if ( (v3 & 0x20) != 0 )
return 10;
v4 = atomic_load(v2);
if ( (v4 & 0x40) != 0 )
return 8;
v5 = *(_QWORD *)(a1 + 168);
if ( !v5 || (result = sub_100563F08(v5, a1), !(_DWORD)result) )
{
v7 = atomic_load(v2);
if ( (v7 & 0x300) != 0 )
{
sub_100564430(*(_QWORD *)(a1 + 168), 1);
result = sub_1005CC094(a1, 0, 0, 1, 1, 4);
if ( !(_DWORD)result )
return sub_1005CBC9C(a1);
}
else
{
result = sub_100564878(*(_QWORD *)(a1 + 168), &v10, 24, 1);
if ( !(_DWORD)result )
{
do
v8 = __ldaxr(v2);
while ( __stlxr(v8 | 0x400, v2) );
*(_BYTE *)v10 = 5;
v9 = v10;
*((_QWORD *)v10 + 1) = a1;
*((_WORD *)v9 + 8) = 257;
*((_BYTE *)v9 + 18) = 1;
return sub_10056491C(*(_QWORD *)(a1 + 168), (__int64)v9, 1);
}
}
}
return result;
}