//
// GJLevelList::hasMatchingLevels from 0x100561d30 to 0x100561ebc (396 bytes)
//
// 2 xrefs:
// > LocalLevelManager::dataLoaded @ 0x1005f87f1
// > LocalLevelManager::dataLoaded @ 0x1005f888c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall GJLevelList::hasMatchingLevels(GJLevelList *a1)
{
__int64 v1; // rsi
std::__vector_base::pointer begin; // r15
std::__vector_base::pointer end; // r8
__int64 v4; // rax
__int64 v5; // rcx
int v6; // ebx
_QWORD *v7; // r13
_QWORD *v8; // r12
__int64 v9; // rax
int v10; // eax
_DWORD *v11; // rax
bool v12; // bl
int *v13; // rax
int *v14; // rcx
_QWORD *v15; // rsi
int v16; // edx
__int64 *v17; // rdi
int v18; // r8d
int *v20; // [rsp+0h] [rbp-50h]
_QWORD *v21; // [rsp+10h] [rbp-40h] BYREF
_OWORD v22[3]; // [rsp+18h] [rbp-38h] BYREF
begin = a1->m_levels.__begin_;
end = a1->m_levels.__end_;
v4 = *(_QWORD *)(v1 + 320);
v5 = *(_QWORD *)(v1 + 328);
if ( (char *)end - (char *)begin != v5 - v4 )
return 0;
v22[0] = 0;
v21 = v22;
if ( begin == end )
{
v12 = v4 == v5;
v15 = nullptr;
goto LABEL_28;
}
v20 = end;
do
{
v6 = *begin;
v7 = v22;
v8 = v22;
if ( *(_QWORD *)&v22[0] )
{
v9 = *(_QWORD *)&v22[0];
while ( 1 )
{
while ( 1 )
{
v7 = (_QWORD *)v9;
v10 = *(_DWORD *)(v9 + 28);
if ( v6 >= v10 )
break;
v9 = *v7;
v8 = v7;
if ( !*v7 )
goto LABEL_13;
}
if ( v6 <= v10 )
break;
v9 = v7[1];
if ( !v9 )
{
v8 = v7 + 1;
goto LABEL_13;
}
}
}
else
{
LABEL_13:
v11 = operator new(0x20u);
v11[7] = v6;
*(_OWORD *)v11 = 0;
*((_QWORD *)v11 + 2) = v7;
*v8 = v11;
if ( *v21 )
v21 = (_QWORD *)*v21;
sub_100054DD0(*(__int64 **)&v22[0], (__int64 *)v11);
++*((_QWORD *)&v22[0] + 1);
}
++begin;
}
while ( begin != v20 );
v13 = *(int **)(v1 + 320);
v14 = *(int **)(v1 + 328);
v15 = *(_QWORD **)&v22[0];
v12 = 1;
if ( v13 == v14 )
goto LABEL_28;
if ( *(_QWORD *)&v22[0] )
{
LABEL_18:
v16 = *v13;
v17 = *(__int64 **)&v22[0];
while ( 1 )
{
v18 = *((_DWORD *)v17 + 7);
if ( v16 >= v18 )
{
if ( v16 <= v18 )
{
if ( ++v13 == v14 )
goto LABEL_28;
goto LABEL_18;
}
++v17;
}
v17 = (__int64 *)*v17;
if ( !v17 )
goto LABEL_27;
}
}
v15 = nullptr;
LABEL_27:
v12 = 0;
LABEL_28:
sub_100054D90((__int64)&v21, v15);
return v12;
}