//
// GameLevelManager::getGJRewards from 0x1000ccc00 to 0x1000ccf5c (860 bytes)
//
// 3 xrefs:
// > RewardsPage::init @ 0x100259fb0
// > sub_10025A130 @ 0x10025a1d4
// > sub_10025A88C @ 0x10025a8a0
//
// This function is hookable on this platform (idp: arm, 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 10:58:52 +0000
//
bool __fastcall GameLevelManager::getGJRewards(__int64 a1, int a2)
{
_BOOL4 v4; // w19
__int64 v5; // x0
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x24
int v9; // w25
__int64 v10; // x26
int v11; // w23
int v12; // w22
__int64 v13; // x0
char *CString; // x0
std::string::size_type size; // x9
char v16; // w8
std::string::size_type v17; // x8
char v18; // w28
std::string *v19; // x27
std::string *v20; // x0
int v21; // w21
std::string *v22; // x27
int v23; // w0
std::string *p_a; // x27
__int64 v25; // x0
const char *v26; // x24
std::string *p_str; // x8
__int64 v28; // x0
const std::string::value_type *v29; // x0
std::string *v30; // x1
int v32; // [xsp+30h] [xbp-110h]
void *__p[2]; // [xsp+38h] [xbp-108h] BYREF
char v34; // [xsp+4Fh] [xbp-F1h]
void *v35[2]; // [xsp+50h] [xbp-F0h] BYREF
char v36; // [xsp+67h] [xbp-D9h]
std::string v37; // [xsp+68h] [xbp-D8h] BYREF
std::string __a; // [xsp+80h] [xbp-C0h] BYREF
std::string v39; // [xsp+98h] [xbp-A8h] BYREF
std::string __str; // [xsp+B0h] [xbp-90h] BYREF
std::string v41; // [xsp+C8h] [xbp-78h] BYREF
std::allocator v42; // [xsp+E7h] [xbp-59h] BYREF
v4 = sub_1000ADBAC(a1, "rew_state");
if ( !v4 )
{
v32 = a2;
sub_1000ADC1C(a1, "rew_state");
GameLevelManager::getBasePostString(v5, &v41);
v7 = GameStatsManager::sharedState(v6);
v8 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(v7 + 480));
v9 = sub_1002E757C(v8);
if ( v9 >= 1 )
{
v10 = 0;
v11 = 0;
v12 = 0;
while ( 1 )
{
v13 = cocos2d::CCArray::stringAtIndex(v8, v10);
CString = (char *)cocos2d::CCString::getCString(v13);
sub_100009900(&__str, CString);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
v16 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( size < 3 )
goto LABEL_25;
std::string::basic_string(&v39, &__str, 0, 1u, (std::allocator *)&__a);
v17 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v17 = __str.__r_.__value_.__l.__size_;
std::string::basic_string(&__a, &__str, 2u, v17 - 2, &v42);
v18 = HIBYTE(v39.__r_.__value_.__r.__words[2]);
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
{
v19 = (std::string *)v39.__r_.__value_.__r.__words[0];
v20 = (std::string *)v39.__r_.__value_.__r.__words[0];
}
else
{
v19 = &v39;
v20 = &v39;
}
if ( atoi((const char *)v20) == 1 )
break;
v23 = atoi((const char *)v19);
v21 = SHIBYTE(__a.__r_.__value_.__r.__words[2]);
if ( v23 != 2 )
goto LABEL_22;
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
{
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
if ( v11 >= atoi(__a.__r_.__value_.__l.__data_) )
goto LABEL_31;
}
else
{
p_a = &__a;
if ( v11 >= atoi((const char *)&__a) )
goto LABEL_23;
}
v11 = atoi((const char *)p_a);
if ( (v21 & 0x80000000) == 0 )
{
LABEL_23:
if ( v18 < 0 )
goto LABEL_32;
goto LABEL_24;
}
LABEL_31:
operator delete(__a.__r_.__value_.__l.__data_);
if ( (*((_BYTE *)&v39.__r_.__value_.__s + 23) & 0x80) != 0 )
LABEL_32:
operator delete(v39.__r_.__value_.__l.__data_);
LABEL_24:
v16 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
LABEL_25:
if ( v16 < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v10 = (unsigned int)(v10 + 1);
if ( v9 == (_DWORD)v10 )
goto LABEL_34;
}
v21 = SHIBYTE(__a.__r_.__value_.__r.__words[2]);
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
{
v22 = (std::string *)__a.__r_.__value_.__r.__words[0];
if ( v12 >= atoi(__a.__r_.__value_.__l.__data_) )
goto LABEL_31;
}
else
{
v22 = &__a;
if ( v12 >= atoi((const char *)&__a) )
goto LABEL_23;
}
v12 = atoi((const char *)v22);
LABEL_22:
if ( (v21 & 0x80000000) == 0 )
goto LABEL_23;
goto LABEL_31;
}
v12 = 0;
v11 = 0;
LABEL_34:
v25 = sub_1003065B0("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, "7");
v26 = (const char *)cocos2d::CCString::getCString(v25);
sub_1000B99D0((__int64)v26, &__str);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
v28 = sub_1003065B0("&rewardType=%i&secret=%s&chk=%s&r1=%i&r2=%i", v32, v26, (const char *)p_str, v12, v11);
v29 = (const std::string::value_type *)cocos2d::CCString::getCString(v28);
std::string::append(&v41, v29);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
sub_100009900(&v37, "https://www.boomlings.com/database/getGJRewards.php");
if ( (v41.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v30 = &v41;
else
v30 = (std::string *)v41.__r_.__value_.__r.__words[0];
sub_100009900(v35, (char *)v30);
sub_100009900(__p, "rew_state");
GameLevelManager::ProcessHttpRequest(a1, &v37, (char *)v35, (const std::string::value_type *)__p, 52);
if ( v34 < 0 )
operator delete(__p[0]);
if ( v36 < 0 )
operator delete(v35[0]);
if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v37.__r_.__value_.__l.__data_);
if ( SHIBYTE(v41.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v41.__r_.__value_.__l.__data_);
}
return !v4;
}