//
// sub_100530410 from 0x100530410 to 0x1005307bf (943 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051deed
//
// 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:49 +0000
//
void __fastcall sub_100530410(__int64 a1, unsigned __int8 *a2, unsigned __int8 *a3)
{
unsigned __int8 *v5; // rsi
unsigned int v6; // r15d
unsigned __int64 v7; // r15
unsigned __int8 *v8; // r14
size_t v9; // r15
char *v10; // r13
unsigned int v11; // r14d
size_t v12; // rbx
char *v13; // rbx
const void *v14; // r13
unsigned __int64 v15; // rcx
char *v16; // r15
size_t v17; // rdx
__int64 v18; // rdi
size_t v19; // rax
size_t v20; // r12
char *v21; // r14
size_t v22; // rbx
__int64 v23; // r12
unsigned int v24; // ebx
__int64 v25; // rax
const char *CString; // r13
size_t v27; // rax
size_t v28; // r12
char v29; // r14
__int64 v30; // rdi
size_t v31; // rbx
__int64 v32; // rax
__int64 v33; // r15
void (__fastcall ***v34)(_QWORD, __int64); // rdi
__int64 v35; // rdi
__int128 v36; // [rsp+0h] [rbp-70h] BYREF
void *__p; // [rsp+10h] [rbp-60h]
__int64 v38; // [rsp+20h] [rbp-50h]
unsigned int v39; // [rsp+2Ch] [rbp-44h]
char __dst[16]; // [rsp+30h] [rbp-40h] BYREF
char *v41; // [rsp+40h] [rbp-30h]
if ( (*a3 & 1) != 0 )
v5 = *((unsigned __int8 **)a3 + 2);
else
v5 = a3 + 1;
v38 = a1;
GameLevelManager::removeDLFromActive(a1, v5);
v6 = *a3;
if ( (v6 & 1) == 0 )
{
if ( (unsigned __int8)v6 > 0xCu )
{
v7 = v6 >> 1;
v8 = a3 + 1;
goto LABEL_9;
}
LABEL_14:
v11 = 0;
goto LABEL_20;
}
v7 = *((_QWORD *)a3 + 1);
if ( v7 <= 6 )
goto LABEL_14;
v8 = *((unsigned __int8 **)a3 + 2);
LABEL_9:
v9 = v7 - 6;
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_64;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v10 = (char *)operator new(v12);
v41 = v10;
*(_QWORD *)__dst = v12 + 1;
*(_QWORD *)&__dst[8] = v9;
}
else
{
__dst[0] = 2 * v9;
v10 = &__dst[1];
if ( !v9 )
{
__dst[1] = 0;
if ( (__dst[0] & 1) == 0 )
{
LABEL_13:
v11 = atoi(&__dst[1]);
goto LABEL_20;
}
goto LABEL_19;
}
}
memmove(v10, v8 + 6, v9);
v10[v9] = 0;
if ( (__dst[0] & 1) == 0 )
goto LABEL_13;
LABEL_19:
v13 = v41;
v11 = atoi(v41);
operator delete(v13);
LABEL_20:
strcpy(&__dst[1], "-1");
v14 = a2 + 1;
v15 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
v14 = *((const void **)a2 + 2);
v16 = &__dst[1];
if ( (*a2 & 1) != 0 )
v15 = *((_QWORD *)a2 + 1);
v17 = 2;
if ( v15 < 2 )
v17 = v15;
if ( !((v15 != 2) | (memcmp(v14, &__dst[1], v17) != 0)) )
{
v18 = *(_QWORD *)(v38 + 1336);
if ( v18 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v18 + 8LL))(v18, v11, 0xFFFFFFFFLL);
return;
}
v19 = strlen((const char *)v14);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_64;
v20 = v19;
v39 = v11;
if ( v19 >= 0x17 )
{
v22 = 26;
if ( (v19 | 7) != 0x17 )
v22 = (v19 | 7) + 1;
v21 = (char *)operator new(v22);
v41 = v21;
*(_QWORD *)__dst = v22 + 1;
*(_QWORD *)&__dst[8] = v20;
goto LABEL_36;
}
__dst[0] = 2 * v19;
v21 = &__dst[1];
if ( v19 )
LABEL_36:
memmove(v21, v14, v20);
v21[v20] = 0;
v23 = sub_10053FBE0(__dst, "#");
v24 = v39;
if ( (__dst[0] & 1) != 0 )
operator delete(v41);
if ( v23 && (unsigned int)sub_1007FEF90(v23) )
{
v25 = sub_1007FEFE0(v23, 0);
CString = (const char *)cocos2d::CCString::getCString(v25);
v27 = strlen(CString);
if ( v27 < 0xFFFFFFFFFFFFFFF8LL )
{
v28 = v27;
if ( v27 >= 0x17 )
{
v31 = 26;
if ( (v27 | 7) != 0x17 )
v31 = (v27 | 7) + 1;
v16 = (char *)operator new(v31);
v41 = v16;
*(_QWORD *)__dst = v31 + 1;
*(_QWORD *)&__dst[8] = v28;
}
else
{
__dst[0] = 2 * v27;
if ( !v27 )
{
__dst[1] = 0;
v29 = __dst[0];
if ( (__dst[0] & 1) == 0 )
{
LABEL_45:
__p = v41;
v36 = *(_OWORD *)__dst;
LABEL_53:
v32 = GameLevelManager::responseToDict(&v36, 0);
v33 = GJEditorSoundConfig::create(v32);
if ( (v36 & 1) != 0 )
operator delete(__p);
if ( v33 && *(_BYTE *)(v33 + 496) )
{
v34 = *(void (__fastcall ****)(_QWORD, __int64))(v38 + 1336);
if ( v34 )
(**v34)(v34, v33);
}
else
{
v35 = *(_QWORD *)(v38 + 1336);
if ( v35 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v35 + 8LL))(v35, v39, 4294967293LL);
}
if ( (v29 & 1) != 0 )
operator delete(v41);
return;
}
LABEL_52:
sub_10001AD30(&v36, v41, *(unsigned __int64 *)&__dst[8]);
goto LABEL_53;
}
}
memmove(v16, CString, v28);
v16[v28] = 0;
v29 = __dst[0];
if ( (__dst[0] & 1) == 0 )
goto LABEL_45;
goto LABEL_52;
}
LABEL_64:
sub_100003630();
}
v30 = *(_QWORD *)(v38 + 1336);
if ( v30 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v30 + 8LL))(v30, v24, 4294967294LL);
}