//
// GameLevelManager::rateDemon from 0x100562f70 to 0x1005633c9 (1113 bytes)
//
// 1 xrefs:
// > RateDemonLayer::onRate @ 0x100270eb4
//
// 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:10 +0000
//
char __fastcall GameLevelManager::rateDemon(__int64 a1, int a2, int a3, int a4)
{
__int64 v5; // r15
int v6; // r14d
__int64 v7; // rax
const char *CString; // r13
__int64 v9; // rbx
size_t v10; // rax
std::string::size_type v11; // r14
char *data; // r12
size_t v13; // r15
__int64 v14; // rbx
__int64 v16; // r14
void *v17; // r12
size_t v18; // rax
std::string::size_type v19; // rbx
char *v20; // r14
size_t v21; // r15
__int64 v22; // rax
__int64 v23; // rax
const std::string::value_type *v24; // rax
const char *v25; // rbx
size_t v26; // rax
size_t v27; // r15
char *v28; // r14
size_t v29; // r12
size_t v30; // rax
size_t v31; // rbx
char *v32; // r14
__int64 v33; // r15
size_t v34; // r15
char v35; // [rsp+0h] [rbp-B0h]
char v36; // [rsp+0h] [rbp-B0h]
std::string v37; // [rsp+8h] [rbp-A8h] BYREF
__int64 v38; // [rsp+20h] [rbp-90h]
_QWORD v39[2]; // [rsp+28h] [rbp-88h] BYREF
void *v40; // [rsp+38h] [rbp-78h]
__int128 v41; // [rsp+40h] [rbp-70h] BYREF
void *v42; // [rsp+50h] [rbp-60h]
int v43; // [rsp+5Ch] [rbp-54h]
int v44; // [rsp+60h] [rbp-50h]
int v45; // [rsp+64h] [rbp-4Ch]
__int64 v46; // [rsp+68h] [rbp-48h]
std::string __dst[2]; // [rsp+70h] [rbp-40h] BYREF
v5 = a1;
if ( !a4 )
{
v6 = a3;
if ( sub_100562140(a1) )
return 0;
sub_100561FE0(a1);
a3 = v6;
}
v45 = a4;
v44 = a2;
v43 = a3;
v7 = sub_10088E820("rd_%i_%i", v35);
CString = (const char *)cocos2d::CCString::getCString(v7);
v9 = *(_QWORD *)(a1 + 1088);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_57:
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v46 = *(_QWORD *)(a1 + 1088);
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
data = (char *)operator new(v13);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v13 + 1;
v5 = a1;
v9 = v46;
__dst[0].__r_.__value_.__l.__size_ = v11;
goto LABEL_11;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v10);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v10 )
LABEL_11:
memmove(data, CString, v11);
data[v11] = 0;
v14 = cocos2d::CCDictionary::objectForKey(v9, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v14 )
return 0;
v16 = *(_QWORD *)(v5 + 1088);
v17 = cocos2d::CCNode::create();
v18 = strlen(CString);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v19 = v18;
v46 = v16;
v38 = v5;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v20;
__dst[0].__r_.__value_.__r.__words[0] = v21 + 1;
__dst[0].__r_.__value_.__l.__size_ = v19;
goto LABEL_23;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v18);
v20 = __dst[0].__r_.__value_.__s.__data_;
if ( v18 )
LABEL_23:
memmove(v20, CString, v19);
v20[v19] = 0;
cocos2d::CCDictionary::setObject(v46, (__int64)v17, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(__dst);
v22 = sub_10088E820("%c%s%s%c%c%s", (char)"3");
cocos2d::CCString::getCString(v22);
v23 = sub_10088E820("&levelID=%i&rating=%i&secret=%s", v36);
v24 = (const std::string::value_type *)cocos2d::CCString::getCString(v23);
std::string::append(__dst, v24);
if ( (_BYTE)v45 )
std::string::append(__dst, "&mode=1");
v37.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v37.__r_.__value_.__r.__words[0] = 57;
v37.__r_.__value_.__l.__size_ = 52;
strcpy(v37.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/rateGJDemon21.php");
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v25 = __dst[0].__r_.__value_.__l.__data_;
else
v25 = __dst[0].__r_.__value_.__s.__data_;
v26 = strlen(v25);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v27 = v26;
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
v40 = v28;
v39[0] = v29 | 1;
v39[1] = v27;
goto LABEL_38;
}
LOBYTE(v39[0]) = 2 * v26;
v28 = (char *)v39 + 1;
if ( v26 )
LABEL_38:
memmove(v28, v25, v27);
v28[v27] = 0;
v30 = strlen(CString);
if ( v30 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v31 = v30;
if ( v30 >= 0x17 )
{
v34 = 26;
if ( (v30 | 7) != 0x17 )
v34 = (v30 | 7) + 1;
v32 = (char *)operator new(v34);
v42 = v32;
*(_QWORD *)&v41 = v34 | 1;
*((_QWORD *)&v41 + 1) = v31;
v33 = v38;
goto LABEL_46;
}
LOBYTE(v41) = 2 * v30;
v32 = (char *)&v41 + 1;
v33 = v38;
if ( v30 )
LABEL_46:
memmove(v32, CString, v31);
v32[v31] = 0;
GameLevelManager::ProcessHttpRequest(v33, &v37, (__int64)v39, &v41, 0x38u);
if ( (v41 & 1) != 0 )
{
operator delete(v42);
if ( (v39[0] & 1) == 0 )
{
LABEL_49:
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_50;
LABEL_55:
operator delete(v37.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
return 1;
goto LABEL_51;
}
}
else if ( (v39[0] & 1) == 0 )
{
goto LABEL_49;
}
operator delete(v40);
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_55;
LABEL_50:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_51:
operator delete(__dst[0].__r_.__value_.__l.__data_);
return 1;
}