//
// sub_100578FA0 from 0x100578fa0 to 0x1005792e3 (835 bytes)
//
// 3 xrefs:
// > FriendsProfilePage::onGlobalSearch @ 0x100735bf2
// > sub_1008700D0 @ 0x100870152
// > sub_10093CF30 @ 0x10093cfd3
//
// 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
//
char __fastcall sub_100578FA0(__int64 a1, std::string *a2)
{
unsigned int v3; // eax
__int64 v4; // rdi
__int64 v5; // r15
__int64 v7; // r15
void *v8; // rax
__int64 v9; // rax
__int64 v10; // rax
const std::string::value_type *CString; // rax
const std::string::value_type *data; // rsi
std::string::size_type size; // rdx
const char *v14; // r14
size_t v15; // rax
size_t v16; // r15
char *v17; // r12
size_t v18; // r13
char v19; // [rsp+0h] [rbp-C0h]
std::string v20; // [rsp+8h] [rbp-B8h] BYREF
std::string v21; // [rsp+20h] [rbp-A0h] BYREF
std::string v22; // [rsp+38h] [rbp-88h] BYREF
__int128 v23; // [rsp+50h] [rbp-70h] BYREF
void *v24; // [rsp+60h] [rbp-60h]
_QWORD __dst[2]; // [rsp+68h] [rbp-58h] BYREF
void *v26; // [rsp+78h] [rbp-48h]
std::string v27; // [rsp+80h] [rbp-40h] BYREF
v3 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v3 & 1) != 0 )
{
if ( !a2->__r_.__value_.__l.__size_ )
return 0;
}
else if ( !(v3 >> 1) )
{
return 0;
}
v4 = *(_QWORD *)(a1 + 1088);
v27.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)20;
strcpy(v27.__r_.__value_.__s.__data_, "userSearch");
v5 = cocos2d::CCDictionary::objectForKey(v4, (char *)&v27);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v27.__r_.__value_.__l.__data_);
if ( v5 )
return 0;
v7 = *(_QWORD *)(a1 + 1088);
v8 = cocos2d::CCNode::create();
v27.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)20;
strcpy(v27.__r_.__value_.__s.__data_, "userSearch");
cocos2d::CCDictionary::setObject(v7, (__int64)v8, (char *)&v27);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v27.__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(&v27);
v9 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v9);
v10 = sub_10088E820("&secret=%s&str=", v19);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v10);
std::string::append(&v27, CString);
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&v21, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
else
v21 = *a2;
LevelTools::base64EncodeString(&v22, &v21);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
{
data = v22.__r_.__value_.__l.__data_;
size = v22.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v22.__r_.__value_.__l.0 >> 1;
data = v22.__r_.__value_.__s.__data_;
}
std::string::append(&v27, data, size);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v22.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v21.__r_.__value_.__l.__data_);
v20.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v20.__r_.__value_.__r.__words[0] = 57;
v20.__r_.__value_.__l.__size_ = 54;
strcpy(v20.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/getGJUserSearch.php");
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
v14 = v27.__r_.__value_.__l.__data_;
else
v14 = v27.__r_.__value_.__s.__data_;
v15 = strlen(v14);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v16 = v15;
if ( v15 >= 0x17 )
{
v18 = 26;
if ( (v15 | 7) != 0x17 )
v18 = (v15 | 7) + 1;
v17 = (char *)operator new(v18);
v26 = v17;
__dst[0] = v18 | 1;
__dst[1] = v16;
goto LABEL_31;
}
LOBYTE(__dst[0]) = 2 * v15;
v17 = (char *)__dst + 1;
if ( v15 )
LABEL_31:
memmove(v17, v14, v16);
v17[v16] = 0;
LOBYTE(v23) = 20;
strcpy((char *)&v23 + 1, "userSearch");
GameLevelManager::ProcessHttpRequest(a1, &v20, (__int64)__dst, &v23, 0x60u);
if ( (v23 & 1) != 0 )
{
operator delete(v24);
if ( (__dst[0] & 1) == 0 )
{
LABEL_34:
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_35;
LABEL_40:
operator delete(v20.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
return 1;
goto LABEL_36;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_34;
}
operator delete(v26);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_40;
LABEL_35:
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
LABEL_36:
operator delete(v27.__r_.__value_.__l.__data_);
return 1;
}