//
// EditLevelLayer::verifyLevelName from 0x7ee9f8 to 0x7eed44 (844 bytes)
//
// 5 xrefs:
// > EditLevelLayer::onPlay @ 0x7eef00
// > EditLevelLayer::onEdit @ 0x7ef02c
// > EditLevelLayer::onBack @ 0x7ef134
// > EditLevelLayer::onClone @ 0x7f1a24
// > ??> @ 0x5aef8
//
// 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:34 +0000
//
__int64 __fastcall EditLevelLayer::verifyLevelName(EditLevelLayer *this)
{
__int64 v2; // x0
size_t v3; // x1
size_t v4; // x20
__int64 v5; // x0
size_t v6; // x1
size_t v7; // x20
__int64 v8; // x20
size_t v9; // x1
__int64 *v10; // x0
__int64 v11; // x0
size_t v12; // x1
_BOOL4 v13; // w20
LocalLevelManager *v15; // x0
__int64 v16; // x20
__int64 v17; // x0
size_t v18; // x1
cocos2d::CCArray *AllLevelsWithName; // x21
unsigned int v20; // w19
int v21; // w20
unsigned int v22; // w1
int v23; // w0
__int64 v24; // x20
__int64 *v25; // x0
__int64 v26; // [xsp+40h] [xbp+40h] BYREF
size_t v27; // [xsp+48h] [xbp+48h]
void *v28; // [xsp+50h] [xbp+50h]
v2 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (*(_BYTE *)(v2 + 344) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v2 + 360), *(_QWORD *)(v2 + 352));
}
else
{
v3 = *(_QWORD *)(v2 + 352);
v26 = *(_QWORD *)(v2 + 344);
v27 = v3;
v28 = *(void **)(v2 + 360);
}
v4 = (unsigned __int8)v26 >> 1;
if ( (v26 & 1) != 0 )
{
v4 = v27;
operator delete(v28);
}
if ( !v4 )
{
v5 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (*(_BYTE *)(v5 + 1152) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v5 + 1168), *(_QWORD *)(v5 + 1160));
}
else
{
v6 = *(_QWORD *)(v5 + 1160);
v26 = *(_QWORD *)(v5 + 1152);
v27 = v6;
v28 = *(void **)(v5 + 1168);
}
v7 = (unsigned __int8)v26 >> 1;
if ( (v26 & 1) != 0 )
{
v7 = v27;
operator delete(v28);
}
if ( v7 )
{
v8 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (*(_BYTE *)(v8 + 1152) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v8 + 1168), *(_QWORD *)(v8 + 1160));
}
else
{
v9 = *(_QWORD *)(v8 + 1160);
v26 = *(_QWORD *)(v8 + 1152);
v27 = v9;
v28 = *(void **)(v8 + 1168);
}
v10 = (__int64 *)(v8 + 344);
if ( (__int64 *)(v8 + 344) != &v26 )
{
if ( (v26 & 1) != 0 )
std::string::assign(v10, v28, v27);
else
std::string::assign(v10, (char *)&v26 + 1, (unsigned __int8)v26 >> 1);
}
LABEL_16:
if ( (v26 & 1) == 0 )
goto LABEL_17;
goto LABEL_36;
}
v24 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
std::string::__init(&v26, "Unknown", 7u);
v25 = (__int64 *)(v24 + 344);
if ( (__int64 *)(v24 + 344) == &v26 )
goto LABEL_16;
if ( (v26 & 1) != 0 )
std::string::assign(v25, v28, v27);
else
std::string::assign(v25, (char *)&v26 + 1, (unsigned __int8)v26 >> 1);
if ( (v26 & 1) != 0 )
LABEL_36:
operator delete(v28);
}
LABEL_17:
v11 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (*(_BYTE *)(v11 + 344) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v11 + 360), *(_QWORD *)(v11 + 352));
}
else
{
v12 = *(_QWORD *)(v11 + 352);
v26 = *(_QWORD *)(v11 + 344);
v27 = v12;
v28 = *(void **)(v11 + 360);
}
v13 = sub_7ED2C0((__int64)&v26, (__int64)this + 504);
if ( (v26 & 1) != 0 )
{
operator delete(v28);
if ( v13 )
return _stack_chk_guard;
}
else if ( v13 )
{
return _stack_chk_guard;
}
v15 = *((LocalLevelManager **)this + 59);
*((_DWORD *)v15 + 153) = 0;
v16 = LocalLevelManager::sharedState(v15);
v17 = *((_QWORD *)this + 59);
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (*(_BYTE *)(v17 + 344) & 1) != 0 )
{
std::string::__init(&v26, *(void **)(v17 + 360), *(_QWORD *)(v17 + 352));
}
else
{
v18 = *(_QWORD *)(v17 + 352);
v26 = *(_QWORD *)(v17 + 344);
v27 = v18;
v28 = *(void **)(v17 + 360);
}
AllLevelsWithName = (cocos2d::CCArray *)LocalLevelManager::getAllLevelsWithName(v16, &v26);
if ( (v26 & 1) != 0 )
operator delete(v28);
if ( (unsigned int)cocos2d::CCArray::count(AllLevelsWithName) > 1 )
{
v20 = 0;
v21 = 0;
while ( v20 < (unsigned int)cocos2d::CCArray::count(AllLevelsWithName) )
{
v22 = v20++;
v23 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(AllLevelsWithName, v22) + 612);
if ( v21 < v23 )
v21 = v23;
}
*(_DWORD *)(*((_QWORD *)this + 59) + 612LL) = v21 + 1;
}
return _stack_chk_guard;
}