//
// cocos2d::extension::CCHttpClient::availableThreadCount from 0x180018140 to 0x1800181c6 (134 bytes)
//
// 2 xrefs:
// > ??> @ 0x180032408
// > ??> @ 0x18004ca04
//
// This function is hookable on this platform (idp: pc, 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 12:15:42 +0000
//
__int64 __fastcall cocos2d::extension::CCHttpClient::availableThreadCount(cocos2d::extension::CCHttpClient *this)
{
__int64 v1; // rbx
struct _Mtx_internal_imp_t *v2; // rdi
unsigned __int64 v3; // rdx
unsigned __int64 v4; // rax
__int64 v5; // rbx
v1 = *((_QWORD *)this + 7);
v2 = (struct _Mtx_internal_imp_t *)(v1 + 64);
if ( Mtx_lock((_Mtx_t)(v1 + 64)) )
{
std::_Throw_Cpp_error(5);
__debugbreak();
}
if ( *(_DWORD *)(v1 + 140) == 0x7FFFFFFF )
{
*(_DWORD *)(v1 + 140) = 2147483646;
std::_Throw_Cpp_error(6);
__debugbreak();
}
v3 = *(_QWORD *)(v1 + 224) + *(_QWORD *)(v1 + 56);
v4 = (__int64)(*(_QWORD *)(v1 + 8) - *(_QWORD *)v1) >> 4;
v5 = v4 - v3;
if ( v4 <= v3 )
v5 = 0;
Mtx_unlock(v2);
return v5;
}