//
// GameLevelManager::cleanupDailyLevels from 0x10054e1e0 to 0x10054e4bb (731 bytes)
//
// 1 xrefs:
// > GameLevelManager::encodeDataTo @ 0x10054f510
//
// 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:32:02 +0000
//
__int64 __fastcall GameLevelManager::cleanupDailyLevels(__int64 a1)
{
__int64 v1; // r14
__int64 v2; // rbx
__int64 result; // rax
__int64 v4; // r15
unsigned int v5; // r12d
int v6; // eax
__int64 v7; // rax
const char *CString; // r12
__int64 v9; // r13
size_t v10; // rax
size_t v11; // r15
char *v12; // rbx
__int64 v13; // rax
size_t v14; // r14
__int64 v15; // r13
int v16; // eax
bool v17; // cc
unsigned int v18; // eax
__int64 v19; // rcx
unsigned int v20; // eax
int v21; // r15d
unsigned int v22; // r12d
__int64 v23; // r13
size_t v24; // rax
size_t v25; // r15
char *v26; // rbx
__int64 v27; // rax
size_t v28; // r14
signed int v29; // [rsp+Ch] [rbp-64h]
signed int v30; // [rsp+10h] [rbp-60h]
signed int v31; // [rsp+14h] [rbp-5Ch]
size_t __dst; // [rsp+18h] [rbp-58h] BYREF
size_t v33; // [rsp+20h] [rbp-50h]
void *__p; // [rsp+28h] [rbp-48h]
__int64 v35; // [rsp+30h] [rbp-40h]
__int64 v36; // [rsp+38h] [rbp-38h]
unsigned int v37; // [rsp+44h] [rbp-2Ch]
v1 = a1;
v2 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 848));
result = sub_1007FEF90(v2);
if ( (_DWORD)result )
{
v29 = 0;
v4 = 0xFFFFFFFFLL;
v30 = 0;
v5 = 0;
v31 = 0;
v36 = v2;
while ( 1 )
{
v37 = v5;
v6 = sub_1007FEF90(v2);
v35 = v4;
v7 = sub_1007FEFE0(v2, (unsigned int)(v6 + v4));
CString = (const char *)cocos2d::CCString::getCString(v7);
v9 = *(_QWORD *)(v1 + 848);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_47:
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
goto LABEL_10;
LABEL_11:
v12[v11] = 0;
v15 = cocos2d::CCDictionary::objectForKey(v9, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v16 = *(_DWORD *)(v15 + 920);
v17 = v16 <= *(_DWORD *)(v15 + 924);
v18 = v16 - *(_DWORD *)(v15 + 924);
if ( v17 )
{
LABEL_21:
if ( (int)v18 >= v29 )
{
v29 = v18;
goto LABEL_27;
}
goto LABEL_22;
}
v19 = 876;
if ( v18 < 0x186A1 )
{
v19 = 864;
}
else if ( v18 >= 0x30D41 )
{
if ( v18 != *(_DWORD *)(v1 + 888) )
goto LABEL_27;
goto LABEL_20;
}
if ( v18 != *(_DWORD *)(v1 + v19) )
goto LABEL_27;
LABEL_20:
if ( v18 <= 0x186A0 )
goto LABEL_21;
if ( v18 > 0x30D40 )
{
if ( (int)v18 >= v31 )
{
v31 = v18;
goto LABEL_27;
}
}
else if ( (int)v18 >= v30 )
{
v30 = v18;
goto LABEL_27;
}
LABEL_22:
*(_WORD *)(v15 + 1104) = 257;
if ( *(_DWORD *)(v15 + 864) <= *(_DWORD *)(v15 + 868) )
{
v20 = *(unsigned __int8 *)(v15 + 1472);
if ( (v20 & 1) != 0 )
{
if ( !*(_QWORD *)(v15 + 1480) )
{
LABEL_34:
v23 = *(_QWORD *)(v1 + 848);
v24 = strlen(CString);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_47;
v25 = v24;
if ( v24 >= 0x17 )
{
v27 = v24 | 7;
v28 = 26;
if ( (v25 | 7) != 0x17 )
v28 = v27 + 1;
v26 = (char *)operator new(v28);
__p = v26;
__dst = v28 + 1;
v33 = v25;
v1 = a1;
}
else
{
LOBYTE(__dst) = 2 * v24;
v26 = (char *)&__dst + 1;
if ( !v24 )
{
LABEL_44:
v26[v25] = 0;
cocos2d::CCDictionary::removeObjectForKey(v23, (char *)&__dst);
v2 = v36;
v21 = v35;
v22 = v37;
if ( (__dst & 1) != 0 )
operator delete(__p);
goto LABEL_28;
}
}
memmove(v26, CString, v25);
goto LABEL_44;
}
}
else if ( !(v20 >> 1) )
{
goto LABEL_34;
}
}
LABEL_27:
v2 = v36;
v21 = v35;
v22 = v37;
LABEL_28:
v5 = v22 + 1;
result = sub_1007FEF90(v2);
v4 = (unsigned int)(v21 - 1);
if ( v5 >= (unsigned int)result )
return result;
}
v13 = v10 | 7;
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = v13 + 1;
v12 = (char *)operator new(v14);
__p = v12;
__dst = v14 + 1;
v33 = v11;
v1 = a1;
LABEL_10:
memmove(v12, CString, v11);
goto LABEL_11;
}
return result;
}