//
// GameLevelManager::uploadFriendRequest from 0x10057a060 to 0x10057a52b (1227 bytes)
//
// 1 xrefs:
// > ShareCommentLayer::onShare @ 0x1006b2c41
//
// 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:18 +0000
//
bool __fastcall GameLevelManager::uploadFriendRequest(__int64 a1, int a2, std::string *a3)
{
__int64 v4; // r14
__int64 v5; // rax
void *CString; // rax
void *v7; // r13
size_t v8; // rax
std::string::size_type v9; // r15
char *data; // r13
size_t v11; // r14
__int64 v12; // rbx
__int64 v13; // r15
size_t v14; // rax
std::string::size_type v15; // r13
char *v16; // rbx
__int64 v17; // r15
size_t v18; // r14
__int64 v19; // rax
__int64 v20; // rax
const std::string::value_type *v21; // rax
const char *v22; // rbx
size_t v23; // rax
size_t v24; // r15
char *v25; // r12
size_t v26; // r13
size_t v27; // rax
size_t v28; // rbx
char *v29; // r15
size_t v30; // r12
char v32; // [rsp+0h] [rbp-D0h]
char v33; // [rsp+0h] [rbp-D0h]
__int64 v34; // [rsp+10h] [rbp-C0h]
std::string v35; // [rsp+18h] [rbp-B8h] BYREF
std::string v36; // [rsp+30h] [rbp-A0h] BYREF
_QWORD v37[2]; // [rsp+48h] [rbp-88h] BYREF
void *v38; // [rsp+58h] [rbp-78h]
__int128 v39; // [rsp+60h] [rbp-70h] BYREF
void *v40; // [rsp+70h] [rbp-60h]
int v41; // [rsp+7Ch] [rbp-54h]
void *v42; // [rsp+80h] [rbp-50h]
void *__src; // [rsp+88h] [rbp-48h]
std::string __dst[2]; // [rsp+90h] [rbp-40h] BYREF
v4 = a1;
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&v36, a3->__r_.__value_.__l.__data_, a3->__r_.__value_.__l.__size_);
else
v36 = *a3;
LevelTools::base64EncodeString(__dst, &v36);
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
operator delete(a3->__r_.__value_.__l.__data_);
*a3 = __dst[0];
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v36.__r_.__value_.__l.__data_);
v5 = sub_10088E820("friendReq_%i", v32);
CString = (void *)cocos2d::CCString::getCString(v5);
v7 = *(void **)(a1 + 1088);
__src = CString;
v8 = strlen((const char *)CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_58;
v9 = v8;
v42 = v7;
v41 = a2;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
data = (char *)operator new(v11);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v11 + 1;
v4 = a1;
__dst[0].__r_.__value_.__l.__size_ = v9;
goto LABEL_15;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v8);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v8 )
LABEL_15:
memmove(data, __src, v9);
data[v9] = 0;
v12 = cocos2d::CCDictionary::objectForKey((__int64)v42, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v12 )
return v12 == 0;
v13 = *(_QWORD *)(v4 + 1088);
v42 = cocos2d::CCNode::create();
v14 = strlen((const char *)__src);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_58:
sub_100003630();
v15 = v14;
if ( v14 >= 0x17 )
{
v34 = v13;
v17 = v4;
v18 = 26;
if ( (v14 | 7) != 0x17 )
v18 = (v14 | 7) + 1;
v16 = (char *)operator new(v18);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v16;
__dst[0].__r_.__value_.__r.__words[0] = v18 + 1;
v4 = v17;
v13 = v34;
__dst[0].__r_.__value_.__l.__size_ = v15;
goto LABEL_26;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v14);
v16 = __dst[0].__r_.__value_.__s.__data_;
if ( v14 )
LABEL_26:
memmove(v16, __src, v15);
v16[v15] = 0;
cocos2d::CCDictionary::setObject(v13, (__int64)v42, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
GameLevelManager::makeTimeStamp(v4, (const char *)__src);
GameLevelManager::getBasePostString(__dst);
v19 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v19);
v20 = sub_10088E820("&toAccountID=%i&comment=%s&secret=%s", v33);
v21 = (const std::string::value_type *)cocos2d::CCString::getCString(v20);
std::string::append(__dst, v21);
v35.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v35.__r_.__value_.__r.__words[0] = 65;
v35.__r_.__value_.__l.__size_ = 60;
strcpy(v35.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/uploadFriendRequest20.php");
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v22 = __dst[0].__r_.__value_.__l.__data_;
else
v22 = __dst[0].__r_.__value_.__s.__data_;
v23 = strlen(v22);
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v24 = v23;
if ( v23 >= 0x17 )
{
v26 = 26;
if ( (v23 | 7) != 0x17 )
v26 = (v23 | 7) + 1;
v25 = (char *)operator new(v26);
v38 = v25;
v37[0] = v26 | 1;
v37[1] = v24;
goto LABEL_39;
}
LOBYTE(v37[0]) = 2 * v23;
v25 = (char *)v37 + 1;
if ( v23 )
LABEL_39:
memmove(v25, v22, v24);
v25[v24] = 0;
v27 = strlen((const char *)__src);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v28 = v27;
if ( v27 >= 0x17 )
{
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = (v27 | 7) + 1;
v29 = (char *)operator new(v30);
v40 = v29;
*(_QWORD *)&v39 = v30 | 1;
*((_QWORD *)&v39 + 1) = v28;
goto LABEL_47;
}
LOBYTE(v39) = 2 * v27;
v29 = (char *)&v39 + 1;
if ( v27 )
LABEL_47:
memmove(v29, __src, v28);
v29[v28] = 0;
GameLevelManager::ProcessHttpRequest(v4, &v35, (__int64)v37, &v39, 0x23u);
v12 = 0;
if ( (v39 & 1) != 0 )
{
operator delete(v40);
if ( (v37[0] & 1) == 0 )
{
LABEL_50:
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_51;
LABEL_56:
operator delete(v35.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
return v12 == 0;
goto LABEL_52;
}
}
else if ( (v37[0] & 1) == 0 )
{
goto LABEL_50;
}
operator delete(v38);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_56;
LABEL_51:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_52:
operator delete(__dst[0].__r_.__value_.__l.__data_);
return v12 == 0;
}