//
// cocos2d::extension::CCThreadPool::availableThreadCount from 0xaab6a0 to 0xaab758 (184 bytes)
//
// 2 xrefs:
// > cocos2d::extension::CCHttpClient::availableThreadCount @ 0xaab794
// > ??> @ 0x395d0
//
// 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
//
unsigned __int64 __fastcall cocos2d::extension::CCThreadPool::availableThreadCount(
cocos2d::extension::CCThreadPool *this)
{
pthread_mutex_t *v2; // x21
__int64 v3; // x0
unsigned __int64 v4; // x0
unsigned __int64 v5; // x1
unsigned __int64 v6; // x19
v2 = (pthread_mutex_t *)((char *)this + 104);
if ( &pthread_create )
{
v3 = pthread_mutex_lock(v2);
if ( (_DWORD)v3 )
sub_D1410C(v3);
}
v4 = *((_QWORD *)this + 25)
+ ((__int64)(*((_QWORD *)this + 9) - *((_QWORD *)this + 10)) >> 5)
+ 16 * (((__int64)(*((_QWORD *)this + 12) - *((_QWORD *)this + 8)) >> 3) - 1)
+ ((__int64)(*((_QWORD *)this + 7) - *((_QWORD *)this + 5)) >> 5);
v5 = (__int64)(*((_QWORD *)this + 1) - *(_QWORD *)this) >> 3;
v6 = v5 - v4;
if ( v4 >= v5 )
v6 = 0;
if ( &pthread_create )
pthread_mutex_unlock(v2);
return v6;
}