//
// GJLevelList::parseListLevels from 0x4c5928 to 0x4c5aec (452 bytes)
//
// 3 xrefs:
// > GJLevelList::create @ 0x4c5e58
// > GameLevelManager::updateSavedLevelList @ 0x4c608a
// > GJLevelList::dataLoaded @ 0x4cea52
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:30 +0000
//
unsigned __int8 *__fastcall GJLevelList::parseListLevels(int a1, unsigned __int8 *a2)
{
unsigned __int8 *result; // r0
int v5; // r2
int v6; // r3
int v7; // r3
int v8; // r3
int v9; // r1
unsigned __int8 *v10; // r5
int v11; // r1
char *v12; // r2
int v13; // r3
int v14; // r5
unsigned __int8 *v15; // r7
unsigned __int8 *first_of; // r0
int v17; // r8
unsigned int v18; // r7
int v19; // r8
const char *v20; // r0
_DWORD *v21; // r7
int v22; // r0
int *v23; // r3
unsigned int v24; // r2
int v25; // r5
unsigned __int8 *v26; // r12
unsigned int v27; // r5
char *v28; // r2
int v29; // r3
unsigned __int8 *v30; // r5
unsigned __int8 *v31; // r0
unsigned __int8 *v32; // [sp+14h] [bp-28h]
int v33; // [sp+18h] [bp-24h] BYREF
int v34; // [sp+1Ch] [bp-20h] BYREF
int v35; // [sp+20h] [bp-1Ch]
char *v36; // [sp+24h] [bp-18h]
int v37[3]; // [sp+28h] [bp-14h] BYREF
result = std::string::operator=((unsigned __int8 *)(a1 + 372), a2);
v5 = *(_DWORD *)(a1 + 264);
while ( 1 )
{
v6 = *(_DWORD *)(a1 + 268);
if ( v5 == v6 )
break;
*(_DWORD *)(a1 + 268) = v6 - 4;
}
v7 = *a2;
if ( (v7 & 1) != 0 )
v8 = *((_DWORD *)a2 + 1);
else
v8 = v7 >> 1;
if ( v8 )
{
v34 = 0;
v35 = 0;
v36 = nullptr;
std::string::__init(&v34, ",", 1u);
v9 = *a2;
if ( (v9 & 1) != 0 )
{
v10 = *((unsigned __int8 **)a2 + 2);
v11 = *((_DWORD *)a2 + 1);
}
else
{
v10 = a2 + 1;
v11 = v9 >> 1;
}
if ( (v34 & 1) != 0 )
{
v12 = v36;
v13 = v35;
}
else
{
v13 = (int)(unsigned __int8)v34 >> 1;
v12 = (char *)&v34 + 1;
}
if ( v11
&& v13
&& (v15 = &v10[v11],
first_of = std::__find_first_of_ce(
v10,
&v10[v11],
(int)v12,
(int)&v12[v13],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v15) )
{
v14 = first_of - v10;
}
else
{
v14 = -1;
}
v17 = *a2;
v18 = 0;
if ( (v17 & 1) != 0 )
v19 = *((_DWORD *)a2 + 1);
else
v19 = v17 >> 1;
while ( 1 )
{
std::string::basic_string(v37, a2, v18, v14 - v18);
if ( (v37[0] & 1) != 0 )
{
if ( !v37[1] && v18 == v19 )
goto LABEL_34;
v20 = (const char *)v37[2];
v21 = (_DWORD *)(a1 + 264);
}
else
{
if ( !(LOBYTE(v37[0]) >> 1) && v18 == v19 )
goto LABEL_34;
v21 = (_DWORD *)(a1 + 264);
v20 = (char *)v37 + 1;
}
v22 = atoi(v20);
v23 = *(int **)(a1 + 268);
v24 = *(_DWORD *)(a1 + 272);
v33 = v22;
if ( (unsigned int)v23 >= v24 )
{
std::vector::__push_back_slow_path(v21, &v33);
}
else
{
if ( v23 )
*v23 = v22;
*(_DWORD *)(a1 + 268) += 4;
}
LABEL_34:
if ( v14 == -1 )
{
std::string::~string((int)v37);
return (unsigned __int8 *)std::string::~string((int)&v34);
}
v18 = v14 + 1;
v25 = *a2;
if ( (v25 & 1) != 0 )
{
v26 = *((unsigned __int8 **)a2 + 2);
v27 = *((_DWORD *)a2 + 1);
}
else
{
v26 = a2 + 1;
v27 = v25 >> 1;
}
if ( (v34 & 1) != 0 )
{
v28 = v36;
v29 = v35;
}
else
{
v29 = (int)(unsigned __int8)v34 >> 1;
v28 = (char *)&v34 + 1;
}
if ( v18 >= v27
|| !v29
|| (v30 = &v26[v27],
v32 = v26,
v31 = std::__find_first_of_ce(
&v26[v18],
v30,
(int)v28,
(int)&v28[v29],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v31 == v30) )
{
v14 = -1;
}
else
{
v14 = v31 - v32;
}
std::string::~string((int)v37);
}
}
return result;
}