//
// cocos2d::extension::CCHttpClient::availableThreadCount from 0x100426470 to 0x1004264b7 (71 bytes)
//
// 2 xrefs:
// > CustomSongWidget::processNextMultiAsset @ 0x1006fd809
// > CustomSongWidget::processNextMultiAsset @ 0x1006fda55
//
// 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:30:17 +0000
//
unsigned __int64 __fastcall cocos2d::extension::CCHttpClient::availableThreadCount(__int64 a1)
{
__int64 v1; // r14
std::mutex *v2; // rbx
unsigned __int64 v3; // rax
unsigned __int64 v4; // rcx
unsigned __int64 v5; // r14
bool v6; // cf
unsigned __int64 v7; // rcx
v1 = *(_QWORD *)(a1 + 56);
v2 = (std::mutex *)(v1 + 72);
std::mutex::lock((std::mutex *)(v1 + 72));
v3 = *(_QWORD *)(v1 + 64) + *(_QWORD *)(v1 + 192);
v4 = (__int64)(*(_QWORD *)(v1 + 8) - *(_QWORD *)v1) >> 3;
v5 = 0;
v6 = v4 < v3;
v7 = v4 - v3;
if ( !v6 )
v5 = v7;
std::mutex::unlock(v2);
return v5;
}