//
// GauntletLayer::loadLevelsFinished from 0x91fbd4 to 0x91fdfc (552 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'GauntletLayer::loadLevelsFinished @ 0x91fe00
// > ??> @ 0x97b48
// > ??> @ 0x11ad1f0
//
// 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
//
void GauntletLayer::loadLevelsFinished(GauntletLayer *a1, cocos2d::CCArray *a2, const char *a3, int a4)
{
GameLevelManager *v6; // x0
_DWORD *v7; // x25
unsigned __int64 v8; // x20
unsigned __int64 v9; // x26
size_t v10; // x2
int v11; // w19
__int64 v12; // x20
__int64 *v13; // x0
_DWORD *v14; // x19
char *v15; // x0
unsigned int *v16; // x19
int v17; // w1
unsigned int *v18; // x25
int v19; // w1
unsigned int *v20; // x19
void *v22; // [xsp+78h] [xbp+78h] BYREF
void *v23; // [xsp+80h] [xbp+80h] BYREF
v6 = GameLevelManager::sharedState();
GameLevelManager::getGauntletSearchKey(v6, (const char *)(unsigned int)a1->m_gauntletType, (__int64)&v22);
sub_D153B8((int)&v23, (char *)a3);
v7 = v23;
v8 = *((_QWORD *)v22 - 3);
v9 = *((_QWORD *)v23 - 3);
if ( v9 > v8 )
v10 = *((_QWORD *)v22 - 3);
else
v10 = *((_QWORD *)v23 - 3);
v11 = memcmp(v22, v23, v10);
if ( v11 || (v11 = 0x7FFFFFFF, v12 = v8 - v9, v12 > 0x7FFFFFFF) )
{
v13 = (__int64 *)(v7 - 6);
if ( v7 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
goto LABEL_20;
}
v13 = (__int64 *)(v7 - 6);
if ( v12 >= (__int64)0xFFFFFFFF80000000LL )
v11 = v12;
else
v11 = 0x80000000;
if ( v13 != &qword_124B6B0 )
{
LABEL_20:
if ( &pthread_create )
{
v18 = v7 - 2;
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(v7 - 2);
*(v7 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
LABEL_7:
if ( v11 )
{
v14 = v22;
v15 = (char *)v22 - 24;
if ( (char *)v22 - 24 == (char *)&qword_124B6B0 )
return;
if ( &pthread_create )
{
v20 = (unsigned int *)((char *)v22 - 8);
do
v17 = __ldaxr(v20);
while ( __stlxr(v17 - 1, v20) );
goto LABEL_28;
}
}
else
{
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
GauntletLayer::setupGauntlet(a1, a2);
v14 = v22;
v15 = (char *)v22 - 24;
if ( (char *)v22 - 24 == (char *)&qword_124B6B0 )
return;
if ( &pthread_create )
{
v16 = (unsigned int *)((char *)v22 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
goto LABEL_28;
}
}
v17 = *(v14 - 2);
*(v14 - 2) = v17 - 1;
LABEL_28:
if ( v17 <= 0 )
operator delete(v15);
}