//
// GameLevelManager::getCompletedEventLevels from 0x100548c20 to 0x100548e0f (495 bytes)
//
// 2 xrefs:
// > GameLevelManager::updateUserScore @ 0x100563b30
// > GameLevelManager::updateUserScore @ 0x100563dc0
//
// 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:00 +0000
//
__int64 __fastcall GameLevelManager::getCompletedEventLevels(__int64 a1, int a2, int a3)
{
__int64 v3; // r15
__int64 v4; // rax
unsigned int *v5; // rax
_QWORD *v6; // r13
_QWORD *v7; // r12
__int64 v8; // rbx
const char *CString; // r14
size_t v10; // rax
size_t v11; // rbx
char *v12; // r12
size_t v13; // r15
const void *v14; // rax
_DWORD *v15; // rbx
int v16; // eax
__int64 v17; // rax
bool hasCompletedLevel; // al
__int64 v20; // [rsp+8h] [rbp-68h]
_QWORD *v21; // [rsp+10h] [rbp-60h]
_QWORD __dst[2]; // [rsp+20h] [rbp-50h] BYREF
void *__p; // [rsp+30h] [rbp-40h]
int v24; // [rsp+38h] [rbp-38h]
int v25; // [rsp+3Ch] [rbp-34h]
__int64 v26; // [rsp+40h] [rbp-30h]
v24 = a3;
v25 = a2;
v3 = a1;
v4 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 848));
v26 = 0;
if ( v4 )
{
v5 = *(unsigned int **)(v4 + 56);
if ( *v5 )
{
v6 = *((_QWORD **)v5 + 2);
v7 = &v6[*v5 - 1];
v26 = 0;
v21 = v7;
while ( 1 )
{
v8 = *v6;
if ( !*v6 )
return v26;
if ( (int)cocos2d::CCString::intValue(*v6) >= 200001 )
break;
LABEL_4:
if ( ++v6 > v7 )
return v26;
}
v20 = *(_QWORD *)(v3 + 848);
CString = (const char *)cocos2d::CCString::getCString(v8);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = (v10 | 7) + 1;
if ( (v10 | 7) == 0x17 )
v13 = 26;
v12 = (char *)operator new(v13);
__p = v12;
__dst[0] = v13 + 1;
v3 = a1;
__dst[1] = v11;
}
else
{
LOBYTE(__dst[0]) = 2 * v10;
v12 = (char *)__dst + 1;
if ( !v10 )
{
LABEL_15:
v12[v11] = 0;
v14 = (const void *)cocos2d::CCDictionary::objectForKey(v20, (char *)__dst);
v7 = v21;
if ( v14 )
{
v15 = __dynamic_cast(
v14,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( (__dst[0] & 1) == 0 )
{
LABEL_18:
if ( v15 )
{
v16 = v15[237] - v15[238];
if ( v16 >= v25 && v16 <= v24 && v15[215] - v15[214] == 100 )
{
v17 = GameStatsManager::sharedState();
hasCompletedLevel = GameStatsManager::hasCompletedLevel(v17, (__int64)v15);
v26 = hasCompletedLevel + (unsigned int)v26;
}
}
goto LABEL_4;
}
}
else
{
v15 = nullptr;
if ( (__dst[0] & 1) == 0 )
goto LABEL_18;
}
operator delete(__p);
goto LABEL_18;
}
}
memmove(v12, CString, v11);
goto LABEL_15;
}
}
return v26;
}