//
// GameLevelManager::removeFriend from 0x1005558d0 to 0x100555cee (1054 bytes)
//
// 2 xrefs:
// > GJUserCell::FLAlert_Clicked @ 0x100256d22
// > ProfilePage::FLAlert_Clicked @ 0x1007bf4c3
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall GameLevelManager::removeFriend(GameLevelManager *a1, int a2)
{
__m128 v2; // xmm0
GameLevelManager *v3; // r14
cocos2d::CCString *v4; // rax
char *CString; // r15
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // r12
size_t v7; // rax
std::string::size_type v8; // r13
char *data; // rbx
size_t v10; // r14
__int64 v11; // rbx
__int64 v13; // r13
cocos2d::CCNode *v14; // r12
size_t v15; // rax
std::string::size_type v16; // rbx
char *v17; // r12
char *v18; // r13
GameLevelManager *v19; // r15
size_t v20; // r14
cocos2d::CCString *v21; // rax
cocos2d::CCString *v22; // rax
const char *v23; // rax
const char *v24; // r15
size_t v25; // rax
size_t v26; // r12
char *v27; // rbx
size_t v28; // r13
size_t v29; // rax
size_t v30; // r15
char *v31; // rbx
size_t v32; // r12
char v33; // [rsp+0h] [rbp-B0h]
char v34; // [rsp+0h] [rbp-B0h]
__int64 v35; // [rsp+10h] [rbp-A0h]
std::string v36; // [rsp+18h] [rbp-98h] BYREF
_QWORD v37[2]; // [rsp+30h] [rbp-80h] BYREF
void *v38; // [rsp+40h] [rbp-70h]
_QWORD v39[2]; // [rsp+48h] [rbp-68h] BYREF
void *v40; // [rsp+58h] [rbp-58h]
cocos2d::CCDictionary *v41; // [rsp+60h] [rbp-50h]
char *__s; // [rsp+68h] [rbp-48h]
std::string __dst[2]; // [rsp+70h] [rbp-40h] BYREF
if ( a2 <= 0 )
return 0;
v3 = a1;
v4 = (cocos2d::CCString *)sub_1007AB580("removeFriend_%i", v33);
CString = (char *)cocos2d::CCString::getCString(v4);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_53:
sub_100006BF0(*(double *)v2.i64);
v8 = v7;
LODWORD(__s) = a2;
if ( v7 >= 0x17 )
{
v41 = m_friendReqAndUserBlocks;
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
data = (char *)operator new(v10);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v10 + 1;
v3 = a1;
m_friendReqAndUserBlocks = v41;
__dst[0].__r_.__value_.__l.__size_ = v8;
goto LABEL_9;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v7 )
LABEL_9:
memmove(data, CString, v8);
data[v8] = 0;
v11 = cocos2d::CCDictionary::objectForKey_1((__int64)m_friendReqAndUserBlocks, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v11 )
return 0;
v13 = (__int64)v3->m_friendReqAndUserBlocks;
v14 = cocos2d::CCNode::create();
v15 = strlen(CString);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_53;
v16 = v15;
v41 = (cocos2d::CCDictionary *)v14;
if ( v15 >= 0x17 )
{
v35 = v13;
v18 = CString;
v19 = v3;
v20 = 26;
if ( (v15 | 7) != 0x17 )
v20 = (v15 | 7) + 1;
v17 = (char *)operator new(v20);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v17;
__dst[0].__r_.__value_.__r.__words[0] = v20 + 1;
v3 = v19;
CString = v18;
v13 = v35;
__dst[0].__r_.__value_.__l.__size_ = v16;
goto LABEL_21;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v15);
v17 = __dst[0].__r_.__value_.__s.__data_;
if ( v15 )
LABEL_21:
memmove(v17, CString, v16);
v17[v16] = 0;
cocos2d::CCDictionary::setObject_1(v13, v41, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(__dst, v2);
v21 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v21);
v22 = (cocos2d::CCString *)sub_1007AB580("&targetAccountID=%i&secret=%s", v34);
v23 = cocos2d::CCString::getCString(v22);
std::string::append(__dst, v23);
__s = CString;
v36.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v36.__r_.__value_.__r.__words[0] = 57;
v36.__r_.__value_.__l.__size_ = 55;
strcpy(v36.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/removeGJFriend20.php");
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v24 = __dst[0].__r_.__value_.__l.__data_;
else
v24 = __dst[0].__r_.__value_.__s.__data_;
v25 = strlen(v24);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.057594829120962e-81);
v26 = v25;
if ( v25 >= 0x17 )
{
v28 = 26;
if ( (v25 | 7) != 0x17 )
v28 = (v25 | 7) + 1;
v27 = (char *)operator new(v28);
v38 = v27;
v37[0] = v28 | 1;
v37[1] = v26;
goto LABEL_34;
}
LOBYTE(v37[0]) = 2 * v25;
v27 = (char *)v37 + 1;
if ( v25 )
LABEL_34:
memmove(v27, v24, v26);
v27[v26] = 0;
v29 = strlen(__s);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.057594829120962e-81);
v30 = v29;
if ( v29 >= 0x17 )
{
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = (v29 | 7) + 1;
v31 = (char *)operator new(v32);
v40 = v31;
v39[0] = v32 | 1;
v39[1] = v30;
goto LABEL_42;
}
LOBYTE(v39[0]) = 2 * v29;
v31 = (char *)v39 + 1;
if ( v29 )
LABEL_42:
memmove(v31, __s, v30);
v31[v30] = 0;
GameLevelManager::ProcessHttpRequest(v3, &v36, (__int64)v37, (__int64)v39, 33);
if ( (v39[0] & 1) != 0 )
{
operator delete(v40);
if ( (v37[0] & 1) == 0 )
{
LABEL_45:
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_46;
LABEL_51:
operator delete(v36.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
return 1;
goto LABEL_47;
}
}
else if ( (v37[0] & 1) == 0 )
{
goto LABEL_45;
}
operator delete(v38);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_51;
LABEL_46:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_47:
operator delete(__dst[0].__r_.__value_.__l.__data_);
return 1;
}