//
// GameLevelManager::onRateDemonCompleted from 0x10052e190 to 0x10052e458 (712 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10052050e
//
// 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:31:49 +0000
//
void __fastcall GameLevelManager::onRateDemonCompleted(_QWORD *a1, unsigned __int8 *a2, __int64 a3)
{
const char *v3; // r15
__int64 v4; // r12
size_t v5; // rax
size_t v6; // r13
char *v7; // rbx
size_t v8; // r12
__int64 v9; // rdi
char *v10; // r15
unsigned int v11; // r13d
unsigned __int64 v12; // r13
const void *v13; // r14
size_t v14; // rbx
__int64 v15; // rdi
__int64 v16; // rbx
__int64 v17; // rax
const char *CString; // r12
size_t v19; // rax
size_t v20; // r14
_DWORD *v21; // rbx
float v22; // xmm0_4
__int64 v23; // rdi
void (__fastcall ***v24)(_QWORD, _QWORD, __int64); // rdi
size_t v25; // r13
__int64 v27; // [rsp+8h] [rbp-48h]
unsigned int SplitIntFromKey; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v30; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(const char **)(a3 + 16);
else
v3 = (const char *)(a3 + 1);
v4 = a1[136];
v5 = strlen(v3);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_38;
v6 = v5;
if ( v5 >= 0x17 )
{
v27 = a1[136];
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v4 = v27;
v30 = v6;
goto LABEL_11;
}
v7 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v5;
if ( v5 )
LABEL_11:
memmove(v7, v3, v6);
v7[v6] = 0;
v9 = v4;
cocos2d::CCDictionary::removeObjectForKey(v4, (char *)&__dst);
if ( (__dst & 1) != 0 )
{
v9 = (__int64)__p;
operator delete(__p);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v9, v3, 1);
v10 = (char *)&__dst + 1;
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v11 = *a2;
if ( (v11 & 1) != 0 )
{
v12 = *((_QWORD *)a2 + 1);
v13 = *((const void **)a2 + 2);
}
else
{
v12 = v11 >> 1;
v13 = a2 + 1;
}
v14 = 2;
if ( v12 < 2 )
v14 = v12;
if ( !((v12 != 2) | (memcmp(v13, (char *)&__dst + 1, v14) != 0)) )
{
v15 = a1[170];
if ( v15 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v15 + 8LL))(v15, SplitIntFromKey, 56);
v16 = a1[102];
v17 = sub_10088E820("%i", (char)a1);
CString = (const char *)cocos2d::CCString::getCString(v17);
v19 = strlen(CString);
if ( v19 < 0xFFFFFFFFFFFFFFF8LL )
{
v20 = v19;
if ( v19 >= 0x17 )
{
v25 = 26;
if ( (v19 | 7) != 0x17 )
v25 = (v19 | 7) + 1;
v10 = (char *)operator new(v25);
__p = v10;
__dst = v25 + 1;
v30 = v20;
}
else
{
LOBYTE(__dst) = 2 * v19;
if ( !v19 )
{
LABEL_35:
v10[v20] = 0;
cocos2d::CCDictionary::removeObjectForKey(v16, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
return;
}
}
memmove(v10, CString, v20);
goto LABEL_35;
}
LABEL_38:
sub_100003630();
}
*(_WORD *)((char *)&__dst + 1) = 12845;
BYTE3(__dst) = 0;
if ( (v12 != 2) | (memcmp(v13, (char *)&__dst + 1, v14) != 0) )
{
v24 = (void (__fastcall ***)(_QWORD, _QWORD, __int64))a1[170];
if ( v24 )
(**v24)(v24, SplitIntFromKey, 56);
}
else
{
v21 = (_DWORD *)GameManager::sharedState();
v21[260] = 0;
v22 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v21[259] = (int)v22;
v21[258] = (int)v22;
v23 = a1[170];
if ( v23 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v23 + 8LL))(v23, SplitIntFromKey, 56);
}
}