//
// GJLevelList::parseListLevels from 0x10055d230 to 0x10055d6ae (1150 bytes)
//
// 3 xrefs:
// > GJLevelList::create @ 0x100543701
// > GameLevelManager::updateSavedLevelList @ 0x10055b513
// > GJLevelList::dataLoaded @ 0x10059008f
//
// 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:32:07 +0000
//
void __fastcall GJLevelList::parseListLevels(std::string *a1, const std::string *a2)
{
const std::string *v2; // rbx
std::string::__raw *v3; // r14
unsigned int v4; // r13d
std::string::pointer data; // rax
std::string::size_type size; // rcx
char *v7; // rdx
char *v8; // rsi
bool v9; // zf
__int64 v10; // rdx
std::string::size_type v11; // r13
unsigned int v12; // r15d
std::string::size_type v13; // r15
char *v14; // r12
size_t v15; // r15
char *v16; // r13
char v17; // r12
char *v18; // rdi
size_t v19; // r14
int v20; // eax
int *v21; // r15
unsigned __int64 v22; // rcx
__int64 v23; // rbx
_BYTE *v24; // r12
signed __int64 v25; // r15
__int64 v26; // r14
unsigned __int64 v27; // rdx
__int64 v28; // rcx
unsigned __int64 v29; // rbx
_DWORD *v30; // r13
__int64 v31; // r15
__int64 v32; // rdi
unsigned int v33; // eax
unsigned __int64 v34; // rax
_BYTE *v35; // rcx
unsigned int v36; // edx
__int64 v37; // rdx
char *v38; // rsi
_BYTE *v39; // rdi
_BYTE *v40; // rax
__int64 v41; // r9
const std::string *v42; // [rsp+0h] [rbp-A0h]
std::string::size_type v43; // [rsp+8h] [rbp-98h]
unsigned __int8 *v44; // [rsp+10h] [rbp-90h]
__int64 __dst; // [rsp+28h] [rbp-78h] BYREF
size_t v47; // [rsp+30h] [rbp-70h]
char *v48; // [rsp+38h] [rbp-68h]
__int64 v49; // [rsp+40h] [rbp-60h]
char *v50; // [rsp+48h] [rbp-58h]
__int16 v51; // [rsp+50h] [rbp-50h] BYREF
char v52; // [rsp+52h] [rbp-4Eh]
__int64 v53; // [rsp+58h] [rbp-48h]
void *__p; // [rsp+60h] [rbp-40h]
unsigned __int64 v55; // [rsp+68h] [rbp-38h]
char v56; // [rsp+77h] [rbp-29h]
v2 = a2;
v3 = (std::string::__raw *)a1;
std::string::operator=(a1 + 20, a2);
a1[13].__r_.__value_.__r.__words[2] = a1[13].__r_.__value_.__l.__size_;
v4 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v4 & 1) != 0 )
{
if ( !a2->__r_.__value_.__l.__size_ )
return;
v51 = 11266;
v52 = 0;
size = a2->__r_.__value_.__l.__size_;
data = a2->__r_.__value_.__l.__data_;
if ( size )
goto LABEL_4;
}
else
{
if ( !*(_BYTE *)&a2->__r_.__value_.__s.0 )
return;
v51 = 11266;
v52 = 0;
data = a2->__r_.__value_.__s.__data_;
size = v4 >> 1;
if ( v4 >> 1 )
{
LABEL_4:
v7 = &data[size];
v8 = data;
while ( *v8 != HIBYTE(v51) )
{
++v8;
if ( !--size )
{
v8 = v7;
break;
}
}
v9 = v8 == v7;
v10 = -1;
if ( !v9 )
v10 = v8 - data;
if ( (v4 & 1) == 0 )
goto LABEL_11;
LABEL_15:
v11 = v2->__r_.__value_.__l.__size_;
goto LABEL_16;
}
}
v10 = -1;
if ( (v4 & 1) != 0 )
goto LABEL_15;
LABEL_11:
v11 = v4 >> 1;
LABEL_16:
v44 = (unsigned __int8 *)v2->__r_.__value_.__s.__data_;
v55 = 0;
v42 = v2;
v43 = v11;
do
{
v12 = (unsigned int)v2->__r_.__value_.__l.0;
if ( (v12 & 1) != 0 )
{
v13 = v2->__r_.__value_.__l.__size_;
if ( v13 < v55 )
LABEL_76:
sub_100056810();
v14 = v2->__r_.__value_.__l.__data_;
}
else
{
v13 = v12 >> 1;
v14 = (char *)v44;
if ( v55 > v13 )
goto LABEL_76;
}
v15 = v13 - v55;
if ( v15 >= v10 - v55 )
v15 = v10 - v55;
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v49 = v10;
if ( v15 >= 0x17 )
{
v19 = (v15 | 7) + 1;
if ( (v15 | 7) == 0x17 )
v19 = 26;
v16 = (char *)operator new(v19);
v48 = v16;
__dst = v19 | 1;
v47 = v15;
v3 = (std::string::__raw *)a1;
}
else
{
LOBYTE(__dst) = 2 * v15;
v16 = (char *)&__dst + 1;
if ( !v15 )
{
BYTE1(__dst) = 0;
v17 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_29;
goto LABEL_36;
}
}
memmove(v16, &v14[v55], v15);
v16[v15] = 0;
v17 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_29:
v18 = (char *)&__dst + 1;
if ( !v17 && v55 == v43 )
goto LABEL_54;
goto LABEL_39;
}
LABEL_36:
if ( !v47 && v55 == v43 )
goto LABEL_54;
v18 = v48;
LABEL_39:
v20 = atoi(v18);
v21 = (int *)v3[13].__words[2];
v22 = v3[14].__words[0];
if ( (unsigned __int64)v21 >= v22 )
{
v56 = v17;
v24 = (_BYTE *)v3[13].__words[1];
v25 = (char *)v21 - v24;
v26 = v25 >> 2;
v27 = (v25 >> 2) + 1;
if ( v27 > 0x3FFFFFFFFFFFFFFFLL )
sub_100093980();
v28 = v22 - (_QWORD)v24;
v29 = v28 >> 1;
if ( v28 >> 1 <= v27 )
v29 = (v25 >> 2) + 1;
if ( (unsigned __int64)v28 >= 0x7FFFFFFFFFFFFFFCLL )
v29 = 0x3FFFFFFFFFFFFFFFLL;
if ( v29 )
{
LODWORD(v50) = v20;
if ( v29 > 0x3FFFFFFFFFFFFFFFLL )
sub_10001ADB0();
v30 = operator new(4 * v29);
v20 = (int)v50;
}
else
{
v30 = nullptr;
}
v50 = (char *)&v30[v29];
v30[v26] = v20;
v23 = (__int64)&v30[v26 + 1];
memcpy(v30, v24, v25);
v3 = (std::string::__raw *)a1;
a1[13].__r_.__value_.__l.__size_ = (std::string::size_type)v30;
a1[13].__r_.__value_.__r.__words[2] = v23;
a1[14].__r_.__value_.__r.__words[0] = (std::string::size_type)v50;
if ( v24 )
operator delete(v24);
v17 = v56;
}
else
{
*v21 = v20;
v23 = (__int64)(v21 + 1);
}
v3[13].__words[2] = v23;
v2 = v42;
LABEL_54:
v31 = -1;
v32 = v49;
if ( v49 == -1 )
goto LABEL_71;
v33 = (unsigned int)v2->__r_.__value_.__l.0;
if ( (v33 & 1) != 0 )
{
v34 = v2->__r_.__value_.__l.__size_;
v35 = v2->__r_.__value_.__l.__data_;
v36 = (unsigned __int8)v51;
if ( (v51 & 1) == 0 )
{
LABEL_57:
v37 = v36 >> 1;
v38 = (char *)&v51 + 1;
v55 = v49 + 1;
if ( v34 <= v49 + 1 )
goto LABEL_71;
goto LABEL_61;
}
}
else
{
v34 = v33 >> 1;
v35 = v44;
v36 = (unsigned __int8)v51;
if ( (v51 & 1) == 0 )
goto LABEL_57;
}
v38 = (char *)__p;
v37 = v53;
v55 = v49 + 1;
if ( v34 <= v49 + 1 )
goto LABEL_71;
LABEL_61:
if ( v37 )
{
v39 = &v35[v55];
v40 = &v35[v34];
LABEL_63:
v41 = 0;
while ( *v39 != v38[v41] )
{
if ( v37 == ++v41 )
{
if ( ++v39 != v40 )
goto LABEL_63;
v39 = v40;
break;
}
}
v31 = v39 - v35;
if ( v39 == v40 )
v31 = -1;
v32 = v49;
}
LABEL_71:
if ( (v17 & 1) != 0 )
{
operator delete(v48);
v32 = v49;
}
v10 = v31;
}
while ( v32 != -1 );
if ( (v51 & 1) != 0 )
operator delete(__p);
}