//
// GameLevelManager::createAndGetLevelLists from 0x100531650 to 0x10053188a (570 bytes)
//
// 1 xrefs:
// > GameLevelManager::onGetLevelListsCompleted @ 0x10052a909
//
// 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
//
__int64 __fastcall GameLevelManager::createAndGetLevelLists(__int64 a1, __int64 a2, double a3)
{
const char *v3; // r14
size_t v4; // rax
size_t v5; // rbx
char *v6; // r15
size_t v7; // r12
__int64 v8; // r14
unsigned int v9; // r15d
cocos2d::CCString *v10; // rax
const char *CString; // rbx
size_t v12; // rax
size_t v13; // r13
char *v14; // r12
char v15; // r14
__int64 v16; // rax
size_t v17; // r14
cocos2d::CCDictionary *v18; // rax
GJLevelList *v19; // rbx
__int64 v21; // [rsp+8h] [rbp-68h]
__int128 v22; // [rsp+10h] [rbp-60h] BYREF
void *v23; // [rsp+20h] [rbp-50h]
__int64 v24; // [rsp+28h] [rbp-48h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
v24 = sub_10071F9E0(a1, a2);
if ( (*(_BYTE *)a2 & 1) != 0 )
v3 = *(const char **)(a2 + 16);
else
v3 = (const char *)(a2 + 1);
v4 = strlen(v3);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_34:
sub_100006BF0(a3);
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
__p = v6;
*(_QWORD *)&__dst = v7 + 1;
*((_QWORD *)&__dst + 1) = v5;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v4;
v6 = (char *)&__dst + 1;
if ( v4 )
LABEL_11:
memmove(v6, v3, v5);
v6[v5] = 0;
v8 = sub_10052DD30((unsigned __int8 *)&__dst, "|", a3);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_100720070(v8) )
{
v9 = 0;
v21 = v8;
do
{
v10 = (cocos2d::CCString *)sub_1007200C0(v8, v9);
CString = cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_34;
v13 = v12;
if ( v12 >= 0x17 )
{
v16 = v12 | 7;
v17 = 26;
if ( (v13 | 7) != 0x17 )
v17 = v16 + 1;
v14 = (char *)operator new(v17);
__p = v14;
*(_QWORD *)&__dst = v17 + 1;
*((_QWORD *)&__dst + 1) = v13;
}
else
{
LOBYTE(__dst) = 2 * v12;
v14 = (char *)&__dst + 1;
if ( !v12 )
{
BYTE1(__dst) = 0;
v15 = __dst;
if ( (__dst & 1) != 0 )
goto LABEL_26;
goto LABEL_21;
}
}
memmove(v14, CString, v13);
v14[v13] = 0;
v15 = __dst;
if ( (__dst & 1) != 0 )
{
LABEL_26:
sub_100006B70(&v22, __p, *((unsigned __int64 *)&__dst + 1), a3);
goto LABEL_27;
}
LABEL_21:
v23 = __p;
a3 = *(double *)&__dst;
v22 = __dst;
LABEL_27:
v18 = GameLevelManager::responseToDict((__int64)&v22, 0, a3);
v19 = GJLevelList::create(v18);
if ( (v22 & 1) != 0 )
operator delete(v23);
if ( v19 )
sub_10071FCD0(v24, v19);
if ( (v15 & 1) != 0 )
operator delete(__p);
++v9;
v8 = v21;
}
while ( v9 < (unsigned int)sub_100720070(v21) );
}
return v24;
}