//
// cocos2d::extension::CCThreadPool::enqueue from 0xd1f174 to 0xd1f2d4 (352 bytes)
//
// 2 xrefs:
// > cocos2d::extension::CCHttpClient::send @ 0xd1f32c
// > ??> @ 0x4e7f0
//
// 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 13:07:10 +0000
//
__int64 __fastcall cocos2d::extension::CCThreadPool::enqueue(__int64 a1, __int64 a2)
{
std::mutex *v2; // x21
__int64 v5; // x2
__int64 v6; // x4
__int64 v7; // x3
__int64 v8; // x20
__int64 v9; // x1
unsigned __int64 v10; // x0
unsigned __int64 v11; // x20
__int64 v12; // x0
v2 = (std::mutex *)(a1 + 72);
std::mutex::lock((std::mutex *)(a1 + 72));
if ( *(_BYTE *)(a1 + 160) )
return std::mutex::unlock(v2);
v5 = *(_QWORD *)(a1 + 32);
v6 = 0;
v7 = *(_QWORD *)(a1 + 40);
v8 = (v7 - v5) >> 3;
if ( v8 )
v6 = 85 * v8 - 1;
v9 = *(_QWORD *)(a1 + 64);
v10 = v9 + *(_QWORD *)(a1 + 56);
if ( v10 == v6 )
{
std::deque>::__add_back_capacity((char **)(a1 + 24));
v9 = *(_QWORD *)(a1 + 64);
v5 = *(_QWORD *)(a1 + 32);
v7 = *(_QWORD *)(a1 + 40);
v10 = v9 + *(_QWORD *)(a1 + 56);
}
if ( v5 != v7 )
{
v11 = *(_QWORD *)(v5 + 8 * (v10 / 0x55)) + 48 * (v10 % 0x55);
if ( v11 )
{
v12 = *(_QWORD *)(a2 + 32);
if ( v12 )
{
if ( v12 == a2 )
{
*(_QWORD *)(v11 + 32) = v11;
(*(void (__fastcall **)(_QWORD, unsigned __int64))(**(_QWORD **)(a2 + 32) + 24LL))(*(_QWORD *)(a2 + 32), v11);
}
else
{
*(_QWORD *)(v11 + 32) = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 16LL))(v12);
}
v9 = *(_QWORD *)(a1 + 64);
}
else
{
*(_QWORD *)(v11 + 32) = 0;
v9 = *(_QWORD *)(a1 + 64);
}
}
}
*(_QWORD *)(a1 + 64) = v9 + 1;
std::mutex::unlock(v2);
return std::condition_variable::notify_one((std::condition_variable *)(a1 + 112));
}