//
// sub_100525AF0 from 0x100525af0 to 0x100525f89 (1177 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051eff9
//
// 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:46 +0000
//
void __fastcall sub_100525AF0(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
__int64 v3; // rbx
const void *v4; // r12
unsigned __int64 v5; // rcx
char *v6; // r13
size_t v7; // rdx
__int64 v8; // rdi
size_t v9; // rax
size_t v10; // r15
size_t v11; // r14
__int64 v12; // r12
__int64 v13; // rdi
__int64 v14; // rax
const char *CString; // r15
size_t v16; // rax
size_t v17; // r13
__int64 v18; // rbx
char *v19; // r14
const char *v20; // rbx
size_t v21; // r15
__int64 v22; // rax
const char *v23; // r12
size_t v24; // rax
size_t v25; // r13
char *v26; // r15
size_t v27; // r14
__int64 v28; // r13
__int64 v29; // r15
char v30; // r14
__int64 v31; // r15
char v32; // r12
void (__fastcall ***v33)(_QWORD, __int64, __int64); // rdi
__int128 v34; // [rsp+0h] [rbp-E0h] BYREF
void *v35; // [rsp+10h] [rbp-D0h]
__int128 v36; // [rsp+20h] [rbp-C0h] BYREF
void *v37; // [rsp+30h] [rbp-B0h]
__int64 v38; // [rsp+40h] [rbp-A0h]
unsigned int v39; // [rsp+4Ch] [rbp-94h]
__int128 v40; // [rsp+50h] [rbp-90h] BYREF
void *v41; // [rsp+60h] [rbp-80h]
__int128 __dst; // [rsp+68h] [rbp-78h] BYREF
void *v43; // [rsp+78h] [rbp-68h]
__int64 v44; // [rsp+80h] [rbp-60h]
__int128 v45; // [rsp+88h] [rbp-58h] BYREF
void *v46; // [rsp+98h] [rbp-48h]
__int128 __s2; // [rsp+A0h] [rbp-40h] BYREF
void *__p; // [rsp+B0h] [rbp-30h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(_QWORD *)(a3 + 16);
else
v3 = a3 + 1;
v39 = sub_10056A560(a1, v3);
v44 = v3;
GameLevelManager::removeDLFromActive(a1, v3);
LOBYTE(__s2) = 4;
*(_WORD *)((char *)&__s2 + 1) = 12589;
BYTE3(__s2) = 0;
v4 = a2 + 1;
v5 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
v4 = *((const void **)a2 + 2);
v6 = (char *)&__s2 + 1;
if ( (*a2 & 1) != 0 )
v5 = *((_QWORD *)a2 + 1);
v7 = 2;
if ( v5 < 2 )
v7 = v5;
if ( !((v5 != 2) | (memcmp(v4, (char *)&__s2 + 1, v7) != 0)) )
{
v8 = *(_QWORD *)(a1 + 1240);
if ( v8 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 8LL))(v8, v44);
return;
}
v38 = a1;
v9 = strlen((const char *)v4);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_70;
v10 = v9;
if ( v9 >= 0x17 )
{
v11 = 26;
if ( (v9 | 7) != 0x17 )
v11 = (v9 | 7) + 1;
v6 = (char *)operator new(v11);
__p = v6;
*(_QWORD *)&__s2 = v11 + 1;
*((_QWORD *)&__s2 + 1) = v10;
goto LABEL_20;
}
LOBYTE(__s2) = 2 * v9;
if ( v9 )
LABEL_20:
memmove(v6, v4, v10);
v6[v10] = 0;
v12 = sub_10053FBE0(&__s2, "#");
if ( (__s2 & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_1007FEF90(v12) <= 1 )
{
v13 = *(_QWORD *)(v38 + 1240);
if ( v13 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v13 + 8LL))(v13, v44);
return;
}
v14 = sub_1007FEFE0(v12, 0);
CString = (const char *)cocos2d::CCString::getCString(v14);
v16 = strlen(CString);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_70:
sub_100003630();
v17 = v16;
v18 = v44;
if ( v16 >= 0x17 )
{
v20 = CString;
v21 = 26;
if ( (v16 | 7) != 0x17 )
v21 = (v16 | 7) + 1;
v19 = (char *)operator new(v21);
v43 = v19;
*(_QWORD *)&__dst = v21 + 1;
CString = v20;
v18 = v44;
*((_QWORD *)&__dst + 1) = v17;
goto LABEL_33;
}
LOBYTE(__dst) = 2 * v16;
v19 = (char *)&__dst + 1;
if ( v16 )
LABEL_33:
memmove(v19, CString, v17);
v19[v17] = 0;
v22 = sub_1007FEFE0(v12, 1);
v23 = (const char *)cocos2d::CCString::getCString(v22);
v24 = strlen(v23);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v25 = v24;
if ( v24 >= 0x17 )
{
v27 = 26;
if ( (v24 | 7) != 0x17 )
v27 = (v24 | 7) + 1;
v26 = (char *)operator new(v27);
v46 = v26;
*(_QWORD *)&v45 = v27 | 1;
*((_QWORD *)&v45 + 1) = v25;
}
else
{
LOBYTE(v45) = 2 * v24;
v26 = (char *)&v45 + 1;
if ( !v24 )
goto LABEL_42;
}
memmove(v26, v23, v25);
LABEL_42:
v26[v25] = 0;
v28 = v38;
v29 = *(_QWORD *)(v38 + 1240);
if ( v29 )
{
if ( (v45 & 1) != 0 )
{
sub_10001AD30(&v34, v46, *((unsigned __int64 *)&v45 + 1));
}
else
{
v35 = v46;
v34 = v45;
}
(*(void (__fastcall **)(__int64, __int128 *, __int64))(*(_QWORD *)v29 + 24LL))(v29, &v34, v18);
if ( (v34 & 1) != 0 )
operator delete(v35);
}
v30 = __dst;
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&v40, v43, *((unsigned __int64 *)&__dst + 1));
}
else
{
v41 = v43;
v40 = __dst;
}
if ( (v40 & 1) != 0 )
{
sub_10001AD30(&__s2, v41, *((unsigned __int64 *)&v40 + 1));
}
else
{
__p = v41;
__s2 = v40;
}
v31 = sub_10056AAF0(v28, &__s2, v39, 1, 1);
if ( (__s2 & 1) == 0 )
{
if ( (v40 & 1) == 0 )
goto LABEL_56;
LABEL_59:
operator delete(v41);
v32 = v45;
if ( (v45 & 1) == 0 )
goto LABEL_57;
LABEL_60:
sub_10001AD30(&v36, v46, *((unsigned __int64 *)&v45 + 1));
goto LABEL_61;
}
operator delete(__p);
if ( (v40 & 1) != 0 )
goto LABEL_59;
LABEL_56:
v32 = v45;
if ( (v45 & 1) != 0 )
goto LABEL_60;
LABEL_57:
v37 = v46;
v36 = v45;
LABEL_61:
GameLevelManager::storeCommentsResult(v28, v31, &v36, v18);
if ( (v36 & 1) != 0 )
operator delete(v37);
v33 = *(void (__fastcall ****)(_QWORD, __int64, __int64))(v28 + 1240);
if ( v33 )
(**v33)(v33, v31, v18);
if ( (v32 & 1) != 0 )
operator delete(v46);
if ( (v30 & 1) != 0 )
operator delete(v43);
}