//
// GameLevelManager::getCompletedLevels from 0x100546c40 to 0x100546df6 (438 bytes)
//
// 2 xrefs:
// > GameLevelManager::getOnlineLevels @ 0x100558613
// > GameLevelManager::submitUserInfo @ 0x100564c4b
//
// 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:31:59 +0000
//
__int64 __fastcall GameLevelManager::getCompletedLevels(__int64 a1, int a2)
{
char v2; // r12
__int64 v3; // r14
unsigned int v4; // r15d
int v5; // ebx
int v6; // eax
__int64 v7; // rax
const char *CString; // rbx
__int64 v9; // r13
size_t v10; // rax
size_t v11; // r15
char *v12; // r14
__int64 v13; // rax
size_t v14; // r12
_DWORD *v15; // rbx
unsigned int v16; // r15d
int v18; // [rsp+8h] [rbp-68h]
__int64 v19; // [rsp+18h] [rbp-58h]
__int64 v20; // [rsp+20h] [rbp-50h]
_QWORD __dst[2]; // [rsp+28h] [rbp-48h] BYREF
void *__p; // [rsp+38h] [rbp-38h]
int v23; // [rsp+40h] [rbp-30h]
unsigned int v24; // [rsp+44h] [rbp-2Ch]
v2 = a2;
v20 = sub_1007FE900(a1);
v3 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 760));
if ( (unsigned int)sub_1007FEF90(v3) )
{
v4 = 0;
v5 = -1;
v19 = v3;
v23 = a2;
while ( 1 )
{
v24 = v4;
v6 = sub_1007FEF90(v3);
v18 = v5;
v7 = sub_1007FEFE0(v3, (unsigned int)(v6 + v5));
CString = (const char *)cocos2d::CCString::getCString(v7);
v9 = *(_QWORD *)(a1 + 760);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
break;
LOBYTE(__dst[0]) = 2 * v10;
v12 = (char *)__dst + 1;
if ( v10 )
goto LABEL_12;
LABEL_13:
v12[v11] = 0;
v15 = (_DWORD *)cocos2d::CCDictionary::objectForKey(v9, (char *)__dst);
v3 = v19;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( v2 )
{
v16 = v24;
if ( v15[216] - v15[217] <= 99 )
goto LABEL_4;
}
else
{
v16 = v24;
if ( v15[215] - v15[214] < 100 )
goto LABEL_4;
}
sub_1007FEBF0(v20, v15);
LABEL_4:
v4 = v16 + 1;
v5 = v18 - 1;
if ( v4 >= (unsigned int)sub_1007FEF90(v19) )
return v20;
}
v13 = v10 | 7;
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = v13 + 1;
v12 = (char *)operator new(v14);
__p = v12;
__dst[0] = v14 + 1;
__dst[1] = v11;
v2 = v23;
LABEL_12:
memmove(v12, CString, v11);
goto LABEL_13;
}
return v20;
}