//
// cocos2d::extension::CCThreadPool::CCThreadPool from 0x5ac1c0 to 0x5ac38a (458 bytes)
//
// 1 xrefs:
// > cocos2d::extension::CCHttpClient::CCHttpClient @ 0x5ac3ca
//
// 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
//
// Alternative name is '_ZN7cocos2d9extension12CCThreadPoolC1Ej'
cocos2d::extension::CCThreadPool *__fastcall cocos2d::extension::CCThreadPool::CCThreadPool(
cocos2d::extension::CCThreadPool *this,
unsigned int a2)
{
int v2; // r2
unsigned int v4; // r2
int v5; // r2
pthread_t *v6; // r0
pthread_t *v7; // r3
int v8; // r0
int v9; // r5
bool v10; // cf
unsigned int v11; // r5
_DWORD *v12; // r6
pthread_t *v13; // r0
pthread_t *v14; // r3
_DWORD *v15; // r0
char *v16; // r2
char *j; // r1
char *v18; // r8
int i; // [sp+4h] [bp-48h]
pthread_t *v22; // [sp+10h] [bp-3Ch]
char *v23; // [sp+14h] [bp-38h]
cocos2d::extension::CCThreadPool *v24; // [sp+1Ch] [bp-30h] BYREF
int v25; // [sp+20h] [bp-2Ch]
int v26[4]; // [sp+24h] [bp-28h] BYREF
int v27[6]; // [sp+34h] [bp-18h] BYREF
v2 = _stack_chk_guard;
*(_DWORD *)this = 0;
*((_DWORD *)this + 1) = 0;
*((_DWORD *)this + 2) = 0;
v27[4] = v2;
v24 = nullptr;
v25 = 0;
memset(v26, 0, sizeof(v26));
memset(v27, 0, 16);
std::_Deque_base>::_M_initialize_map(&v24, 0);
*((_DWORD *)this + 3) = 0;
*((_DWORD *)this + 4) = 0;
*((_DWORD *)this + 5) = 0;
*((_DWORD *)this + 6) = 0;
*((_DWORD *)this + 7) = 0;
*((_DWORD *)this + 8) = 0;
*((_DWORD *)this + 9) = 0;
*((_DWORD *)this + 10) = 0;
*((_DWORD *)this + 11) = 0;
*((_DWORD *)this + 12) = 0;
std::_Deque_base>::_M_initialize_map((_DWORD *)this + 3, 0);
if ( v24 )
{
std::swap,std::function&,std::function*>>(
(int *)this + 5,
v26);
std::swap,std::function&,std::function*>>(
(int *)this + 9,
v27);
v4 = (unsigned int)v24;
v24 = *((cocos2d::extension::CCThreadPool **)this + 3);
*((_DWORD *)this + 3) = v4;
v5 = v25;
v25 = *((_DWORD *)this + 4);
*((_DWORD *)this + 4) = v5;
}
std::deque>::~deque((int)&v24);
*((_DWORD *)this + 13) = 0;
sub_76DB64((char *)this + 56);
*((_BYTE *)this + 60) = 0;
*((_DWORD *)this + 16) = 0;
for ( i = 0; i != a2; ++i )
{
v6 = *((pthread_t **)this + 1);
v7 = *((pthread_t **)this + 2);
v24 = this;
if ( v6 != v7 )
{
if ( v6 )
sub_5ABA18(v6, (unsigned int *)&v24);
*((_DWORD *)this + 1) += 4;
continue;
}
v8 = ((int)v6 - *(_DWORD *)this) >> 2;
if ( v8 )
v9 = v8;
else
v9 = 1;
v10 = __CFADD__(v9, v8);
v11 = v9 + v8;
if ( v10 || v11 >= 0x40000000 )
{
v11 = 0x3FFFFFFF;
}
else if ( !v11 )
{
v12 = nullptr;
goto LABEL_16;
}
v12 = (_DWORD *)operator new(4 * v11);
LABEL_16:
v13 = (_DWORD *)((char *)v12 + *((_DWORD *)this + 1) - *(_DWORD *)this);
if ( v13 )
sub_5ABA18(v13, (unsigned int *)&v24);
v14 = *(pthread_t **)this;
v15 = v12;
v16 = *((char **)this + 1);
for ( j = *(char **)this; j != v16; j += 4 )
{
if ( v15 )
{
*v15 = 0;
*v15 = *(_DWORD *)j;
*(_DWORD *)j = 0;
}
++v15;
}
v18 = (char *)v12 + ((v16 - (char *)v14) & 0xFFFFFFFC) + 4;
while ( v14 != (pthread_t *)v16 )
{
v23 = v16;
v22 = v14;
std::thread::~thread(v14);
v16 = v23;
v14 = v22 + 1;
}
if ( *(_DWORD *)this )
operator delete(*(void **)this);
*(_DWORD *)this = v12;
*((_DWORD *)this + 1) = v18;
*((_DWORD *)this + 2) = &v12[v11];
}
return this;
}