//
// sub_10053B520 from 0x10053b520 to 0x10053bfd4 (2740 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051da9d
//
// 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:31:55 +0000
//
__int64 __fastcall sub_10053B520(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
const char *v3; // r14
size_t v4; // rax
std::string::size_type v5; // r12
char *data; // r13
size_t v7; // r15
const char *v8; // r15
unsigned __int64 v9; // rcx
const void *v10; // rdi
size_t v11; // rdx
__int64 result; // rax
__int64 v13; // rdi
__int64 v14; // r13
size_t v15; // rax
std::string::size_type v16; // rbx
char *v17; // r14
size_t v18; // r12
__int64 v19; // r12
unsigned int v20; // ebx
int v21; // ebx
__int64 v22; // rax
const char *CString; // r15
size_t v24; // rax
std::string::size_type v25; // rbx
char *v26; // r14
size_t v27; // r12
__int64 v28; // r15
char *v29; // rbx
__int64 v30; // rax
__int64 v31; // rax
__int64 v32; // rax
const char *v33; // r14
size_t v34; // rax
std::string::size_type v35; // r12
char *v36; // r13
size_t v37; // r15
__int64 v38; // rax
const char *v39; // r14
size_t v40; // rax
std::string::size_type v41; // r12
char *v42; // r13
size_t v43; // r15
__int64 v44; // rax
__int64 v45; // rax
const std::string::value_type *v46; // rax
__int64 v47; // rax
const std::string::value_type *v48; // rax
__int64 v49; // rax
const char *v50; // r14
size_t v51; // rax
std::string::size_type v52; // r12
char *v53; // r13
size_t v54; // r15
__int64 v55; // rax
const char *v56; // r14
size_t v57; // rax
std::string::size_type v58; // r12
char *v59; // r13
size_t v60; // r15
__int64 v61; // rax
__int64 v62; // rax
__int64 v63; // rax
__int64 v64; // rax
__int64 v65; // rax
__int64 v66; // rax
__int64 v67; // rax
__int64 v68; // rax
__int64 v69; // rax
const std::string::value_type *v70; // rax
__int64 v71; // rax
const char *v72; // rax
unsigned int v73; // ebx
int v74; // r14d
__int64 v75; // r15
__int64 v76; // rdi
__int64 v77; // r15
std::string v78; // [rsp+8h] [rbp-C8h] BYREF
std::string v79; // [rsp+20h] [rbp-B0h] BYREF
std::string v80; // [rsp+38h] [rbp-98h] BYREF
std::string v81; // [rsp+50h] [rbp-80h] BYREF
__int64 v82; // [rsp+68h] [rbp-68h]
__int64 v83; // [rsp+70h] [rbp-60h]
__int64 v84; // [rsp+78h] [rbp-58h]
__int64 v85; // [rsp+80h] [rbp-50h]
__int64 v86; // [rsp+88h] [rbp-48h]
std::string __dst[2]; // [rsp+90h] [rbp-40h] BYREF
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(const char **)(a3 + 16);
else
v3 = (const char *)(a3 + 1);
v4 = strlen(v3);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v5 = v4;
v84 = *(_QWORD *)(a1 + 1088);
v83 = a1;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
data = (char *)operator new(v7);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v7 + 1;
__dst[0].__r_.__value_.__l.__size_ = v5;
goto LABEL_11;
}
data = __dst[0].__r_.__value_.__s.__data_;
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v4);
if ( v4 )
LABEL_11:
memmove(data, v3, v5);
data[v5] = 0;
cocos2d::CCDictionary::removeObjectForKey(v84, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)4;
*(_WORD *)((char *)&__dst[0].__r_.__value_.__l.0 + 1) = 12589;
__dst[0].__r_.__value_.__s.__data_[2] = 0;
v8 = (const char *)(a2 + 1);
v9 = *a2 >> 1;
v10 = *((const void **)a2 + 2);
if ( (*a2 & 1) != 0 )
v9 = *((_QWORD *)a2 + 1);
else
v10 = a2 + 1;
v11 = 2;
if ( v9 < 2 )
v11 = v9;
if ( !((v9 != 2) | (memcmp(v10, (char *)&__dst[0].__r_.__value_.__l.0 + 1, v11) != 0)) )
{
result = v83;
v13 = *(_QWORD *)(v83 + 1264);
if ( v13 )
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 104LL))(v13);
return result;
}
v14 = sub_1007FE900(v10);
if ( (*a2 & 1) != 0 )
{
if ( !*((_QWORD *)a2 + 1) )
goto LABEL_113;
v8 = *((const char **)a2 + 2);
}
else if ( !*a2 )
{
goto LABEL_113;
}
v15 = strlen(v8);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_121:
sub_100003630();
v16 = v15;
if ( v15 >= 0x17 )
{
v18 = 26;
if ( (v15 | 7) != 0x17 )
v18 = (v15 | 7) + 1;
v17 = (char *)operator new(v18);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v17;
__dst[0].__r_.__value_.__r.__words[0] = v18 + 1;
__dst[0].__r_.__value_.__l.__size_ = v16;
goto LABEL_34;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v15);
v17 = __dst[0].__r_.__value_.__s.__data_;
if ( v15 )
LABEL_34:
memmove(v17, v8, v16);
v17[v16] = 0;
v19 = sub_10053FBE0(__dst, "|");
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( (unsigned int)sub_1007FEF90(v19) )
{
v20 = 0;
v85 = v19;
v82 = v14;
while ( 1 )
{
LODWORD(v84) = v20;
v22 = cocos2d::CCArray::stringAtIndex(v19, v20);
CString = (const char *)cocos2d::CCString::getCString(v22);
v24 = strlen(CString);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v25 = v24;
if ( v24 >= 0x17 )
break;
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v24);
v26 = __dst[0].__r_.__value_.__s.__data_;
if ( v24 )
goto LABEL_48;
LABEL_49:
v26[v25] = 0;
v28 = sub_10053FBE0(__dst, ":");
v21 = v84;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( (unsigned int)sub_1007FEF90(v28) < 6 )
goto LABEL_40;
v29 = (char *)operator new(0x150u);
cocos2d::CCObject::CCObject((__int64)v29);
*(_QWORD *)v29 = off_100B6FDC8;
*(_OWORD *)(v29 + 56) = 0;
*(_OWORD *)(v29 + 72) = 0;
*(_OWORD *)(v29 + 88) = 0;
*(_OWORD *)(v29 + 104) = 0;
*(_OWORD *)(v29 + 120) = 0;
*(_OWORD *)(v29 + 136) = 0;
*(_OWORD *)(v29 + 152) = 0;
*((_DWORD *)v29 + 42) = 2;
*((_DWORD *)v29 + 52) = 0;
*((_QWORD *)v29 + 35) = 0;
*((_DWORD *)v29 + 72) = 0;
*((_QWORD *)v29 + 37) = 0;
*((_WORD *)v29 + 152) = 0;
*((_OWORD *)v29 + 11) = 0;
*(_OWORD *)(v29 + 189) = 0;
*(_OWORD *)(v29 + 216) = 0;
*(_OWORD *)(v29 + 232) = 0;
*(_OWORD *)(v29 + 248) = 0;
*((_WORD *)v29 + 132) = 0;
*(_DWORD *)(v29 + 271) = 0;
*((_DWORD *)v29 + 67) = 0;
*(_OWORD *)(v29 + 308) = 0;
*(_QWORD *)(v29 + 324) = 0;
cocos2d::CCObject::autorelease((__int64)v29);
v30 = cocos2d::CCArray::stringAtIndex(v28, 0);
*((_DWORD *)v29 + 14) = cocos2d::CCString::intValue(v30);
v31 = cocos2d::CCArray::stringAtIndex(v28, 1);
*((_DWORD *)v29 + 15) = cocos2d::CCString::intValue(v31);
v32 = cocos2d::CCArray::stringAtIndex(v28, 2);
v33 = (const char *)cocos2d::CCString::getCString(v32);
v34 = strlen(v33);
if ( v34 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v35 = v34;
v86 = v28;
if ( v34 >= 0x17 )
{
v37 = (v34 | 7) + 1;
if ( (v34 | 7) == 0x17 )
v37 = 26;
v36 = (char *)operator new(v37);
v78.__r_.__value_.__r.__words[2] = (std::string::size_type)v36;
v78.__r_.__value_.__r.__words[0] = v37 + 1;
v28 = v86;
v78.__r_.__value_.__l.__size_ = v35;
LABEL_59:
memmove(v36, v33, v35);
goto LABEL_60;
}
v78.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v34);
v36 = v78.__r_.__value_.__s.__data_;
if ( v34 )
goto LABEL_59;
LABEL_60:
v36[v35] = 0;
LevelTools::base64DecodeString(__dst, &v78);
if ( (v29[64] & 1) != 0 )
operator delete(*((void **)v29 + 10));
*(std::string *)(v29 + 64) = __dst[0];
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v78.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v78.__r_.__value_.__l.__data_);
v38 = cocos2d::CCArray::stringAtIndex(v28, 3);
v39 = (const char *)cocos2d::CCString::getCString(v38);
v40 = strlen(v39);
if ( v40 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v41 = v40;
if ( v40 >= 0x17 )
{
v43 = (v40 | 7) + 1;
if ( (v40 | 7) == 0x17 )
v43 = 26;
v42 = (char *)operator new(v43);
v79.__r_.__value_.__r.__words[2] = (std::string::size_type)v42;
v79.__r_.__value_.__r.__words[0] = v43 + 1;
v28 = v86;
v79.__r_.__value_.__l.__size_ = v41;
LABEL_71:
memmove(v42, v39, v41);
goto LABEL_72;
}
v79.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v40);
v42 = v79.__r_.__value_.__s.__data_;
if ( v40 )
goto LABEL_71;
LABEL_72:
v42[v41] = 0;
LevelTools::base64DecodeString(__dst, &v79);
v14 = v82;
v19 = v85;
if ( (v29[88] & 1) != 0 )
operator delete(*((void **)v29 + 13));
*(std::string *)(v29 + 88) = __dst[0];
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v79.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v79.__r_.__value_.__l.__data_);
v44 = cocos2d::CCArray::stringAtIndex(v28, 4);
*((_DWORD *)v29 + 42) = cocos2d::CCString::intValue(v44);
v45 = cocos2d::CCArray::stringAtIndex(v28, 5);
v46 = (const std::string::value_type *)cocos2d::CCString::getCString(v45);
std::string::assign((std::string *)v29 + 6, v46);
if ( (unsigned int)sub_1007FEF90(v28) >= 7 )
{
v47 = cocos2d::CCArray::stringAtIndex(v28, 6);
v48 = (const std::string::value_type *)cocos2d::CCString::getCString(v47);
std::string::assign((std::string *)(v29 + 176), v48);
}
if ( (unsigned int)sub_1007FEF90(v28) >= 8 )
{
v49 = cocos2d::CCArray::stringAtIndex(v28, 7);
v50 = (const char *)cocos2d::CCString::getCString(v49);
v51 = strlen(v50);
if ( v51 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v52 = v51;
if ( v51 >= 0x17 )
{
v54 = (v51 | 7) + 1;
if ( (v51 | 7) == 0x17 )
v54 = 26;
v53 = (char *)operator new(v54);
v80.__r_.__value_.__r.__words[2] = (std::string::size_type)v53;
v80.__r_.__value_.__r.__words[0] = v54 + 1;
v28 = v86;
v80.__r_.__value_.__l.__size_ = v52;
}
else
{
v80.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v51);
v53 = v80.__r_.__value_.__s.__data_;
if ( !v51 )
goto LABEL_87;
}
memmove(v53, v50, v52);
LABEL_87:
v53[v52] = 0;
LevelTools::base64DecodeString(__dst, &v80);
v14 = v82;
v19 = v85;
if ( (v29[120] & 1) != 0 )
operator delete(*((void **)v29 + 17));
*((std::string *)v29 + 5) = __dst[0];
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v80.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v80.__r_.__value_.__l.__data_);
}
if ( (unsigned int)sub_1007FEF90(v28) < 9 )
goto LABEL_104;
v55 = cocos2d::CCArray::stringAtIndex(v28, 8);
v56 = (const char *)cocos2d::CCString::getCString(v55);
v57 = strlen(v56);
if ( v57 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_121;
v58 = v57;
if ( v57 >= 0x17 )
{
v60 = (v57 | 7) + 1;
if ( (v57 | 7) == 0x17 )
v60 = 26;
v59 = (char *)operator new(v60);
v81.__r_.__value_.__r.__words[2] = (std::string::size_type)v59;
v81.__r_.__value_.__r.__words[0] = v60 + 1;
v28 = v86;
v81.__r_.__value_.__l.__size_ = v58;
}
else
{
v81.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v57);
v59 = v81.__r_.__value_.__s.__data_;
if ( !v57 )
goto LABEL_100;
}
memmove(v59, v56, v58);
LABEL_100:
v59[v58] = 0;
LevelTools::base64DecodeString(__dst, &v81);
v14 = v82;
v19 = v85;
if ( (v29[216] & 1) != 0 )
operator delete(*((void **)v29 + 29));
*((std::string *)v29 + 9) = __dst[0];
*(_WORD *)&__dst[0].__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v81.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v81.__r_.__value_.__l.__data_);
LABEL_104:
if ( (unsigned int)sub_1007FEF90(v28) >= 0xB )
{
v61 = cocos2d::CCArray::stringAtIndex(v28, 9);
v29[264] = (unsigned int)cocos2d::CCString::intValue(v61) != 0;
v62 = cocos2d::CCArray::stringAtIndex(v28, 10);
v29[273] = (unsigned int)cocos2d::CCString::intValue(v62) != 0;
if ( (unsigned int)sub_1007FEF90(v28) < 0x11 )
{
LABEL_106:
if ( (unsigned int)sub_1007FEF90(v28) < 0x12 )
goto LABEL_107;
goto LABEL_111;
}
}
else if ( (unsigned int)sub_1007FEF90(v28) < 0x11 )
{
goto LABEL_106;
}
v29[305] = 1;
v63 = cocos2d::CCArray::stringAtIndex(v28, 11);
*((_DWORD *)v29 + 77) = cocos2d::CCString::intValue(v63);
v64 = cocos2d::CCArray::stringAtIndex(v28, 12);
*((_DWORD *)v29 + 78) = cocos2d::CCString::intValue(v64);
v65 = cocos2d::CCArray::stringAtIndex(v28, 13);
*((_DWORD *)v29 + 79) = cocos2d::CCString::intValue(v65);
v66 = cocos2d::CCArray::stringAtIndex(v28, 14);
*((_DWORD *)v29 + 80) = cocos2d::CCString::intValue(v66);
v67 = cocos2d::CCArray::stringAtIndex(v28, 15);
*((_DWORD *)v29 + 81) = cocos2d::CCString::intValue(v67);
v68 = cocos2d::CCArray::stringAtIndex(v28, 16);
*((_DWORD *)v29 + 82) = cocos2d::CCString::intValue(v68);
if ( (unsigned int)sub_1007FEF90(v28) < 0x12 )
{
LABEL_107:
if ( (unsigned int)sub_1007FEF90(v28) >= 0x13 )
goto LABEL_112;
goto LABEL_39;
}
LABEL_111:
v69 = cocos2d::CCArray::stringAtIndex(v28, 17);
v70 = (const std::string::value_type *)cocos2d::CCString::getCString(v69);
std::string::assign((std::string *)v29 + 10, v70);
if ( (unsigned int)sub_1007FEF90(v28) >= 0x13 )
{
LABEL_112:
v71 = cocos2d::CCArray::stringAtIndex(v28, 18);
v72 = (const char *)cocos2d::CCString::getCString(v71);
*((_QWORD *)v29 + 37) = atoll(v72);
}
LABEL_39:
sub_1007FEBF0(v14, v29);
v21 = v84;
LABEL_40:
v20 = v21 + 1;
if ( v20 >= (unsigned int)sub_1007FEF90(v19) )
goto LABEL_113;
}
v27 = (v24 | 7) + 1;
if ( (v24 | 7) == 0x17 )
v27 = 26;
v26 = (char *)operator new(v27);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v26;
__dst[0].__r_.__value_.__r.__words[0] = v27 + 1;
v19 = v85;
__dst[0].__r_.__value_.__l.__size_ = v25;
LABEL_48:
memmove(v26, CString, v25);
goto LABEL_49;
}
LABEL_113:
result = sub_1007FEF90(v14);
if ( !(_DWORD)result )
{
v77 = v83;
*(_DWORD *)(v83 + 476) = 0;
v76 = *(_QWORD *)(v77 + 1264);
if ( !v76 )
return result;
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v76 + 96LL))(v76, v14);
}
v73 = 0;
v74 = 0;
v75 = v83;
do
{
v74 += *(unsigned __int8 *)(sub_1007FEFE0(v14, v73++) + 273) ^ 1;
result = sub_1007FEF90(v14);
}
while ( v73 < (unsigned int)result );
*(_DWORD *)(v75 + 476) = v74;
v76 = *(_QWORD *)(v75 + 1264);
if ( v76 )
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v76 + 96LL))(v76, v14);
return result;
}