//
// GameStatsManager::uncompleteLevel from 0x100033b70 to 0x100033e0c (668 bytes)
//
// 1 xrefs:
// > GameLevelManager::verifyLevelState @ 0x1005407cb
//
// 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:19:31 +0000
//
void __fastcall GameStatsManager::uncompleteLevel(__int64 a1, _DWORD *a2)
{
_DWORD *v2; // r14
__int64 v3; // r15
int v4; // eax
bool v5; // of
int v6; // eax
__int64 v7; // rax
char *v8; // rdi
const char *CString; // r12
size_t v10; // rax
size_t v11; // r13
char *v12; // rbx
size_t v13; // r15
char *v14; // rdi
__int64 v15; // rax
const char *v16; // r14
__int64 v17; // rbx
size_t v18; // rax
size_t v19; // r15
char *v20; // r12
size_t v21; // r13
char v22; // [rsp+0h] [rbp-70h]
char v23; // [rsp+0h] [rbp-70h]
size_t v24[3]; // [rsp+8h] [rbp-68h] BYREF
__int64 v25; // [rsp+20h] [rbp-50h]
__int64 v26; // [rsp+28h] [rbp-48h]
__int64 __dst; // [rsp+30h] [rbp-40h] BYREF
size_t v28; // [rsp+38h] [rbp-38h]
void *__p; // [rsp+40h] [rbp-30h]
v2 = a2;
v3 = a1;
v4 = a2[230];
v5 = __OFSUB__(v4, a2[231]);
v6 = v4 - a2[231];
LOBYTE(a2) = v6 <= 0 && a2[285] != 1;
GameStatsManager::getLevelKey(
v24,
(__int64)a2,
v2[82] - v2[83],
(unsigned __int8)a2,
!((v6 < 0) ^ v5 | (v6 == 0)),
*((unsigned __int8 *)v2 + 649),
v6 >= 200001);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 608), v24);
if ( v2[230] <= v2[231] )
{
v8 = "star_%i";
if ( *((_BYTE *)v2 + 649) )
v8 = "gstar_%i";
v7 = sub_10088E820(v8, v22);
}
else
{
v7 = sub_10088E820("%s%i", v22);
}
CString = (const char *)cocos2d::CCString::getCString(v7);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
v25 = *(_QWORD *)(v3 + 608);
if ( v10 >= 0x17 )
{
v26 = v3;
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
__p = v12;
__dst = v13 | 1;
v28 = v11;
v3 = v26;
goto LABEL_13;
}
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
LABEL_13:
memmove(v12, CString, v11);
v12[v11] = 0;
cocos2d::CCDictionary::removeObjectForKey(v25, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v2[230] <= v2[231] )
{
v14 = "demon_%i";
if ( *((_BYTE *)v2 + 649) )
v14 = "gdemon_%i";
}
else
{
v14 = "ddemon_%i";
}
v15 = sub_10088E820(v14, v23);
v16 = (const char *)cocos2d::CCString::getCString(v15);
v17 = *(_QWORD *)(v3 + 608);
v18 = strlen(v16);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
__p = v20;
__dst = v21 | 1;
v28 = v19;
goto LABEL_27;
}
LOBYTE(__dst) = 2 * v18;
v20 = (char *)&__dst + 1;
if ( v18 )
LABEL_27:
memmove(v20, v16, v19);
v20[v19] = 0;
cocos2d::CCDictionary::removeObjectForKey(v17, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (v24[0] & 1) != 0 )
operator delete((void *)v24[2]);
}