//
// GameLevelManager::rateDemon from 0x1402358f0 to 0x140235d42 (1106 bytes)
//
// 2 xrefs:
// > RateDemonLayer::onRate @ 0x14055d7cd
// > ??> @ 0x14091bfc8
//
// 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 11:28:32 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall GameLevelManager::rateDemon(__int64 a1, unsigned int a2, int a3, char a4)
{
size_t v8; // rdi
cocos2d::CCString *v9; // rax
const char *CString; // rax
size_t v11; // r8
void *v12; // rcx
cocos2d::CCString *v13; // rax
const char *v14; // rax
const char *v15; // rsi
size_t v16; // r8
__int64 v17; // rbx
void *v18; // r8
size_t v20; // r8
__int64 v21; // rbx
__int64 v22; // rax
__int64 v23; // rcx
void *v24; // rcx
cocos2d::CCString *v25; // rax
const char *v26; // rax
cocos2d::CCString *v27; // rax
char *v28; // rax
size_t v29; // r8
size_t v30; // r8
_QWORD *v31; // rdx
__int128 v32; // [rsp+40h] [rbp-79h] BYREF
__int64 v33; // [rsp+50h] [rbp-69h]
__int64 v34; // [rsp+58h] [rbp-61h]
__int128 *v35; // [rsp+60h] [rbp-59h]
__int128 *v36; // [rsp+68h] [rbp-51h]
void *Block[2]; // [rsp+78h] [rbp-41h] BYREF
__int128 v38; // [rsp+88h] [rbp-31h]
__int128 v39; // [rsp+98h] [rbp-21h] BYREF
__int64 v40; // [rsp+A8h] [rbp-11h]
__int64 v41; // [rsp+B0h] [rbp-9h]
_QWORD Src[4]; // [rsp+B8h] [rbp-1h] BYREF
v8 = -1;
if ( !a4 )
{
if ( GameLevelManager::hasRatedDemon(a1) )
return 0;
if ( cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(a1 + 912)) >= 0x3E8 )
{
cocos2d::CCDictionary::getFirstKey(*(_QWORD *)(a1 + 912), &v39);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 912), &v39);
sub_14003D310((__int64)&v39);
}
v9 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, a2);
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)Block = 0;
v38 = 0;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003D230(Block, CString, v11);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 912), *(_QWORD *)(a1 + 1648), Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v12 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
}
v13 = cocos2d::CCString::createWithFormat("rd_%i_%i", a2, a3);
v14 = cocos2d::CCString::getCString(v13);
v15 = v14;
*(_OWORD *)Block = 0;
v38 = 0;
v16 = -1;
do
++v16;
while ( v14[v16] );
sub_14003D230(Block, v14, v16);
v17 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 1200), Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v18 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
if ( v17 )
return 0;
*(_OWORD *)Block = 0;
v38 = 0;
v20 = -1;
do
++v20;
while ( v15[v20] );
sub_14003D230(Block, v15, v20);
v21 = *(_QWORD *)(a1 + 1200);
v22 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(v21, v22, Block);
if ( *((_QWORD *)&v38 + 1) > 0xFu )
{
v24 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v38 + 1) + 1LL) >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
GameLevelManager::getBasePostString(v23, Src);
v25 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfp", "3879", 103, 99, (const char *)&word_14070D054);
v26 = cocos2d::CCString::getCString(v25);
v27 = cocos2d::CCString::createWithFormat("&levelID=%i&rating=%i&secret=%s", a2, a3, v26);
v28 = (char *)cocos2d::CCString::getCString(v27);
v29 = -1;
do
++v29;
while ( v28[v29] );
sub_140044D80(Src, v28, v29);
if ( a4 )
sub_140044D80(Src, "&mode=1", 7u);
v35 = &v32;
v36 = &v39;
v32 = 0;
v33 = 0;
v34 = 0;
v30 = -1;
do
++v30;
while ( v15[v30] );
sub_14003D230(&v32, v15, v30);
v31 = Src;
if ( Src[3] > 0xFu )
v31 = (_QWORD *)Src[0];
v39 = 0;
v40 = 0;
v41 = 0;
do
++v8;
while ( *((_BYTE *)v31 + v8) );
sub_14003D230(&v39, v31, v8);
*(_OWORD *)Block = 0;
v38 = 0u;
Block[0] = sub_14003D460(0x40u);
*(_QWORD *)&v38 = 52;
*((_QWORD *)&v38 + 1) = 63;
strcpy((char *)Block[0], "https://www.boomlings.com/database/rateGJDemon21.php");
GameLevelManager::ProcessHttpRequest(
(cocos2d::CCActionManager **)a1,
(__int64)Block,
(const char *)&v39,
(const char *)&v32,
0x38u);
sub_14003D310((__int64)Src);
return 1;
}