//
// EditLevelLayer::verifyLevelName from 0x1001e02e0 to 0x1001e0614 (820 bytes)
//
// 4 xrefs:
// > EditLevelLayer::onEdit @ 0x1001de548
// > EditLevelLayer::onPlay @ 0x1001de841
// > EditLevelLayer::onBack @ 0x1001dfb14
// > EditLevelLayer::onClone @ 0x1001e0fd5
//
// This function is hookable on this platform (idp: pc, 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:26:28 +0000
//
void __fastcall EditLevelLayer::verifyLevelName(__int64 a1, __m128 a2)
{
__int64 v3; // rax
__int64 v4; // rax
__int8 v5; // al
__int64 v6; // r14
__int64 v7; // rax
__int64 v8; // rax
__int8 v9; // al
__int64 v10; // r14
void **p_data; // r15
std::string *v12; // rdi
__int64 v13; // r14
__int64 v14; // rax
__int64 v15; // rax
unsigned int v16; // eax
__int8 v17; // r15
void *v18; // r14
size_t v19; // rdx
__int8 *v20; // rdi
size_t v21; // rax
const void *v22; // rsi
bool v23; // zf
char v24; // r12
__int64 v25; // r14
__int64 v26; // rax
__int128 *v27; // rax
__int64 AllLevelsWithName; // r14
unsigned int v29; // r15d
int v30; // r12d
int v31; // r13d
int v32; // r12d
std::string v33; // [rsp+0h] [rbp-90h] BYREF
std::string __str; // [rsp+18h] [rbp-78h] BYREF
__int128 v35; // [rsp+30h] [rbp-60h] BYREF
void *v36; // [rsp+40h] [rbp-50h]
__m128 __s1; // [rsp+50h] [rbp-40h] BYREF
void *__p; // [rsp+60h] [rbp-30h]
v3 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v3 + 344) & 1) != 0 )
{
sub_10001AD30(&__s1, *(const void **)(v3 + 360), *(_QWORD *)(v3 + 352));
v5 = __s1.i8[0];
if ( (__s1.i8[0] & 1) != 0 )
{
LABEL_3:
v6 = __s1.i64[1];
operator delete(__p);
if ( v6 )
goto LABEL_19;
goto LABEL_7;
}
}
else
{
v4 = v3 + 344;
__p = *(void **)(v4 + 16);
a2 = *(__m128 *)v4;
__s1 = *(__m128 *)v4;
v5 = __s1.i8[0];
if ( (__s1.i8[0] & 1) != 0 )
goto LABEL_3;
}
if ( v5 )
goto LABEL_19;
LABEL_7:
v7 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v7 + 1152) & 1) != 0 )
{
sub_10001AD30(&__s1, *(const void **)(v7 + 1168), *(_QWORD *)(v7 + 1160));
v9 = __s1.i8[0];
if ( (__s1.i8[0] & 1) != 0 )
{
LABEL_9:
v10 = __s1.i64[1];
operator delete(__p);
if ( !v10 )
goto LABEL_10;
goto LABEL_14;
}
}
else
{
v8 = v7 + 1152;
__p = *(void **)(v8 + 16);
a2 = *(__m128 *)v8;
__s1 = *(__m128 *)v8;
v9 = __s1.i8[0];
if ( (__s1.i8[0] & 1) != 0 )
goto LABEL_9;
}
if ( !v9 )
{
LABEL_10:
p_data = (void **)&__str.__r_.__value_.__l.__data_;
v12 = (std::string *)(*(_QWORD *)(a1 + 472) + 344LL);
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)14;
strcpy(__str.__r_.__value_.__s.__data_, "Unknown");
std::string::operator=(v12, &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_19;
LABEL_18:
operator delete(*p_data);
goto LABEL_19;
}
LABEL_14:
p_data = (void **)&v33.__r_.__value_.__l.__data_;
v13 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v13 + 1152) & 1) != 0 )
{
sub_10001AD30(&v33, *(const void **)(v13 + 1168), *(_QWORD *)(v13 + 1160));
}
else
{
v33.__r_.__value_.__r.__words[2] = *(_QWORD *)(v13 + 1168);
a2 = *(__m128 *)(v13 + 1152);
*(__m128 *)&v33.__r_.__value_.__l.0 = a2;
}
std::string::operator=((std::string *)(v13 + 344), &v33);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_18;
LABEL_19:
v14 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v14 + 344) & 1) != 0 )
{
sub_10001AD30(&__s1, *(const void **)(v14 + 360), *(_QWORD *)(v14 + 352));
}
else
{
v15 = v14 + 344;
__p = *(void **)(v15 + 16);
a2 = *(__m128 *)v15;
__s1 = *(__m128 *)v15;
}
v16 = *(unsigned __int8 *)(a1 + 504);
v17 = __s1.i8[0];
v18 = __p;
if ( (__s1.i8[0] & 1) != 0 )
{
v19 = __s1.u64[1];
v20 = (__int8 *)__p;
if ( (v16 & 1) == 0 )
{
LABEL_24:
v21 = v16 >> 1;
v22 = (const void *)(a1 + 505);
goto LABEL_27;
}
}
else
{
v19 = __s1.u8[0] >> 1;
v20 = &__s1.i8[1];
if ( (v16 & 1) == 0 )
goto LABEL_24;
}
v21 = *(_QWORD *)(a1 + 512);
v22 = *(const void **)(a1 + 520);
LABEL_27:
v23 = v21 == v19;
if ( v21 < v19 )
v19 = v21;
v24 = v23 & (memcmp(v20, v22, v19) == 0);
if ( (v17 & 1) != 0 )
operator delete(v18);
if ( !v24 )
{
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 612LL) = 0;
v25 = LocalLevelManager::sharedState(*(double *)a2.i64);
v26 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v26 + 344) & 1) != 0 )
{
sub_10001AD30(&v35, *(const void **)(v26 + 360), *(_QWORD *)(v26 + 352));
}
else
{
v27 = (__int128 *)(v26 + 344);
v36 = *((void **)v27 + 2);
v35 = *v27;
}
AllLevelsWithName = LocalLevelManager::getAllLevelsWithName(v25, &v35);
if ( (v35 & 1) != 0 )
operator delete(v36);
if ( (unsigned int)sub_1007FEF90(AllLevelsWithName) >= 2 )
{
if ( (unsigned int)sub_1007FEF90(AllLevelsWithName) )
{
v29 = 0;
v30 = 0;
do
{
v31 = v30;
v30 = *(_DWORD *)(sub_1007FEFE0(AllLevelsWithName, v29) + 612);
if ( v31 > v30 )
v30 = v31;
++v29;
}
while ( v29 < (unsigned int)sub_1007FEF90(AllLevelsWithName) );
v32 = v30 + 1;
}
else
{
v32 = 1;
}
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 612LL) = v32;
}
}
}