//
// GameLevelManager::rateStars from 0x1005614a0 to 0x100561bd5 (1845 bytes)
//
// 1 xrefs:
// > RateStarsLayer::onRate @ 0x100277ba8
//
// 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:09 +0000
//
__int64 __fastcall GameLevelManager::rateStars(__int64 a1, unsigned int a2)
{
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
const std::string::value_type *CString; // rax
std::string::value_type *v7; // rsi
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
int v11; // r14d
__int64 v12; // rax
__int64 v13; // rax
const char *v14; // rbx
size_t v15; // rax
size_t v16; // r15
char *v17; // r12
char *v18; // rbx
size_t v19; // r13
unsigned int v20; // eax
size_t v21; // rax
std::string::size_type v22; // rbx
char *data; // r15
size_t v24; // r12
const std::string::value_type *v25; // rsi
std::string::size_type size; // rdx
const char *v27; // rbx
size_t v28; // rax
size_t v29; // r15
char *v30; // r12
size_t v31; // r13
__int64 v32; // rax
const char *v33; // rbx
size_t v34; // rax
size_t v35; // r14
char *v36; // r15
size_t v37; // r12
char v39; // [rsp+0h] [rbp-180h]
char v40; // [rsp+0h] [rbp-180h]
__int128 v41; // [rsp+20h] [rbp-160h] BYREF
void *v42; // [rsp+30h] [rbp-150h]
std::string v43; // [rsp+38h] [rbp-148h] BYREF
std::string v44; // [rsp+50h] [rbp-130h] BYREF
char v45; // [rsp+68h] [rbp-118h] BYREF
char v46; // [rsp+69h] [rbp-117h] BYREF
std::string::value_type *__s; // [rsp+78h] [rbp-108h]
std::string v48; // [rsp+80h] [rbp-100h] BYREF
_QWORD v49[2]; // [rsp+98h] [rbp-E8h] BYREF
void *v50; // [rsp+A8h] [rbp-D8h]
__int128 v51; // [rsp+B0h] [rbp-D0h] BYREF
void *v52; // [rsp+C0h] [rbp-C0h]
_QWORD __dst[2]; // [rsp+C8h] [rbp-B8h] BYREF
char *v54; // [rsp+D8h] [rbp-A8h]
std::string v55; // [rsp+E0h] [rbp-A0h] BYREF
unsigned int v56; // [rsp+FCh] [rbp-84h]
char __src[16]; // [rsp+100h] [rbp-80h] BYREF
void *__p; // [rsp+110h] [rbp-70h]
_BYTE v59[32]; // [rsp+130h] [rbp-50h] BYREF
v3 = GameManager::sharedState();
GameManager::reportAchievementWithID(v3, "geometry.ach.rateDiff", 100, 0);
if ( (unsigned __int8)sub_100561D60(a1, a2) )
return __stack_chk_guard;
sub_100561E60(a1, a2);
GameLevelManager::getBasePostString(&v55);
v4 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v4);
v5 = sub_10088E820("&levelID=%i&stars=%i&secret=%s", v39);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v5);
std::string::append(&v55, CString);
sub_10051B980(&v45, 10);
std::string::append(&v55, "&rs=");
v7 = &v46;
if ( (v45 & 1) != 0 )
v7 = __s;
std::string::append(&v55, v7);
GJAccountManager::sharedState((__int64)&v55, (__int64)v7);
v8 = GameManager::sharedState();
if ( (*(_BYTE *)(v8 + 608) & 1) != 0 )
{
sub_10001AD30(__src, *(const void **)(v8 + 624), *(_QWORD *)(v8 + 616));
}
else
{
v9 = v8 + 608;
__p = *(void **)(v9 + 16);
*(_OWORD *)__src = *(_OWORD *)v9;
}
v56 = a2;
v10 = GameManager::sharedState();
v11 = *(_DWORD *)(v10 + 660) - *(_DWORD *)(v10 + 664);
v12 = sub_10088E820("%c%s%s%c%c%s", (char)"0J");
cocos2d::CCString::getCString(v12);
v13 = sub_10088E820("%i%i%s%i%s%i%s", v11);
v14 = (const char *)cocos2d::CCString::getCString(v13);
v15 = strlen(v14);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v16 = v15;
if ( v15 >= 0x17 )
{
v19 = 26;
if ( (v15 | 7) != 0x17 )
v19 = (v15 | 7) + 1;
v17 = (char *)operator new(v19);
v54 = v17;
__dst[0] = v19 | 1;
__dst[1] = v16;
}
else
{
LOBYTE(__dst[0]) = 2 * v15;
v17 = (char *)__dst + 1;
if ( !v15 )
{
BYTE1(__dst[0]) = 0;
if ( (__src[0] & 1) == 0 )
goto LABEL_12;
goto LABEL_11;
}
}
memmove(v17, v14, v16);
v17[v16] = 0;
if ( (__src[0] & 1) != 0 )
LABEL_11:
operator delete(__p);
LABEL_12:
if ( (__dst[0] & 1) != 0 )
v18 = v54;
else
v18 = (char *)__dst + 1;
v20 = strlen(v18);
sub_100872DB0(v18, v20, v59);
sub_100873590(v59, __src);
v21 = strlen(__src);
if ( v21 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v22 = v21;
if ( v21 >= 0x17 )
{
v24 = 26;
if ( (v21 | 7) != 0x17 )
v24 = (v21 | 7) + 1;
data = (char *)operator new(v24);
v48.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
v48.__r_.__value_.__r.__words[0] = v24 | 1;
v48.__r_.__value_.__l.__size_ = v22;
goto LABEL_27;
}
v48.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v21);
data = v48.__r_.__value_.__s.__data_;
if ( v21 )
LABEL_27:
memcpy(data, __src, v22);
data[v22] = 0;
strcpy((char *)&v41, "\n58281");
cocos2d::ZipUtils::base64EncodeEnc(&v44, &v48, &v41);
if ( (v41 & 1) != 0 )
operator delete(v42);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v48.__r_.__value_.__l.__data_);
std::string::append(&v55, "&chk=");
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) != 0 )
{
v25 = v44.__r_.__value_.__l.__data_;
size = v44.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v44.__r_.__value_.__l.0 >> 1;
v25 = v44.__r_.__value_.__s.__data_;
}
std::string::append(&v55, v25, size);
v43.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v43.__r_.__value_.__r.__words[0] = 57;
v43.__r_.__value_.__l.__size_ = 53;
strcpy(v43.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/rateGJStars211.php");
if ( (*(_BYTE *)&v55.__r_.__value_.__s.0 & 1) != 0 )
v27 = v55.__r_.__value_.__l.__data_;
else
v27 = v55.__r_.__value_.__s.__data_;
v28 = strlen(v27);
if ( v28 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v29 = v28;
if ( v28 >= 0x17 )
{
v31 = 26;
if ( (v28 | 7) != 0x17 )
v31 = (v28 | 7) + 1;
v30 = (char *)operator new(v31);
v50 = v30;
v49[0] = v31 | 1;
v49[1] = v29;
goto LABEL_45;
}
LOBYTE(v49[0]) = 2 * v28;
v30 = (char *)v49 + 1;
if ( v28 )
LABEL_45:
memmove(v30, v27, v29);
v30[v29] = 0;
v32 = sub_10088E820("%i", v40);
v33 = (const char *)cocos2d::CCString::getCString(v32);
v34 = strlen(v33);
if ( v34 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v35 = v34;
if ( v34 >= 0x17 )
{
v37 = 26;
if ( (v34 | 7) != 0x17 )
v37 = (v34 | 7) + 1;
v36 = (char *)operator new(v37);
v52 = v36;
*(_QWORD *)&v51 = v37 | 1;
*((_QWORD *)&v51 + 1) = v35;
goto LABEL_53;
}
LOBYTE(v51) = 2 * v34;
v36 = (char *)&v51 + 1;
if ( v34 )
LABEL_53:
memmove(v36, v33, v35);
v36[v35] = 0;
GameLevelManager::ProcessHttpRequest(a1, &v43, (__int64)v49, &v51, 6u);
if ( (v51 & 1) != 0 )
{
operator delete(v52);
if ( (v49[0] & 1) == 0 )
{
LABEL_56:
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_57;
goto LABEL_65;
}
}
else if ( (v49[0] & 1) == 0 )
{
goto LABEL_56;
}
operator delete(v50);
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_57:
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_58;
goto LABEL_66;
}
LABEL_65:
operator delete(v43.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_58:
if ( (__dst[0] & 1) == 0 )
goto LABEL_59;
goto LABEL_67;
}
LABEL_66:
operator delete(v44.__r_.__value_.__l.__data_);
if ( (__dst[0] & 1) == 0 )
{
LABEL_59:
if ( (v45 & 1) == 0 )
goto LABEL_60;
LABEL_68:
operator delete(__s);
if ( (*(_BYTE *)&v55.__r_.__value_.__s.0 & 1) == 0 )
return __stack_chk_guard;
goto LABEL_61;
}
LABEL_67:
operator delete(v54);
if ( (v45 & 1) != 0 )
goto LABEL_68;
LABEL_60:
if ( (*(_BYTE *)&v55.__r_.__value_.__s.0 & 1) != 0 )
LABEL_61:
operator delete(v55.__r_.__value_.__l.__data_);
return __stack_chk_guard;
}