//
// GameLevelManager::getCompletedLevels from 0x1005350b0 to 0x100535266 (438 bytes)
//
// 2 xrefs:
// > GameLevelManager::getOnlineLevels @ 0x10053fd08
// > GameLevelManager::submitUserInfo @ 0x10054a28f
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCArray *__fastcall GameLevelManager::getCompletedLevels(GameLevelManager *a1, bool a2)
{
double v2; // xmm0_8
bool v3; // r12
cocos2d::CCArray *v4; // r14
unsigned int v5; // r15d
int v6; // ebx
int v7; // eax
cocos2d::CCString *v8; // rax
const char *CString; // rbx
cocos2d::CCDictionary *m_onlineLevels; // r13
size_t v11; // rax
size_t v12; // r15
char *v13; // r14
__int64 v14; // rax
size_t v15; // r12
_DWORD *v16; // rbx
unsigned int v17; // r15d
int v19; // [rsp+8h] [rbp-68h]
cocos2d::CCArray *v20; // [rsp+18h] [rbp-58h]
cocos2d::CCArray *v21; // [rsp+20h] [rbp-50h]
_QWORD __dst[2]; // [rsp+28h] [rbp-48h] BYREF
void *__p; // [rsp+38h] [rbp-38h]
_BOOL4 v24; // [rsp+40h] [rbp-30h]
unsigned int v25; // [rsp+44h] [rbp-2Ch]
v3 = a2;
v21 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2);
v4 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
if ( (unsigned int)sub_100720070(v4) )
{
v5 = 0;
v6 = -1;
v20 = v4;
v24 = a2;
while ( 1 )
{
v25 = v5;
v7 = sub_100720070(v4);
v19 = v6;
v8 = (cocos2d::CCString *)sub_1007200C0(v4, (unsigned int)(v7 + v6));
CString = cocos2d::CCString::getCString(v8);
m_onlineLevels = a1->m_onlineLevels;
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v12 = v11;
if ( v11 >= 0x17 )
break;
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( v11 )
goto LABEL_12;
LABEL_13:
v13[v12] = 0;
v16 = (_DWORD *)cocos2d::CCDictionary::objectForKey_1((__int64)m_onlineLevels, (char *)__dst);
v4 = v20;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( v3 )
{
v17 = v25;
if ( v16[187] - v16[188] <= 99 )
goto LABEL_4;
}
else
{
v17 = v25;
if ( v16[186] - v16[185] < 100 )
goto LABEL_4;
}
sub_10071FCD0(v21, v16);
LABEL_4:
v5 = v17 + 1;
v6 = v19 - 1;
if ( v5 >= (unsigned int)sub_100720070(v20) )
return v21;
}
v14 = v11 | 7;
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = v14 + 1;
v13 = (char *)operator new(v15);
__p = v13;
__dst[0] = v15 + 1;
__dst[1] = v12;
v3 = v24;
LABEL_12:
memmove(v13, CString, v12);
goto LABEL_13;
}
return v21;
}