//
// GameLevelManager::cleanupDailyLevels from 0x14014a6e0 to 0x14014a940 (608 bytes)
//
// 2 xrefs:
// > GameLevelManager::encodeDataTo @ 0x14014af6b
// > ??> @ 0x1406ca740
//
// 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
//
// Hidden C++ exception states: #wind=1
void GameLevelManager::cleanupDailyLevels(GameLevelManager *a1)
{
cocos2d::CCArray *v2; // r12
int v3; // r15d
int v4; // ebp
int v5; // r14d
unsigned int i; // esi
unsigned int v7; // eax
cocos2d::CCString *v8; // rax
const char *CString; // rax
const char *v10; // rbx
size_t v11; // r8
__int64 v12; // rdi
void *v13; // rcx
int v14; // eax
size_t v15; // r8
void *v16; // rcx
__int128 v17; // [rsp+20h] [rbp-58h] BYREF
__int64 v18; // [rsp+30h] [rbp-48h]
unsigned __int64 v19; // [rsp+38h] [rbp-40h]
v2 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
v3 = 0;
v4 = 0;
v5 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v2); ++i )
{
v7 = cocos2d::CCArray::count(v2);
v8 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v2, v7 + -1 - i);
CString = cocos2d::CCString::getCString(v8);
v10 = CString;
v17 = 0;
v18 = 0;
v19 = 0;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003A930(&v17, CString, v11);
v12 = cocos2d::CCDictionary::objectForKey(a1->m_dailyLevels, &v17);
if ( v19 > 0xF )
{
v13 = (void *)v17;
if ( v19 + 1 >= 0x1000 )
{
v13 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
v18 = 0;
v19 = 15;
LOBYTE(v17) = 0;
v14 = *(_DWORD *)(v12 + 876) - *(_DWORD *)(v12 + 880);
if ( v14 > 100000 )
{
if ( v14 > 200000 )
{
if ( v14 < v5 )
{
LABEL_16:
*(_WORD *)(v12 + 1072) = 257;
if ( *(_DWORD *)(v12 + 820) - *(_DWORD *)(v12 + 824) <= 0 )
{
v17 = 0;
v18 = 0;
v19 = 0;
v15 = -1;
do
++v15;
while ( v10[v15] );
sub_14003A930(&v17, v10, v15);
cocos2d::CCDictionary::removeObjectForKey(a1->m_dailyLevels, &v17);
if ( v19 > 0xF )
{
v16 = (void *)v17;
if ( v19 + 1 >= 0x1000 )
{
v16 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
}
continue;
}
v5 = *(_DWORD *)(v12 + 876) - *(_DWORD *)(v12 + 880);
}
else
{
if ( v14 < v4 )
goto LABEL_16;
v4 = *(_DWORD *)(v12 + 876) - *(_DWORD *)(v12 + 880);
}
}
else
{
if ( v14 < v3 )
goto LABEL_16;
v3 = *(_DWORD *)(v12 + 876) - *(_DWORD *)(v12 + 880);
}
}
}