//
// GJLevelList::parseListLevels from 0x81bbb8 to 0x81bf48 (912 bytes)
//
// 4 xrefs:
// > GJLevelList::create @ 0x81c3fc
// > GameLevelManager::updateSavedLevelList @ 0x81c8f8
// > GJLevelList::dataLoaded @ 0x842ef0
// > ??> @ 0xec230
//
// This function is hookable on this platform (idp: arm, 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:54:58 +0000
//
__int64 __fastcall GJLevelList::parseListLevels(_QWORD *a1, __int64 a2)
{
__int64 *v3; // x0
__int64 v5; // x2
__int64 v6; // x1
unsigned __int8 v8; // w24
unsigned __int8 v9; // w21
__int64 v10; // x0
__int64 v11; // x3
unsigned __int8 *v12; // x2
__int64 v13; // x21
__int64 v14; // x27
__int64 v15; // x24
unsigned __int64 v16; // x20
int v17; // w28
const char *v18; // x0
void **v19; // x20
int v20; // w0
int *v21; // x1
__int64 v22; // x27
unsigned __int64 v23; // x4
unsigned __int8 *v24; // x5
__int64 v25; // x1
unsigned __int8 *v26; // x6
unsigned __int8 *v27; // x4
unsigned __int8 *v28; // x1
int v29; // w3
unsigned __int8 *v30; // x0
unsigned __int8 *v31; // x3
unsigned __int8 *v32; // x21
unsigned __int8 *v33; // x27
int v34; // w1
unsigned __int8 *v35; // x20
int v36; // [xsp+64h] [xbp+64h] BYREF
__int64 v37; // [xsp+68h] [xbp+68h] BYREF
__int64 v38; // [xsp+70h] [xbp+70h]
void *v39; // [xsp+78h] [xbp+78h]
__int64 v40[2]; // [xsp+80h] [xbp+80h] BYREF
void *v41; // [xsp+90h] [xbp+90h]
v3 = a1 + 60;
if ( v3 != (__int64 *)a2 )
{
if ( (*(_BYTE *)a2 & 1) != 0 )
std::string::assign(v3, *(const void **)(a2 + 16), *(_QWORD *)(a2 + 8));
else
std::string::assign(v3, (const void *)(a2 + 1), *(_BYTE *)a2 >> 1);
}
v5 = a1[40];
v6 = a1[41];
if ( v5 != v6 )
a1[41] = v6 + 4 * ~((unsigned __int64)(v6 - 4 - v5) >> 2);
if ( (*(_BYTE *)a2 & 1) != 0 )
{
if ( !*(_QWORD *)(a2 + 8) )
return _stack_chk_guard;
}
else if ( !(*(_BYTE *)a2 >> 1) )
{
return _stack_chk_guard;
}
v37 = 0;
v38 = 0;
v39 = nullptr;
std::string::__init(&v37, &byte_1169BE0, 1u);
v8 = *(_BYTE *)a2;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
v9 = v37;
v10 = *(_QWORD *)(a2 + 16);
v11 = *(_QWORD *)(a2 + 8);
if ( (v37 & 1) != 0 )
goto LABEL_12;
LABEL_39:
v13 = v9 >> 1;
v12 = (unsigned __int8 *)&v37 + 1;
goto LABEL_13;
}
v9 = v37;
v10 = a2 + 1;
v11 = v8 >> 1;
if ( (v37 & 1) == 0 )
goto LABEL_39;
LABEL_12:
v12 = (unsigned __int8 *)v39;
v13 = v38;
LABEL_13:
if ( !v13
|| !v11
|| (v31 = (unsigned __int8 *)(v10 + v11),
v32 = &v12[v13],
v33 = (unsigned __int8 *)v10,
v31 == (unsigned __int8 *)v10) )
{
LABEL_15:
v14 = -1;
goto LABEL_16;
}
while ( v32 == v12 )
{
LABEL_54:
if ( v31 == ++v33 )
goto LABEL_15;
}
v34 = *v33;
if ( *v12 != v34 )
{
v35 = v12;
while ( v32 != ++v35 )
{
if ( *v35 == v34 )
goto LABEL_68;
}
goto LABEL_54;
}
LABEL_68:
v14 = (__int64)&v33[-v10];
LABEL_16:
v15 = v8 >> 1;
if ( (*(_BYTE *)a2 & 1) != 0 )
v15 = *(_QWORD *)(a2 + 8);
v16 = 0;
while ( 2 )
{
std::string::basic_string(v40, a2, v16, v14 - v16);
v17 = v40[0] & 1;
if ( v17 )
{
if ( v16 != v15 || v40[1] )
{
v18 = (const char *)v41;
v19 = (void **)(a1 + 40);
goto LABEL_23;
}
v17 = 1;
LABEL_27:
if ( v14 == -1 )
break;
goto LABEL_28;
}
if ( v16 == v15 && !((int)LOBYTE(v40[0]) >> 1) )
goto LABEL_27;
v19 = (void **)(a1 + 40);
v18 = (char *)v40 + 1;
LABEL_23:
v20 = atoi(v18);
v36 = v20;
v21 = (int *)v19[1];
if ( (unsigned __int64)v21 < a1[42] )
{
if ( v21 )
{
*v21 = v20;
v21 = (int *)v19[1];
v17 = v40[0] & 1;
}
v19[1] = v21 + 1;
goto LABEL_27;
}
std::vector::__push_back_slow_path(v19, &v36);
v17 = v40[0] & 1;
if ( v14 != -1 )
{
LABEL_28:
v16 = v14 + 1;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
v22 = *(_QWORD *)(a2 + 16);
v23 = *(_QWORD *)(a2 + 8);
}
else
{
v22 = a2 + 1;
v23 = *(_BYTE *)a2 >> 1;
}
if ( (v37 & 1) != 0 )
{
v24 = (unsigned __int8 *)v39;
v25 = v38;
}
else
{
v25 = (unsigned __int8)v37 >> 1;
v24 = (unsigned __int8 *)&v37 + 1;
}
if ( v25 )
{
if ( v16 < v23 )
{
v26 = (unsigned __int8 *)(v22 + v16);
v27 = (unsigned __int8 *)(v22 + v23);
v28 = &v24[v25];
if ( (unsigned __int8 *)(v22 + v16) != v27 )
{
while ( 1 )
{
if ( v28 != v24 )
{
v29 = *v26;
if ( *v24 == v29 )
{
LABEL_61:
v14 = (__int64)&v26[-v22];
goto LABEL_35;
}
v30 = v24;
while ( v28 != ++v30 )
{
if ( *v30 == v29 )
goto LABEL_61;
}
}
if ( v27 == ++v26 )
{
v14 = -1;
goto LABEL_35;
}
}
}
}
}
v14 = -1;
LABEL_35:
if ( v17 )
operator delete(v41);
continue;
}
break;
}
if ( v17 )
operator delete(v41);
if ( (v37 & 1) != 0 )
operator delete(v39);
return _stack_chk_guard;
}