//
// GameStatsManager::getCompletedMapPacks from 0x7a2438 to 0x7a2744 (780 bytes)
//
// 2 xrefs:
// > GameManager::recountUserStats @ 0x5fa058
// > ??> @ 0x60cf0
//
// 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
//
cocos2d::CCArray *GameStatsManager::getCompletedMapPacks(GameStatsManager *a1)
{
cocos2d::CCArray *v1; // x22
unsigned int v2; // w20
cocos2d::CCString *v3; // x0
char *CString; // x0
cocos2d::CCArray *v5; // x24
void *v6; // x0
unsigned int *v8; // x1
int v9; // w2
cocos2d::CCString *v10; // x0
char *v11; // x0
_QWORD *v12; // x27
__int64 *v13; // x28
unsigned __int64 v14; // x19
size_t v15; // x2
int v16; // w2
__int64 v17; // x19
char *v18; // x0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x3
int v22; // w0
cocos2d::CCObject *v23; // x0
cocos2d::CCArray *v24; // [xsp+68h] [xbp+68h]
unsigned __int64 v25; // [xsp+78h] [xbp+78h]
int v26; // [xsp+78h] [xbp+78h]
__int64 v27; // [xsp+90h] [xbp+90h] BYREF
_QWORD *v28; // [xsp+98h] [xbp+98h] BYREF
_QWORD *v29; // [xsp+A0h] [xbp+A0h] BYREF
v1 = cocos2d::CCDictionary::allKeys(a1->m_completedLevels);
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v1);
v2 = 0;
if ( (unsigned int)cocos2d::CCArray::count(v1) )
{
while ( 1 )
{
v3 = cocos2d::CCArray::stringAtIndex(v1, v2);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((int)&v27, CString);
v5 = sub_7A19E8(&v27, "_");
if ( (unsigned int)cocos2d::CCArray::count(v5) == 2 )
break;
LABEL_3:
v6 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) == &qword_124B6B0 )
goto LABEL_4;
if ( &pthread_create )
{
v8 = (unsigned int *)(v27 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v9 - 1;
}
if ( v9 > 0 )
{
LABEL_4:
++v2;
}
else
{
++v2;
operator delete(v6);
}
if ( v2 >= (unsigned int)cocos2d::CCArray::count(v1) )
return v24;
}
v10 = cocos2d::CCArray::stringAtIndex(v5, 0);
v11 = (char *)cocos2d::CCString::getCString(v10);
sub_D153B8((int)&v28, v11);
sub_D153B8((int)&v29, "pack");
v12 = v29;
v13 = v29 - 3;
v14 = *(v28 - 3);
v25 = *(v29 - 3);
if ( v25 > v14 )
v15 = *(v28 - 3);
else
v15 = *(v29 - 3);
v16 = memcmp(v28, v29, v15);
if ( !v16 )
{
v16 = 0x7FFFFFFF;
v17 = v14 - v25;
if ( v17 <= 0x7FFFFFFF )
{
if ( v17 >= (__int64)0xFFFFFFFF80000000LL )
v16 = v17;
else
v16 = 0x80000000;
}
}
if ( v13 == &qword_124B6B0 )
goto LABEL_21;
if ( &pthread_create )
{
v21 = (unsigned int *)(v12 - 1);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v22 - 1;
}
if ( v22 > 0 )
{
LABEL_21:
if ( !v16 )
{
LABEL_33:
v23 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v5, 1u);
cocos2d::CCArray::addObject(v24, v23);
}
}
else
{
v26 = v16;
operator delete(v13);
if ( !v26 )
goto LABEL_33;
}
v18 = (char *)(v28 - 3);
if ( v28 - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v28 - 1);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v18);
}
goto LABEL_3;
}
return v24;
}