//
// sub_100531820 from 0x100531820 to 0x1005322c3 (2723 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051ef6f
//
// 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:50 +0000
//
void __fastcall sub_100531820(__int64 a1, std::string *a2, const std::string *a3)
{
const char *data; // r12
void *v5; // r15
size_t v6; // rax
size_t v7; // r13
char *v8; // r14
size_t v9; // r15
std::string *v10; // r12
std::string::size_type v11; // rax
std::string::pointer v12; // rbx
__int64 v13; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v14; // r14
std::string::pointer v15; // r15
unsigned __int64 v16; // rax
unsigned __int64 size; // rbx
std::string::pointer v18; // r12
std::string::pointer v19; // rdi
size_t v20; // rdx
__int64 v21; // rdi
std::string *v22; // rbx
__int64 v23; // rdi
std::string::size_type v24; // rax
std::string::size_type v25; // r12
unsigned int v26; // r13d
std::string::size_type v27; // r13
void *v28; // rsi
const char *v29; // r12
char *v30; // r14
unsigned int v31; // eax
std::string::size_type v32; // rax
size_t v33; // rbx
std::string::size_type v34; // r12
std::string::size_type v35; // r14
char *v36; // rbx
size_t v37; // r13
__int64 v38; // r14
__int64 v39; // rax
__int64 v40; // rax
size_t v41; // rax
std::string::size_type v42; // rbx
char *v43; // r14
size_t v44; // r15
unsigned int v45; // eax
__int64 v46; // rax
const char *CString; // r14
size_t v48; // rax
std::string::size_type v49; // rbx
char *v50; // r12
__int64 v51; // rax
size_t v52; // r15
char *v53; // r12
__int64 v54; // rax
const std::string::value_type *v55; // rax
__int64 v56; // rax
const std::string::value_type *v57; // rax
__int64 v58; // rax
__int64 v59; // rax
__int64 v60; // rax
const char *v61; // rbx
size_t v62; // rax
std::string::size_type v63; // r13
char *v64; // r15
__int64 v65; // rax
size_t v66; // r14
__int64 v67; // rax
const char *v68; // rbx
size_t v69; // rax
std::string::size_type v70; // r13
char *v71; // r15
__int64 v72; // rax
size_t v73; // r14
__int64 v74; // rax
const char *v75; // rax
__int64 v76; // rax
__int64 v77; // rax
const char *v78; // rbx
size_t v79; // rax
std::string::size_type v80; // r14
char *v81; // r15
__int64 v82; // rax
size_t v83; // r13
__int64 v84; // rdi
__int64 v85; // [rsp+10h] [rbp-E0h]
std::string v86; // [rsp+18h] [rbp-D8h] BYREF
std::string v87; // [rsp+30h] [rbp-C0h] BYREF
std::string v88; // [rsp+48h] [rbp-A8h] BYREF
__int64 v89; // [rsp+60h] [rbp-90h]
__int64 v90; // [rsp+68h] [rbp-88h]
__int64 v91; // [rsp+70h] [rbp-80h]
unsigned int i; // [rsp+78h] [rbp-78h]
unsigned int v93; // [rsp+7Ch] [rbp-74h]
void *__src; // [rsp+80h] [rbp-70h]
int v95; // [rsp+8Ch] [rbp-64h]
__int128 __dst; // [rsp+90h] [rbp-60h] BYREF
void *__p; // [rsp+A0h] [rbp-50h]
std::string v98; // [rsp+A8h] [rbp-48h] BYREF
std::string *v99; // [rsp+C0h] [rbp-30h]
v99 = a2;
v90 = a1;
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
data = a3->__r_.__value_.__l.__data_;
else
data = a3->__r_.__value_.__s.__data_;
v5 = *(void **)(v90 + 1088);
v6 = strlen(data);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v7 = v6;
if ( v6 >= 0x17 )
{
__src = *(void **)(v90 + 1088);
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
*(_QWORD *)&__dst = v9 + 1;
v5 = __src;
*((_QWORD *)&__dst + 1) = v7;
goto LABEL_11;
}
v8 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v6;
if ( v6 )
LABEL_11:
memmove(v8, data, v7);
v8[v7] = 0;
cocos2d::CCDictionary::removeObjectForKey((__int64)v5, (char *)&__dst);
v10 = v99;
if ( (__dst & 1) != 0 )
operator delete(__p);
v91 = 0;
v11 = std::string::find(a3, 95, 0);
if ( v11 != -1 )
{
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
v12 = a3->__r_.__value_.__l.__data_;
else
v12 = a3->__r_.__value_.__s.__data_;
LODWORD(v13) = atoi(&v12[v11 + 1]);
v91 = v13;
}
LOBYTE(__dst) = 4;
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v14 = v10->__r_.__value_.__s.0;
v15 = v10->__r_.__value_.__s.__data_;
v16 = *(_BYTE *)&v10->__r_.__value_.__l.0 >> 1;
size = v10->__r_.__value_.__l.__size_;
v18 = v10->__r_.__value_.__l.__data_;
v19 = v18;
if ( (*(_BYTE *)&v14 & 1) != 0 )
v16 = size;
else
v19 = v15;
v20 = 2;
if ( v16 < 2 )
v20 = v16;
if ( !((v16 != 2) | (memcmp(v19, (char *)&__dst + 1, v20) != 0)) )
{
v21 = *(_QWORD *)(v90 + 1256);
if ( v21 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 248LL))(v21, v91);
return;
}
if ( (*(_BYTE *)&v14 & 1) != 0 )
{
sub_10001AD30(&__dst, v18, size);
v22 = v99;
}
else
{
v22 = v99;
__p = v99->__r_.__value_.__l.__data_;
__dst = *(_OWORD *)&v99->__r_.__value_.__l.0;
}
v85 = 0;
v23 = (__int64)v22;
v24 = std::string::find(v22, 35, 0);
v95 = -1;
v93 = 50;
if ( v24 == -1 )
{
v29 = (char *)&__dst + 1;
goto LABEL_64;
}
v25 = v24;
v26 = (unsigned int)v22->__r_.__value_.__l.0;
if ( (v26 & 1) != 0 )
{
v27 = v22->__r_.__value_.__l.__size_;
v28 = v22->__r_.__value_.__l.__data_;
}
else
{
v27 = v26 >> 1;
v28 = v15;
}
if ( v27 >= v24 )
v27 = v24;
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v27 >= 0x17 )
{
__src = v28;
v33 = 26;
if ( (v27 | 7) != 0x17 )
v33 = (v27 | 7) + 1;
v30 = (char *)operator new(v33);
v98.__r_.__value_.__r.__words[2] = (std::string::size_type)v30;
v98.__r_.__value_.__r.__words[0] = v33 | 1;
v98.__r_.__value_.__l.__size_ = v27;
v28 = __src;
}
else
{
v98.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v27);
v30 = v98.__r_.__value_.__s.__data_;
if ( !v27 )
{
v98.__r_.__value_.__s.__data_[0] = 0;
if ( (__dst & 1) == 0 )
goto LABEL_42;
goto LABEL_41;
}
}
memmove(v30, v28, v27);
v30[v27] = 0;
if ( (__dst & 1) != 0 )
LABEL_41:
operator delete(__p);
LABEL_42:
__p = v98.__r_.__value_.__l.__data_;
__dst = *(_OWORD *)&v98.__r_.__value_.__l.0;
v31 = (unsigned int)v99->__r_.__value_.__l.0;
if ( (v31 & 1) != 0 )
{
v32 = v99->__r_.__value_.__l.__size_;
if ( v32 <= v25 )
goto LABEL_146;
v15 = v99->__r_.__value_.__l.__data_;
}
else
{
v32 = v31 >> 1;
if ( v25 >= v32 )
LABEL_146:
sub_100056810();
}
v34 = v25 + 1;
v35 = v32 - v34;
if ( v32 - v34 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v35 >= 0x17 )
{
v37 = 26;
if ( (v35 | 7) != 0x17 )
v37 = (v35 | 7) + 1;
v36 = (char *)operator new(v37);
v98.__r_.__value_.__r.__words[2] = (std::string::size_type)v36;
v98.__r_.__value_.__r.__words[0] = v37 | 1;
v98.__r_.__value_.__l.__size_ = v35;
}
else
{
v98.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v35);
v36 = v98.__r_.__value_.__s.__data_;
if ( v32 == v34 )
goto LABEL_60;
}
memmove(v36, &v15[v34], v35);
LABEL_60:
v36[v35] = 0;
v38 = sub_10053FBE0(&v98, ":");
v29 = (char *)&__dst + 1;
if ( (*(_BYTE *)&v98.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v98.__r_.__value_.__l.__data_);
v23 = v38;
if ( (unsigned int)sub_1007FEF90(v38) >= 3 )
{
v39 = cocos2d::CCArray::stringAtIndex(v38, 0);
v95 = cocos2d::CCString::intValue(v39);
v40 = cocos2d::CCArray::stringAtIndex(v38, 1);
v85 = cocos2d::CCString::intValue(v40);
v23 = cocos2d::CCArray::stringAtIndex(v38, 2);
v93 = cocos2d::CCString::intValue(v23);
}
LABEL_64:
v89 = sub_1007FE900(v23);
if ( (__dst & 1) == 0 )
{
if ( !(_BYTE)__dst )
goto LABEL_133;
LABEL_69:
v41 = strlen(v29);
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);
v98.__r_.__value_.__r.__words[2] = (std::string::size_type)v43;
v98.__r_.__value_.__r.__words[0] = v44 | 1;
v98.__r_.__value_.__l.__size_ = v42;
}
else
{
v98.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v41);
v43 = v98.__r_.__value_.__s.__data_;
if ( !v41 )
goto LABEL_77;
}
memmove(v43, v29, v42);
LABEL_77:
v43[v42] = 0;
__src = (void *)sub_10053FBE0(&v98, "|");
if ( (*(_BYTE *)&v98.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v98.__r_.__value_.__l.__data_);
for ( i = 0; ; ++i )
{
v45 = sub_1007FEF90(__src);
if ( i >= v45 )
goto LABEL_133;
v46 = cocos2d::CCArray::stringAtIndex(__src, i);
CString = (const char *)cocos2d::CCString::getCString(v46);
v48 = strlen(CString);
if ( v48 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v49 = v48;
if ( v48 >= 0x17 )
break;
v98.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v48);
v50 = v98.__r_.__value_.__s.__data_;
if ( v48 )
goto LABEL_90;
LABEL_91:
v50[v49] = 0;
v99 = (std::string *)sub_10053FBE0(&v98, ":");
if ( (*(_BYTE *)&v98.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v98.__r_.__value_.__l.__data_);
if ( (unsigned int)sub_1007FEF90(v99) >= 7 )
{
v53 = (char *)operator new(0xC8u);
cocos2d::CCObject::CCObject((__int64)v53);
*(_QWORD *)v53 = off_100B6FBE8;
*(_OWORD *)(v53 + 56) = 0;
*(_OWORD *)(v53 + 72) = 0;
*(_OWORD *)(v53 + 88) = 0;
*(_OWORD *)(v53 + 100) = 0;
*(_OWORD *)(v53 + 120) = 0;
*(_OWORD *)(v53 + 136) = 0;
*(_OWORD *)(v53 + 152) = 0;
*(_OWORD *)(v53 + 168) = 0;
*(_OWORD *)(v53 + 184) = 0;
cocos2d::CCObject::autorelease((__int64)v53);
v54 = cocos2d::CCArray::stringAtIndex(v99, 0);
v55 = (const std::string::value_type *)cocos2d::CCString::getCString(v54);
std::string::assign((std::string *)(v53 + 56), v55);
v56 = cocos2d::CCArray::stringAtIndex(v99, 1);
v57 = (const std::string::value_type *)cocos2d::CCString::getCString(v56);
std::string::assign((std::string *)(v53 + 80), v57);
v58 = cocos2d::CCArray::stringAtIndex(v99, 2);
*((_DWORD *)v53 + 26) = cocos2d::CCString::intValue(v58);
v59 = cocos2d::CCArray::stringAtIndex(v99, 3);
*((_DWORD *)v53 + 27) = cocos2d::CCString::intValue(v59);
v60 = cocos2d::CCArray::stringAtIndex(v99, 4);
v61 = (const char *)cocos2d::CCString::getCString(v60);
v62 = strlen(v61);
if ( v62 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v63 = v62;
if ( v62 >= 0x17 )
{
v65 = v62 | 7;
v66 = 26;
if ( (v63 | 7) != 0x17 )
v66 = v65 + 1;
v64 = (char *)operator new(v66);
v86.__r_.__value_.__r.__words[2] = (std::string::size_type)v64;
v86.__r_.__value_.__r.__words[0] = v66 | 1;
v86.__r_.__value_.__l.__size_ = v63;
}
else
{
v86.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v62);
v64 = v86.__r_.__value_.__s.__data_;
if ( !v62 )
{
LABEL_102:
v64[v63] = 0;
LevelTools::base64DecodeString(&v98, &v86);
if ( (v53[120] & 1) != 0 )
operator delete(*((void **)v53 + 17));
*((std::string *)v53 + 5) = v98;
*(_WORD *)&v98.__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v86.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v86.__r_.__value_.__l.__data_);
v67 = cocos2d::CCArray::stringAtIndex(v99, 5);
v68 = (const char *)cocos2d::CCString::getCString(v67);
v69 = strlen(v68);
if ( v69 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v70 = v69;
if ( v69 >= 0x17 )
{
v72 = v69 | 7;
v73 = 26;
if ( (v70 | 7) != 0x17 )
v73 = v72 + 1;
v71 = (char *)operator new(v73);
v87.__r_.__value_.__r.__words[2] = (std::string::size_type)v71;
v87.__r_.__value_.__r.__words[0] = v73 | 1;
v87.__r_.__value_.__l.__size_ = v70;
}
else
{
v87.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v69);
v71 = v87.__r_.__value_.__s.__data_;
if ( !v69 )
{
LABEL_114:
v71[v70] = 0;
LevelTools::base64DecodeString(&v98, &v87);
if ( (v53[168] & 1) != 0 )
operator delete(*((void **)v53 + 23));
*((std::string *)v53 + 7) = v98;
*(_WORD *)&v98.__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v87.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v87.__r_.__value_.__l.__data_);
v74 = cocos2d::CCArray::stringAtIndex(v99, 6);
v75 = (const char *)cocos2d::CCString::getCString(v74);
*((_QWORD *)v53 + 24) = atoll(v75);
if ( (unsigned int)sub_1007FEF90(v99) >= 8 )
{
v76 = cocos2d::CCArray::stringAtIndex(v99, 7);
*((_DWORD *)v53 + 28) = cocos2d::CCString::intValue(v76);
}
if ( (unsigned int)sub_1007FEF90(v99) < 9 )
goto LABEL_80;
v77 = cocos2d::CCArray::stringAtIndex(v99, 8);
v78 = (const char *)cocos2d::CCString::getCString(v77);
v79 = strlen(v78);
if ( v79 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v80 = v79;
if ( v79 >= 0x17 )
{
v82 = v79 | 7;
v83 = 26;
if ( (v80 | 7) != 0x17 )
v83 = v82 + 1;
v81 = (char *)operator new(v83);
v88.__r_.__value_.__r.__words[2] = (std::string::size_type)v81;
v88.__r_.__value_.__r.__words[0] = v83 | 1;
v88.__r_.__value_.__l.__size_ = v80;
}
else
{
v88.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v79);
v81 = v88.__r_.__value_.__s.__data_;
if ( !v79 )
{
LABEL_129:
v81[v80] = 0;
LevelTools::base64DecodeString(&v98, &v88);
if ( (v53[144] & 1) != 0 )
operator delete(*((void **)v53 + 20));
*((std::string *)v53 + 6) = v98;
*(_WORD *)&v98.__r_.__value_.__l.0 = 0;
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v88.__r_.__value_.__l.__data_);
LABEL_80:
sub_1007FEBF0(v89, v53);
continue;
}
}
memmove(v81, v78, v80);
goto LABEL_129;
}
}
memmove(v71, v68, v70);
goto LABEL_114;
}
}
memmove(v64, v61, v63);
goto LABEL_102;
}
}
v51 = v48 | 7;
v52 = 26;
if ( (v49 | 7) != 0x17 )
v52 = v51 + 1;
v50 = (char *)operator new(v52);
v98.__r_.__value_.__r.__words[2] = (std::string::size_type)v50;
v98.__r_.__value_.__r.__words[0] = v52 | 1;
v98.__r_.__value_.__l.__size_ = v49;
LABEL_90:
memmove(v50, CString, v49);
goto LABEL_91;
}
if ( *((_QWORD *)&__dst + 1) )
{
v29 = (const char *)__p;
goto LABEL_69;
}
LABEL_133:
if ( v95 < 0 )
v95 = sub_1007FEF90(v89);
v84 = *(_QWORD *)(v90 + 1256);
if ( v84 )
(*(void (__fastcall **)(__int64, __int64, __int64, _QWORD, __int64, _QWORD))(*(_QWORD *)v84 + 240LL))(
v84,
v91,
v89,
(unsigned int)v95,
v85,
v93);
if ( (__dst & 1) != 0 )
operator delete(__p);
}