//
// sub_100572E00 from 0x100572e00 to 0x10057339d (1437 bytes)
//
// 9 xrefs:
// > ThreadViewPopup::init @ 0x10092e878
// > sub_10092EE80 @ 0x10092ef56
// > sub_100930740 @ 0x1009307aa
// > sub_100930920 @ 0x100930973
// > sub_100930DF0 @ 0x100930ed1
// > sub_100930F70 @ 0x100930fc6
// > sub_1009315D0 @ 0x10093163f
// > sub_1009319C0 @ 0x100931a97
// > ThreadViewPopup::threadMessagesFinished @ 0x100935a61
//
// 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:15 +0000
//
char __fastcall sub_100572E00(__int64 a1, int a2, __int64 a3, __int64 a4, int a5, __int64 a6, unsigned __int8 *a7)
{
char result; // al
__int64 v9; // rbx
__int64 v11; // rax
unsigned int v12; // eax
__int64 v13; // rax
const char *CString; // r14
size_t v15; // rax
std::string::size_type v16; // r15
char *data; // r13
size_t v18; // rbx
__int64 v19; // r15
__int64 v20; // r12
void *v21; // r13
size_t v22; // rax
std::string::size_type v23; // r15
char *v24; // r13
size_t v25; // rbx
__int64 v26; // rax
__int64 v27; // rax
const std::string::value_type *v28; // rax
__int64 v29; // rax
const std::string::value_type *v30; // rax
__int64 v31; // rax
const std::string::value_type *v32; // rax
const std::string::value_type *v33; // rsi
std::string::size_type size; // rdx
const char *v35; // r13
const char *v36; // rbx
size_t v37; // rax
size_t v38; // r14
char *v39; // r15
size_t v40; // r12
size_t v41; // rax
size_t v42; // rbx
char *v43; // r14
size_t v44; // r15
char v45; // [rsp+0h] [rbp-100h]
char v46; // [rsp+0h] [rbp-100h]
char v47; // [rsp+0h] [rbp-100h]
__int64 v48; // [rsp+18h] [rbp-E8h]
__int64 v49; // [rsp+20h] [rbp-E0h]
std::string v50; // [rsp+28h] [rbp-D8h] BYREF
std::string v51; // [rsp+40h] [rbp-C0h] BYREF
std::string v52; // [rsp+60h] [rbp-A0h] BYREF
_QWORD v53[2]; // [rsp+78h] [rbp-88h] BYREF
void *v54; // [rsp+88h] [rbp-78h]
__int128 v55; // [rsp+90h] [rbp-70h] BYREF
void *v56; // [rsp+A0h] [rbp-60h]
int v57; // [rsp+ACh] [rbp-54h]
int v58; // [rsp+B0h] [rbp-50h]
int v59; // [rsp+B4h] [rbp-4Ch]
__int64 v60; // [rsp+B8h] [rbp-48h]
std::string __dst[2]; // [rsp+C0h] [rbp-40h] BYREF
result = 0;
if ( a2 > 0 )
{
v9 = a1;
if ( (a6 | a3 | a4) >= 0 )
{
if ( a6 )
{
LODWORD(v11) = 0;
}
else
{
v12 = *a7;
if ( (v12 & 1) != 0 )
v11 = *((_QWORD *)a7 + 1);
else
v11 = v12 >> 1;
LOBYTE(v11) = v11 != 0;
}
v59 = v11;
v57 = a2;
v13 = sub_10088E820("threadMsgs_%i_%lli_%lli_%lli_%i", v45);
CString = (const char *)cocos2d::CCString::getCString(v13);
v60 = *(_QWORD *)(a1 + 1088);
v15 = strlen(CString);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_76;
v16 = v15;
v58 = a5;
v48 = a6;
if ( v15 >= 0x17 )
{
v18 = 26;
if ( (v15 | 7) != 0x17 )
v18 = (v15 | 7) + 1;
data = (char *)operator new(v18);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v18 + 1;
v9 = a1;
__dst[0].__r_.__value_.__l.__size_ = v16;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v15);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v15 )
{
LABEL_17:
data[v16] = 0;
v19 = cocos2d::CCDictionary::objectForKey(v60, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v19 )
return 0;
v20 = *(_QWORD *)(v9 + 1088);
v21 = cocos2d::CCNode::create();
v22 = strlen(CString);
if ( v22 < 0xFFFFFFFFFFFFFFF8LL )
{
v23 = v22;
v60 = (__int64)v21;
v49 = v9;
if ( v22 >= 0x17 )
{
v25 = 26;
if ( (v22 | 7) != 0x17 )
v25 = (v22 | 7) + 1;
v24 = (char *)operator new(v25);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v24;
__dst[0].__r_.__value_.__r.__words[0] = v25 + 1;
__dst[0].__r_.__value_.__l.__size_ = v23;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v22);
v24 = __dst[0].__r_.__value_.__s.__data_;
if ( !v22 )
{
LABEL_29:
v24[v23] = 0;
cocos2d::CCDictionary::setObject(v20, v60, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(__dst);
v26 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v26);
v27 = sub_10088E820("&threadID=%i&beforeID=%lli&afterID=%lli&secret=%s", v46);
v28 = (const std::string::value_type *)cocos2d::CCString::getCString(v27);
std::string::append(__dst, v28);
if ( v58 >= 0 )
{
v29 = sub_10088E820("&mv=%i", v47);
v30 = (const std::string::value_type *)cocos2d::CCString::getCString(v29);
std::string::append(__dst, v30);
}
if ( v48 <= 0 )
{
if ( (_BYTE)v59 )
{
std::string::append(__dst, "&date=");
if ( (*a7 & 1) != 0 )
{
sub_10001AD30(&v51, *((const void **)a7 + 2), *((_QWORD *)a7 + 1));
}
else
{
v51.__r_.__value_.__r.__words[2] = *((_QWORD *)a7 + 2);
*(_OWORD *)&v51.__r_.__value_.__l.0 = *(_OWORD *)a7;
}
LevelTools::base64EncodeString(&v52, &v51);
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) != 0 )
{
v33 = v52.__r_.__value_.__l.__data_;
size = v52.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v52.__r_.__value_.__l.0 >> 1;
v33 = v52.__r_.__value_.__s.__data_;
}
std::string::append(__dst, v33, size);
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v52.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v51.__r_.__value_.__l.__data_);
}
}
else
{
v31 = sub_10088E820("&aroundID=%lli", v47);
v32 = (const std::string::value_type *)cocos2d::CCString::getCString(v31);
std::string::append(__dst, v32);
}
v50.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v50.__r_.__value_.__r.__words[0] = 65;
v50.__r_.__value_.__l.__size_ = 58;
strcpy(v50.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/getGJThreadMessages.php");
v35 = CString;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v36 = __dst[0].__r_.__value_.__l.__data_;
else
v36 = __dst[0].__r_.__value_.__s.__data_;
v37 = strlen(v36);
if ( v37 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v38 = v37;
if ( v37 >= 0x17 )
{
v40 = 26;
if ( (v37 | 7) != 0x17 )
v40 = (v37 | 7) + 1;
v39 = (char *)operator new(v40);
v54 = v39;
v53[0] = v40 | 1;
v53[1] = v38;
}
else
{
LOBYTE(v53[0]) = 2 * v37;
v39 = (char *)v53 + 1;
if ( !v37 )
{
LABEL_57:
v39[v38] = 0;
v41 = strlen(v35);
if ( v41 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v42 = v41;
if ( v41 >= 0x17 )
{
v44 = 26;
if ( (v41 | 7) != 0x17 )
v44 = (v41 | 7) + 1;
v43 = (char *)operator new(v44);
v56 = v43;
*(_QWORD *)&v55 = v44 | 1;
*((_QWORD *)&v55 + 1) = v42;
}
else
{
LOBYTE(v55) = 2 * v41;
v43 = (char *)&v55 + 1;
if ( !v41 )
{
LABEL_65:
v43[v42] = 0;
GameLevelManager::ProcessHttpRequest(v49, &v50, (__int64)v53, &v55, 0x5Du);
if ( (v55 & 1) != 0 )
{
operator delete(v56);
if ( (v53[0] & 1) == 0 )
{
LABEL_67:
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_68;
goto LABEL_74;
}
}
else if ( (v53[0] & 1) == 0 )
{
goto LABEL_67;
}
operator delete(v54);
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_68:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
return 1;
LABEL_69:
operator delete(__dst[0].__r_.__value_.__l.__data_);
return 1;
}
LABEL_74:
operator delete(v50.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
return 1;
goto LABEL_69;
}
}
memmove(v43, v35, v42);
goto LABEL_65;
}
}
memmove(v39, v36, v38);
goto LABEL_57;
}
}
memmove(v24, CString, v23);
goto LABEL_29;
}
LABEL_76:
sub_100003630();
}
}
memmove(data, CString, v16);
goto LABEL_17;
}
}
return result;
}