//
// GameLevelManager::createNewLevelList from 0x10053f140 to 0x10053f4d0 (912 bytes)
//
// 4 xrefs:
// > LevelListLayer::cloneList @ 0x10034b6b4
// > LevelBrowserLayer::createNewList @ 0x100487506
// > LevelBrowserLayer::shareCommentClosed @ 0x100487601
// > sub_100487650 @ 0x100487679
//
// 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:56 +0000
//
__int64 GameLevelManager::createNewLevelList()
{
__int64 v0; // rbx
__int64 v1; // rax
std::string::pointer data; // rdi
std::string *v3; // r12
__int64 v4; // rax
double v5; // xmm0_8
__int64 v6; // rax
unsigned int *v7; // rax
__int64 *v8; // rbx
unsigned __int64 v9; // r15
__int64 v10; // rdx
unsigned int v11; // eax
int v12; // r14d
const std::string::value_type *v13; // rsi
std::string::size_type v14; // rdx
__int64 **v15; // rbx
std::string::size_type size; // r13
std::string::pointer v17; // r15
unsigned int v18; // r12d
size_t v19; // r12
__int64 *v20; // rsi
size_t v21; // r14
int v22; // eax
bool v23; // cl
int v24; // eax
bool v25; // cl
char v26; // bl
__int64 v27; // rax
__int64 v28; // rbx
char *v30; // [rsp+10h] [rbp-D0h]
std::string *v31; // [rsp+18h] [rbp-C8h]
std::string __str; // [rsp+20h] [rbp-C0h] BYREF
std::string v33; // [rsp+40h] [rbp-A0h] BYREF
__int128 *v34; // [rsp+58h] [rbp-88h] BYREF
__int128 v35; // [rsp+60h] [rbp-80h] BYREF
size_t v36[2]; // [rsp+70h] [rbp-70h] BYREF
void *__p; // [rsp+80h] [rbp-60h]
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 v38; // [rsp+88h] [rbp-58h]
__int64 v39; // [rsp+90h] [rbp-50h]
std::string v40; // [rsp+98h] [rbp-48h] BYREF
unsigned int v41; // [rsp+B4h] [rbp-2Ch]
v0 = GJLevelList::create_1();
*(_DWORD *)(v0 + 544) = 2;
*(_BYTE *)(v0 + 392) = 1;
v1 = GameManager::sharedState();
if ( (*(_BYTE *)(v1 + 632) & 1) != 0 )
sub_10001AD30(&__str, *(const void **)(v1 + 648), *(_QWORD *)(v1 + 640));
else
__str = *(std::string *)(v1 + 632);
data = (std::string::pointer)(v0 + 408);
std::string::operator=((std::string *)(v0 + 408), &__str);
v39 = v0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
data = __str.__r_.__value_.__l.__data_;
operator delete(__str.__r_.__value_.__l.__data_);
}
v3 = (std::string *)v0;
v4 = GJAccountManager::sharedState((__int64)data, (__int64)&__str);
*(_DWORD *)(v39 + 364) = *(_DWORD *)(v4 + 352) - *(_DWORD *)(v4 + 356);
v5 = 0.0;
v35 = 0;
v34 = &v35;
v6 = *(_QWORD *)(LocalLevelManager::sharedState(0.0) + 368);
if ( v6 )
{
v7 = *(unsigned int **)(v6 + 56);
if ( *v7 )
{
v8 = *((__int64 **)v7 + 2);
v9 = (unsigned __int64)&v8[*v7 - 1];
while ( 1 )
{
v10 = *v8;
if ( !*v8 )
goto LABEL_16;
v11 = *(unsigned __int8 *)(v10 + 432);
if ( (v11 & 1) == 0 )
break;
if ( *(_QWORD *)(v10 + 440) )
goto LABEL_10;
LABEL_11:
if ( (unsigned __int64)++v8 > v9 )
goto LABEL_16;
}
if ( !(v11 >> 1) )
goto LABEL_11;
LABEL_10:
sub_1005913C0(&v34, v10 + 432);
goto LABEL_11;
}
}
LABEL_16:
v12 = 0;
v31 = v3 + 19;
while ( 2 )
{
v40.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)16;
strcpy(v40.__r_.__value_.__s.__data_, "Unnamed ");
GameToolbox::intToString(v36, v12);
if ( (v36[0] & 1) != 0 )
{
v13 = (const std::string::value_type *)__p;
v14 = v36[1];
}
else
{
v14 = LOBYTE(v36[0]) >> 1;
v13 = (char *)v36 + 1;
}
v41 = v12;
std::string::append(&v40, v13, v14);
if ( (v36[0] & 1) != 0 )
operator delete(__p);
v15 = (__int64 **)v35;
v38 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&v40.__r_.__value_.__l.0;
if ( !(_QWORD)v35 )
{
LABEL_42:
if ( (*(_BYTE *)&v38 & 1) != 0 )
{
sub_10001AD30(&v33, v40.__r_.__value_.__l.__data_, v40.__r_.__value_.__l.__size_);
}
else
{
v33 = v40;
v5 = *(double *)v40.__r_.__value_.__r.__words;
}
std::string::operator=(v31, &v33);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33.__r_.__value_.__l.__data_);
v26 = 0;
goto LABEL_48;
}
if ( (*(_BYTE *)&v38 & 1) != 0 )
{
v17 = v40.__r_.__value_.__l.__data_;
size = v40.__r_.__value_.__l.__size_;
}
else
{
size = *(_DWORD *)&v38 >> 1;
v17 = v40.__r_.__value_.__s.__data_;
}
v30 = v17;
while ( 1 )
{
v18 = *((unsigned __int8 *)v15 + 32);
if ( (v18 & 1) != 0 )
{
v19 = (size_t)v15[5];
v20 = v15[6];
}
else
{
v19 = v18 >> 1;
v20 = (__int64 *)((char *)v15 + 33);
}
v21 = size;
if ( v19 < size )
v21 = v19;
v22 = memcmp(v17, v20, v21);
v23 = size < v19;
if ( v22 )
v23 = v22 < 0;
if ( v23 )
goto LABEL_28;
v24 = memcmp(v20, v17, v21);
v25 = v19 < size;
if ( v24 )
v25 = v24 < 0;
if ( !v25 )
break;
++v15;
LABEL_28:
v15 = (__int64 **)*v15;
v17 = v30;
if ( !v15 )
goto LABEL_42;
}
v26 = 1;
if ( v41 >= 0x3E7 )
goto LABEL_42;
LABEL_48:
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v40.__r_.__value_.__l.__data_);
v12 = v41 + 1;
if ( v26 )
continue;
break;
}
v27 = LocalLevelManager::sharedState(v5);
v28 = v39;
sub_1007FF110(*(_QWORD *)(v27 + 368), v39, 0);
sub_1001EAE60((__int64)&v34, (_QWORD *)v35);
return v28;
}