//
// sub_10053A580 from 0x10053a580 to 0x10053a91c (924 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d6d7
//
// 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:54 +0000
//
void __fastcall sub_10053A580(_QWORD *a1, unsigned __int8 *a2, __int64 a3)
{
unsigned __int8 *v4; // r12
const char *v5; // r13
size_t v6; // rax
size_t v7; // rbx
char *v8; // r15
size_t v9; // r12
__int64 v10; // rax
unsigned int v11; // r14d
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rax
const char *CString; // rax
const void *v16; // r13
unsigned __int64 v17; // rcx
char *v18; // r15
size_t v19; // rdx
__int64 v20; // rdi
size_t v21; // rax
size_t v22; // rbx
char *v23; // r12
size_t v24; // r14
__int64 v25; // r12
__int64 v26; // rax
const char *v27; // r13
size_t v28; // rax
size_t v29; // rbx
size_t v30; // r14
__int64 v31; // rax
bool v32; // r14
__int64 v33; // rbx
__int64 v34; // r15
int v35; // r12d
__int64 v36; // rax
__int64 v37; // rdi
__int64 v38; // [rsp+10h] [rbp-50h]
unsigned int v39; // [rsp+10h] [rbp-50h]
size_t __dst; // [rsp+20h] [rbp-40h] BYREF
size_t v41; // [rsp+28h] [rbp-38h]
void *__p; // [rsp+30h] [rbp-30h]
v4 = a2;
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *(const char **)(a3 + 16);
else
v5 = (const char *)(a3 + 1);
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v7 = v6;
v38 = a1[136];
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst = v9 + 1;
v4 = a2;
v41 = v7;
goto LABEL_11;
}
v8 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v6;
if ( v6 )
LABEL_11:
memmove(v8, v5, v7);
v8[v7] = 0;
cocos2d::CCDictionary::removeObjectForKey(v38, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v10 = sub_10053FBE0(a3, "_");
v11 = 0;
if ( v10 )
{
v12 = v10;
if ( (unsigned int)sub_1007FEF90(v10) >= 3 )
{
v13 = cocos2d::CCArray::stringAtIndex(v12, 1);
v11 = cocos2d::CCString::intValue(v13);
v14 = cocos2d::CCArray::stringAtIndex(v12, 2);
CString = (const char *)cocos2d::CCString::getCString(v14);
a1[67] = atoll(CString);
}
}
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v16 = v4 + 1;
v17 = *v4 >> 1;
if ( (*v4 & 1) != 0 )
v16 = *((const void **)v4 + 2);
v18 = (char *)&__dst + 1;
if ( (*v4 & 1) != 0 )
v17 = *((_QWORD *)v4 + 1);
v19 = 2;
if ( v17 < 2 )
v19 = v17;
if ( !((v17 != 2) | (memcmp(v16, (char *)&__dst + 1, v19) != 0)) )
{
v20 = a1[158];
if ( v20 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v20 + 40LL))(v20, v11);
return;
}
v21 = strlen((const char *)v16);
if ( v21 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v22 = v21;
v39 = v11;
if ( v21 >= 0x17 )
{
v24 = 26;
if ( (v21 | 7) != 0x17 )
v24 = (v21 | 7) + 1;
v23 = (char *)operator new(v24);
__p = v23;
__dst = v24 + 1;
v41 = v22;
goto LABEL_33;
}
LOBYTE(__dst) = 2 * v21;
v23 = (char *)&__dst + 1;
if ( v21 )
LABEL_33:
memmove(v23, v16, v22);
v23[v22] = 0;
v25 = sub_10053FBE0(&__dst, "#");
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_1007FEF90(v25) )
{
v26 = cocos2d::CCArray::stringAtIndex(v25, 0);
v27 = (const char *)cocos2d::CCString::getCString(v26);
v28 = strlen(v27);
if ( v28 < 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_38;
LABEL_57:
sub_100003630();
}
v27 = "";
v28 = strlen("");
if ( v28 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
LABEL_38:
v29 = v28;
if ( v28 >= 0x17 )
{
v30 = 26;
if ( (v28 | 7) != 0x17 )
v30 = (v28 | 7) + 1;
v18 = (char *)operator new(v30);
__p = v18;
__dst = v30 + 1;
v41 = v29;
}
else
{
LOBYTE(__dst) = 2 * v28;
if ( !v28 )
goto LABEL_45;
}
memmove(v18, v27, v29);
LABEL_45:
v18[v29] = 0;
if ( (unsigned int)sub_1007FEF90(v25) < 2 )
{
v32 = 0;
}
else
{
v31 = cocos2d::CCArray::stringAtIndex(v25, 1);
v32 = (unsigned int)cocos2d::CCString::intValue(v31) != 0;
}
v33 = sub_100573A30(&__dst);
v34 = sub_1007FE900(&__dst);
v35 = sub_1007FEF90(v33);
while ( v35 > 0 )
{
v36 = sub_1007FEFE0(v33, (unsigned int)--v35);
sub_1007FEBF0(v34, v36);
}
v37 = a1[158];
if ( v37 )
(*(void (__fastcall **)(__int64, _QWORD, __int64, bool))(*(_QWORD *)v37 + 32LL))(v37, v39, v34, v32);
if ( (__dst & 1) != 0 )
operator delete(__p);
}