//
// LevelListLayer::cloneList from 0xbb0ce8 to 0xbb0f40 (600 bytes)
//
// 2 xrefs:
// > LevelListLayer::FLAlert_Clicked @ 0xbb0fb8
// > ??> @ 0x8a580
//
// 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 13:02:55 +0000
//
__int64 __fastcall LevelListLayer::cloneList(LevelListLayer *this)
{
GameManager *v3; // x0
GameLevelManager *v4; // x0
GameLevelManager *v5; // x0
__int64 NewLevelList; // x21
__int64 v7; // x1
__int64 v8; // x3
unsigned __int8 v9; // w2
const void *v10; // x1
size_t v11; // x2
__int64 v12; // x0
__int64 v13; // x2
__int64 v14; // x0
unsigned __int64 v15; // x1
char *v16; // x1
size_t v17; // x2
__int64 v18; // x1
cocos2d::CCDirector *v19; // x0
cocos2d::CCDirector *v20; // x20
GJLevelList *v21; // x1
AppDelegate *v22; // x0
cocos2d::CCScene *v23; // x1
cocos2d::CCScene *v24; // x0
size_t v25; // x2
__int64 v26; // [xsp+38h] [xbp+38h] BYREF
unsigned __int64 v27; // [xsp+40h] [xbp+40h]
void *v28; // [xsp+48h] [xbp+48h]
__int64 v29; // [xsp+50h] [xbp+50h] BYREF
size_t v30; // [xsp+58h] [xbp+58h]
void *v31; // [xsp+60h] [xbp+60h]
if ( *((_BYTE *)this + 952) )
return _stack_chk_guard;
v3 = (GameManager *)(*(__int64 (__fastcall **)(LevelListLayer *))(*(_QWORD *)this + 1072LL))(this);
*((_BYTE *)this + 952) = 1;
v4 = (GameLevelManager *)GameManager::sharedState(v3);
*((_DWORD *)v4 + 177) = 14;
v5 = (GameLevelManager *)GameLevelManager::sharedState(v4);
NewLevelList = GameLevelManager::createNewLevelList(v5);
*(_BYTE *)(GameLevelManager::sharedState((GameLevelManager *)NewLevelList) + 1216) = 1;
*(_DWORD *)(NewLevelList + 360) = *(_DWORD *)(*((_QWORD *)this + 114) + 360LL);
v7 = *((_QWORD *)this + 114);
v8 = v7 + 504;
if ( NewLevelList + 504 != v7 + 504 )
{
v9 = *(_BYTE *)(v7 + 504);
if ( (v9 & 1) != 0 )
{
v10 = *(const void **)(v7 + 520);
v11 = *(_QWORD *)(v8 + 8);
}
else
{
v10 = (const void *)(v7 + 505);
v11 = v9 >> 1;
}
std::string::assign((__int64 *)(NewLevelList + 504), v10, v11);
v7 = *((_QWORD *)this + 114);
}
GJLevelList::duplicateListLevels((GJLevelList *)NewLevelList, (GJLevelList *)v7);
v26 = 0;
v12 = *((_QWORD *)this + 114);
v27 = 0;
v13 = v12 + 432;
v28 = nullptr;
if ( (*(_BYTE *)(v12 + 432) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v12 + 448), *(_QWORD *)(v12 + 440));
}
else
{
v14 = *(_QWORD *)v13;
v15 = *(_QWORD *)(v13 + 8);
v28 = *(void **)(v13 + 16);
v26 = v14;
v27 = v15;
}
if ( (v26 & 1) != 0 )
{
v25 = v27;
if ( v27 > 0x17 )
{
v29 = 0;
v30 = 0;
v31 = nullptr;
goto LABEL_24;
}
LABEL_28:
std::string::append((__int64)&v26, " 2", 2u);
v29 = 0;
v30 = 0;
v31 = nullptr;
if ( (v26 & 1) == 0 )
goto LABEL_11;
v25 = v27;
LABEL_24:
std::string::__init(&v29, v28, v25);
goto LABEL_12;
}
if ( (unsigned __int8)v26 <= 0x2Fu )
goto LABEL_28;
LABEL_11:
v31 = v28;
v29 = v26;
v30 = v27;
LABEL_12:
if ( (__int64 *)(NewLevelList + 432) != &v29 )
{
if ( (v29 & 1) != 0 )
{
v16 = (char *)v31;
v17 = v30;
}
else
{
v17 = (unsigned __int8)v29 >> 1;
v16 = (char *)&v29 + 1;
}
std::string::assign((__int64 *)(NewLevelList + 432), v16, v17);
}
if ( (v29 & 1) != 0 )
operator delete(v31);
v18 = *((_QWORD *)this + 114);
v19 = (cocos2d::CCDirector *)*(unsigned int *)(v18 + 380);
if ( !(_DWORD)v19 )
v19 = (cocos2d::CCDirector *)*(unsigned int *)(v18 + 344);
*(_DWORD *)(NewLevelList + 380) = (_DWORD)v19;
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
v22 = LevelListLayer::scene((LevelListLayer *)NewLevelList, v21);
v24 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v22, 0.5, v23);
cocos2d::CCDirector::replaceScene(v20, v24);
if ( (v26 & 1) != 0 )
operator delete(v28);
return _stack_chk_guard;
}