//
// GameLevelManager::onRateStarsCompleted from 0x100520000 to 0x100520160 (352 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051c882
//
// 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 __fastcall GameLevelManager::onRateStarsCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3, double a4)
{
const char *v5; // rdx
const void *v6; // rdi
unsigned __int64 v7; // rcx
char *v8; // rbx
size_t v9; // rdx
__int64 v10; // r14
cocos2d::CCString *v11; // rax
const char *CString; // r12
size_t v13; // rax
size_t v14; // r15
GameStatsManager *v15; // rax
size_t v16; // r13
_QWORD __s2[2]; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *(const char **)(a3 + 16);
else
v5 = (const char *)(a3 + 1);
atoi(v5);
*(_WORD *)((char *)__s2 + 1) = 12589;
BYTE3(__s2[0]) = 0;
v6 = a2 + 1;
v7 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
v6 = *((const void **)a2 + 2);
v8 = (char *)__s2 + 1;
if ( (*a2 & 1) != 0 )
v7 = *((_QWORD *)a2 + 1);
v9 = 2;
if ( v7 < 2 )
v9 = v7;
if ( (v7 != 2) | (memcmp(v6, (char *)__s2 + 1, v9) != 0) )
{
v15 = GameStatsManager::sharedState();
GameStatsManager::incrementStat_1(v15, "11");
return;
}
v10 = *(_QWORD *)(a1 + 408);
v11 = (cocos2d::CCString *)sub_1007AB580("%i", __s2[0]);
CString = cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v14 = v13;
if ( v13 >= 0x17 )
{
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v8 = (char *)operator new(v16);
__p = v8;
__s2[0] = v16 + 1;
__s2[1] = v14;
goto LABEL_19;
}
LOBYTE(__s2[0]) = 2 * v13;
if ( v13 )
LABEL_19:
memmove(v8, CString, v14);
v8[v14] = 0;
cocos2d::CCDictionary::removeObjectForKey_1(v10, (char *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(__p);
}