//
// sub_100553F20 from 0x100553f20 to 0x1005546a4 (1924 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onEnterTransitionDidFinish @ 0x1002b0e46
// > sub_100554850 @ 0x1005548af
//
// 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:04 +0000
//
void __fastcall sub_100553F20(_QWORD *a1, __int64 a2, int a3, int a4)
{
int v5; // r13d
unsigned __int64 v7; // rcx
unsigned __int64 v8; // r11
unsigned __int64 v9; // rdx
unsigned __int64 v10; // r14
__int64 **v11; // rax
__int64 *v12; // r12
unsigned __int64 v13; // r11
__int64 v14; // rax
unsigned __int64 v15; // r11
unsigned __int64 v16; // rdx
unsigned __int64 v17; // r9
unsigned __int64 v18; // rsi
unsigned __int64 v19; // rax
__int64 **v20; // rax
__int64 *v21; // rdi
unsigned __int64 v22; // r11
__int64 v23; // rax
std::string *v24; // rax
const char *v25; // r12
char v26; // r14
std::string *v27; // rax
std::string *v28; // rax
const std::string::value_type *v29; // rsi
std::string::size_type v30; // rdx
unsigned __int64 v31; // rax
std::string *v32; // rax
const std::string::value_type *v33; // rsi
std::string::size_type v34; // rdx
void *v35; // rdi
__int64 v36; // rax
__int64 v37; // rax
const std::string::value_type *CString; // rax
const char *v39; // r14
size_t v40; // rax
size_t v41; // r15
char *v42; // r13
const char *v43; // r13
size_t v44; // rax
size_t v45; // r14
char *v46; // r15
size_t v47; // r12
size_t v48; // r12
std::string v49; // [rsp+8h] [rbp-138h] BYREF
std::string v50; // [rsp+20h] [rbp-120h] BYREF
std::string v51; // [rsp+40h] [rbp-100h] BYREF
std::string v52; // [rsp+60h] [rbp-E0h] BYREF
size_t v53[2]; // [rsp+78h] [rbp-C8h] BYREF
void *v54; // [rsp+88h] [rbp-B8h]
_QWORD __dst[2]; // [rsp+90h] [rbp-B0h] BYREF
void *v56; // [rsp+A0h] [rbp-A0h]
__int128 v57; // [rsp+A8h] [rbp-98h] BYREF
void *v58; // [rsp+B8h] [rbp-88h]
std::string::value_type v59[16]; // [rsp+C0h] [rbp-80h] BYREF
void *__p; // [rsp+D0h] [rbp-70h]
int v61; // [rsp+DCh] [rbp-64h]
char __src[16]; // [rsp+E0h] [rbp-60h] BYREF
void *data; // [rsp+F0h] [rbp-50h]
std::string v64; // [rsp+100h] [rbp-40h] BYREF
v61 = a4;
if ( (int)a2 > 0 )
{
v5 = a2;
v7 = (unsigned int)a2;
v8 = a1[51];
if ( v8 )
{
v9 = ((v8 - ((v8 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v8 - ((v8 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL);
v10 = (0x101010101010101LL * ((v9 + (v9 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v10 > 1 )
{
a2 = (unsigned int)a2;
if ( v8 <= (unsigned int)a2 )
a2 = (unsigned int)a2 % (unsigned int)v8;
}
else
{
a2 = ((_DWORD)v8 + 0x7FFFFFFF) & (unsigned int)a2;
}
v11 = *(__int64 ***)(a1[50] + 8 * a2);
if ( v11 )
{
v12 = *v11;
if ( *v11 )
{
if ( (unsigned int)v10 < 2 )
{
v13 = v8 - 1;
while ( 1 )
{
v14 = v12[1];
if ( v14 == v7 )
{
if ( *((_DWORD *)v12 + 4) == v5 )
return;
}
else if ( (v13 & v14) != a2 )
{
goto LABEL_15;
}
v12 = (__int64 *)*v12;
if ( !v12 )
goto LABEL_15;
}
}
while ( 1 )
{
v19 = v12[1];
if ( v19 == v7 )
{
if ( *((_DWORD *)v12 + 4) == v5 )
return;
goto LABEL_19;
}
if ( v19 < v8 )
goto LABEL_24;
if ( (v8 | v19) >> 32 )
break;
if ( (unsigned int)v19 % (unsigned int)v8 != a2 )
goto LABEL_15;
LABEL_19:
v12 = (__int64 *)*v12;
if ( !v12 )
goto LABEL_15;
}
v19 %= v8;
LABEL_24:
if ( v19 != a2 )
goto LABEL_15;
goto LABEL_19;
}
}
}
LABEL_15:
v15 = a1[41];
if ( v15 )
{
v16 = ((v15 - ((v15 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v15 - ((v15 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL);
v17 = (0x101010101010101LL * ((v16 + (v16 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v17 > 1 )
{
v18 = v7;
if ( v15 <= v7 )
v18 = (unsigned int)v7 % (unsigned int)v15;
}
else
{
v18 = ((_DWORD)v15 + 0x7FFFFFFF) & (unsigned int)v7;
}
v20 = *(__int64 ***)(a1[40] + 8 * v18);
if ( v20 )
{
v21 = *v20;
if ( *v20 )
{
if ( (unsigned int)v17 < 2 )
{
v22 = v15 - 1;
while ( 1 )
{
v23 = v21[1];
if ( v23 == v7 )
{
if ( *((_DWORD *)v21 + 4) == v5 )
return;
}
else if ( (v22 & v23) != v18 )
{
goto LABEL_38;
}
v21 = (__int64 *)*v21;
if ( !v21 )
goto LABEL_38;
}
}
while ( 1 )
{
v31 = v21[1];
if ( v31 == v7 )
{
if ( *((_DWORD *)v21 + 4) == v5 )
return;
goto LABEL_46;
}
if ( v31 < v15 )
goto LABEL_51;
if ( (v15 | v31) >> 32 )
break;
if ( (unsigned int)v31 % (unsigned int)v15 != v18 )
goto LABEL_38;
LABEL_46:
v21 = (__int64 *)*v21;
if ( !v21 )
goto LABEL_38;
}
v31 %= v15;
LABEL_51:
if ( v31 != v18 )
goto LABEL_38;
goto LABEL_46;
}
}
}
LABEL_38:
GameToolbox::intToString((size_t *)&v64, v5);
v24 = std::string::insert(&v64, 0, "GetDeathData_");
data = v24->__r_.__value_.__l.__data_;
*(_OWORD *)__src = *(_OWORD *)&v24->__r_.__value_.__l.0;
*(_OWORD *)&v24->__r_.__value_.__l.0 = 0;
v24->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v64.__r_.__value_.__l.__data_);
v25 = &__src[1];
v26 = __src[0] & 1;
if ( (__src[0] & 1) != 0 )
v25 = (const char *)data;
if ( GameLevelManager::isDLActive((__int64)a1, v25) )
goto LABEL_100;
GameLevelManager::addDLToActive((__int64)a1, v25);
GameLevelManager::getBasePostString(&v64);
GameToolbox::intToString((size_t *)&v49, v5);
v27 = std::string::insert(&v49, 0, "&levelID=");
v51 = *v27;
*(_OWORD *)&v27->__r_.__value_.__l.0 = 0;
v27->__r_.__value_.__r.__words[2] = 0;
v28 = std::string::append(&v51, "&levelVersion=");
v50 = *v28;
*(_OWORD *)&v28->__r_.__value_.__l.0 = 0;
v28->__r_.__value_.__r.__words[2] = 0;
GameToolbox::intToString(v53, a3);
if ( (v53[0] & 1) != 0 )
{
v29 = (const std::string::value_type *)v54;
v30 = v53[1];
}
else
{
v30 = LOBYTE(v53[0]) >> 1;
v29 = (char *)v53 + 1;
}
v32 = std::string::append(&v50, v29, v30);
__p = v32->__r_.__value_.__l.__data_;
*(_OWORD *)v59 = *(_OWORD *)&v32->__r_.__value_.__l.0;
*(_OWORD *)&v32->__r_.__value_.__l.0 = 0;
v32->__r_.__value_.__r.__words[2] = 0;
if ( (v59[0] & 1) != 0 )
{
v33 = (const std::string::value_type *)__p;
v34 = *(_QWORD *)&v59[8];
}
else
{
v34 = (unsigned __int8)v59[0] >> 1;
v33 = &v59[1];
}
v35 = &v64;
std::string::append(&v64, v33, v34);
if ( (v59[0] & 1) != 0 )
{
v35 = __p;
operator delete(__p);
if ( (v53[0] & 1) == 0 )
{
LABEL_61:
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_62;
goto LABEL_68;
}
}
else if ( (v53[0] & 1) == 0 )
{
goto LABEL_61;
}
v35 = v54;
operator delete(v54);
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_62:
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_63;
goto LABEL_69;
}
LABEL_68:
v35 = v50.__r_.__value_.__l.__data_;
operator delete(v50.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_63:
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_64;
goto LABEL_70;
}
LABEL_69:
v35 = v51.__r_.__value_.__l.__data_;
operator delete(v51.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_64:
if ( !(_BYTE)v61 )
goto LABEL_73;
goto LABEL_71;
}
LABEL_70:
v35 = v49.__r_.__value_.__l.__data_;
operator delete(v49.__r_.__value_.__l.__data_);
if ( !(_BYTE)v61 )
goto LABEL_73;
LABEL_71:
v36 = GJAccountManager::sharedState((__int64)v35, (__int64)v33);
if ( *(_DWORD *)(v36 + 352) > *(_DWORD *)(v36 + 356) )
std::string::append(&v64, "&refresh=1");
LABEL_73:
std::string::append(&v64, "&secret=");
v37 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v37);
std::string::append(&v64, CString);
v52.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v52.__r_.__value_.__r.__words[0] = 57;
v52.__r_.__value_.__l.__size_ = 53;
strcpy(v52.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/getGJDeathData.php");
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
v39 = v64.__r_.__value_.__l.__data_;
else
v39 = v64.__r_.__value_.__s.__data_;
v40 = strlen(v39);
if ( v40 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v41 = v40;
if ( v40 >= 0x17 )
{
v47 = 26;
if ( (v40 | 7) != 0x17 )
v47 = (v40 | 7) + 1;
v42 = (char *)operator new(v47);
v56 = v42;
__dst[0] = v47 | 1;
__dst[1] = v41;
}
else
{
LOBYTE(__dst[0]) = 2 * v40;
v42 = (char *)__dst + 1;
if ( !v40 )
{
BYTE1(__dst[0]) = 0;
v43 = &__src[1];
if ( (__src[0] & 1) == 0 )
goto LABEL_81;
goto LABEL_80;
}
}
memmove(v42, v39, v41);
v42[v41] = 0;
v43 = &__src[1];
if ( (__src[0] & 1) == 0 )
{
LABEL_81:
v44 = strlen(v43);
if ( v44 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v45 = v44;
if ( v44 >= 0x17 )
{
v48 = 26;
if ( (v44 | 7) != 0x17 )
v48 = (v44 | 7) + 1;
v46 = (char *)operator new(v48);
v58 = v46;
*(_QWORD *)&v57 = v48 | 1;
*((_QWORD *)&v57 + 1) = v45;
}
else
{
LOBYTE(v57) = 2 * v44;
v46 = (char *)&v57 + 1;
if ( !v44 )
{
LABEL_94:
v46[v45] = 0;
GameLevelManager::ProcessHttpRequest((__int64)a1, &v52, (__int64)__dst, &v57, 0x6Au);
if ( (v57 & 1) != 0 )
{
operator delete(v58);
if ( (__dst[0] & 1) == 0 )
{
LABEL_96:
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_97;
goto LABEL_105;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_96;
}
operator delete(v56);
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_97:
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_99:
v26 = __src[0] & 1;
LABEL_100:
if ( v26 )
operator delete(data);
return;
}
LABEL_98:
operator delete(v64.__r_.__value_.__l.__data_);
goto LABEL_99;
}
LABEL_105:
operator delete(v52.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_99;
goto LABEL_98;
}
}
memmove(v46, v43, v45);
goto LABEL_94;
}
LABEL_80:
v43 = (const char *)data;
goto LABEL_81;
}
}