//
// sub_AABD1C from 0xaabd1c to 0xaabdcc (176 bytes)
//
// 4 xrefs:
// > cocos2d::extension::CCThreadPool::CCThreadPool @ 0xaac564
// > cocos2d::extension::CCThreadPool::CCThreadPool @ 0xaac604
// > sub_D19D4C @ 0xd19e48
// > sub_D19E54 @ 0xd19fd8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_AABD1C(__int64 result)
{
unsigned int *v1; // x19
unsigned int *v2; // x1
unsigned int v3; // w2
int v4; // w1
unsigned int *v5; // x20
v1 = (unsigned int *)result;
if ( !&pthread_create )
{
v4 = *(_DWORD *)(result + 8);
*(_DWORD *)(result + 8) = v4 - 1;
if ( v4 != 1 )
return result;
(*(void (__fastcall **)(__int64))(*(_QWORD *)result + 16LL))(result);
result = v1[3];
v1[3] = result - 1;
goto LABEL_8;
}
v2 = (unsigned int *)(result + 8);
do
v3 = __ldaxr(v2);
while ( __stlxr(v3 - 1, v2) );
if ( v3 == 1 )
{
v5 = (unsigned int *)(result + 12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)result + 16LL))(result);
do
result = __ldaxr(v5);
while ( __stlxr(result - 1, v5) );
LABEL_8:
if ( (_DWORD)result == 1 )
return (*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)v1 + 24LL))(v1);
}
return result;
}