//
// LevelBrowserLayer::setupPageInfo from 0x4a5414 to 0x4a56b6 (674 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'LevelBrowserLayer::setupPageInfo @ 0x4a56d0
//
// 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:49:53 +0000
//
LevelBrowserLayer *__fastcall LevelBrowserLayer::setupPageInfo(LevelBrowserLayer *result, int a2, char *a3)
{
int v4; // r4
const char *v5; // r6
size_t v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r9
int v9; // r3
unsigned __int8 *v10; // r2
unsigned __int8 *v11; // r3
unsigned __int8 *v12; // r1
unsigned __int8 *v13; // r5
int v14; // r6
int v15; // r5
int v16; // r7
unsigned int v17; // r6
size_t v18; // r2
unsigned int v19; // r3
std::logic_error *exception; // r4
char *v21; // r1
size_t v22; // r3
char *v23; // r1
char *v24; // r1
size_t v25; // r0
cocos2d::CCObject *v26; // r0
unsigned __int8 *v27; // r2
unsigned int v28; // r3
unsigned __int8 *v29; // r1
unsigned __int8 *v30; // r3
unsigned __int8 *v31; // r5
int v32; // r0
cocos2d::CCString *v33; // r0
cocos2d::CCString *v34; // r0
cocos2d::CCString *v35; // r0
int v36; // r0
int v37; // r1
int v38; // r3
int v39; // r5
int (__fastcall *v40)(int, int); // r6
int v41; // r1
char *v42; // [sp+4h] [bp-30h]
int v43; // [sp+8h] [bp-2Ch] BYREF
unsigned int v44; // [sp+Ch] [bp-28h]
char *v45; // [sp+10h] [bp-24h]
int v46; // [sp+14h] [bp-20h] BYREF
int v47; // [sp+18h] [bp-1Ch]
char *v48; // [sp+1Ch] [bp-18h]
int v49[3]; // [sp+20h] [bp-14h] BYREF
v4 = (int)result;
if ( *((_BYTE *)result + 560) )
return result;
result = (LevelBrowserLayer *)LevelBrowserLayer::isCorrect(result, a3);
if ( !result )
return result;
if ( (*(_BYTE *)a2 & 1) != 0 )
v5 = *(const char **)(a2 + 8);
else
v5 = (const char *)(a2 + 1);
v43 = 0;
v44 = 0;
v45 = nullptr;
v6 = strlen(v5);
v7 = (cocos2d::CCArray *)std::string::__init(&v43, v5, v6);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
if ( (v43 & 1) == 0 )
{
v9 = (int)(unsigned __int8)v43 >> 1;
if ( !v9 )
{
v15 = -1;
goto LABEL_19;
}
v10 = (unsigned __int8 *)&v43 + 1;
LABEL_8:
v11 = &v10[v9];
v12 = v10;
while ( 1 )
{
v13 = v12;
if ( v12 == v11 )
break;
v14 = *v12++;
if ( v14 == 58 )
{
v15 = v13 - v10;
goto LABEL_13;
}
}
v15 = -1;
LABEL_13:
if ( (v43 & 1) != 0 )
goto LABEL_16;
LABEL_19:
v16 = (int)(unsigned __int8)v43 >> 1;
goto LABEL_20;
}
v9 = v44;
v10 = (unsigned __int8 *)v45;
if ( v44 )
goto LABEL_8;
v15 = -1;
LABEL_16:
v16 = v44;
LABEL_20:
v17 = 0;
while ( 1 )
{
v18 = v15 - v17;
v46 = 0;
v47 = 0;
v48 = nullptr;
if ( (v43 & 1) != 0 )
{
v19 = v44;
if ( v17 > v44 )
goto LABEL_25;
v21 = v45;
}
else
{
v19 = (int)(unsigned __int8)v43 >> 1;
if ( v17 > v19 )
{
LABEL_25:
exception = (std::logic_error *)_cxa_allocate_exception(8u);
std::logic_error::logic_error(exception, "basic_string");
*(_DWORD *)exception = &off_D1548C;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::length_error::~length_error);
}
v21 = (char *)&v43 + 1;
}
v22 = v19 - v17;
v23 = &v21[v17];
if ( v18 >= v22 )
v18 = v22;
std::string::__init(&v46, v23, v18);
if ( (v46 & 1) != 0 )
{
if ( v47 || v17 != v16 )
{
v24 = v48;
LABEL_39:
v42 = v24;
memset(v49, 0, sizeof(v49));
v25 = strlen(v24);
std::string::__init(v49, v42, v25);
v26 = (cocos2d::CCObject *)cocos2d::CCString::create(v49);
cocos2d::CCArray::addObject(v8, v26);
std::string::~string((int)v49);
}
}
else if ( (unsigned __int8)v46 >> 1 || v17 != v16 )
{
v24 = (char *)&v46 + 1;
goto LABEL_39;
}
if ( v15 == -1 )
break;
v17 = v15 + 1;
if ( (v43 & 1) != 0 )
{
v27 = (unsigned __int8 *)v45;
v28 = v44;
}
else
{
v28 = (int)(unsigned __int8)v43 >> 1;
v27 = (unsigned __int8 *)&v43 + 1;
}
if ( v17 < v28 )
{
v29 = &v27[v17];
v30 = &v27[v28];
while ( 1 )
{
v31 = v29;
if ( v29 == v30 )
break;
v32 = *v29++;
if ( v32 == 58 )
{
v15 = v31 - v27;
goto LABEL_49;
}
}
}
v15 = -1;
LABEL_49:
std::string::~string((int)&v46);
}
std::string::~string((int)&v46);
std::string::~string((int)&v43);
result = (LevelBrowserLayer *)cocos2d::CCArray::count(v8);
if ( (unsigned int)result > 2 )
{
v33 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 0);
*(_DWORD *)(v4 + 528) = cocos2d::CCString::intValue(v33);
v34 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 1u);
*(_DWORD *)(v4 + 532) = cocos2d::CCString::intValue(v34);
v35 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 2u);
v36 = cocos2d::CCString::intValue(v35);
v37 = *(_DWORD *)(v4 + 532);
*(_DWORD *)(v4 + 536) = v36;
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(v4 + 480) + 172))(*(_DWORD *)(v4 + 480), v37 != 0);
(*(void (__fastcall **)(_DWORD, bool))(**(_DWORD **)(v4 + 476) + 172))(
*(_DWORD *)(v4 + 476),
*(_DWORD *)(v4 + 536) + *(_DWORD *)(v4 + 532) < *(_DWORD *)(v4 + 528));
LevelBrowserLayer::updateLevelsLabel((LevelBrowserLayer *)v4);
v38 = *(_DWORD *)(v4 + 500);
if ( v38 )
*(_DWORD *)(v38 + 312) = *(_DWORD *)(v4 + 528);
v39 = *(_DWORD *)(v4 + 512);
v40 = *(int (__fastcall **)(int, int))(*(_DWORD *)v39 + 172);
v41 = (*(int (__fastcall **)(_DWORD))(**(_DWORD **)(v4 + 476) + 176))(*(_DWORD *)(v4 + 476));
if ( !v41 )
v41 = (*(int (__fastcall **)(_DWORD))(**(_DWORD **)(v4 + 480) + 176))(*(_DWORD *)(v4 + 480));
return (LevelBrowserLayer *)v40(v39, v41);
}
return result;
}