//
// sub_1005372E0 from 0x1005372e0 to 0x10053765d (893 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d64d
//
// 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:53 +0000
//
int __fastcall sub_1005372E0(__int64 a1, unsigned __int8 *a2, const std::string *a3)
{
const char *data; // r14
__int64 v4; // r15
size_t v5; // rax
size_t v6; // r12
char *v7; // r13
size_t v8; // rbx
unsigned int v9; // ebx
std::string::size_type v10; // r14
std::string::size_type v11; // r12
unsigned int v12; // r13d
unsigned int v13; // ebx
std::string::size_type size; // rbx
std::string::pointer v15; // rsi
std::string::size_type v16; // rcx
size_t v17; // r14
size_t v18; // rbx
char *v19; // r14
unsigned int v20; // eax
std::string::size_type v21; // rax
std::string::pointer v22; // r15
size_t v23; // r13
char *v24; // rax
void *v25; // rbx
std::string::size_type v26; // r12
size_t v27; // rbx
char *v28; // r14
size_t v29; // r13
void *v30; // r14
const void *v31; // rdi
unsigned __int64 v32; // r14
size_t v33; // rdx
int result; // eax
_QWORD *v35; // rdi
__int64 v36; // rcx
std::string::size_type v39; // [rsp+10h] [rbp-50h]
unsigned int v41; // [rsp+18h] [rbp-48h]
size_t __dst; // [rsp+20h] [rbp-40h] BYREF
size_t v43; // [rsp+28h] [rbp-38h]
void *__p; // [rsp+30h] [rbp-30h]
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
data = a3->__r_.__value_.__l.__data_;
else
data = a3->__r_.__value_.__s.__data_;
v4 = *(_QWORD *)(a1 + 1088);
v5 = strlen(data);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_55;
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v43 = v6;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( v5 )
LABEL_11:
memmove(v7, data, v6);
v7[v6] = 0;
cocos2d::CCDictionary::removeObjectForKey(v4, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v9 = 0;
v10 = std::string::find(a3, 95, 0);
v11 = std::string::rfind(a3, 95, 0xFFFFFFFFFFFFFFFFLL);
v12 = 0;
if ( v10 != -1 && v11 != -1 && v11 > v10 )
{
v13 = (unsigned int)a3->__r_.__value_.__l.0;
if ( (v13 & 1) != 0 )
{
size = a3->__r_.__value_.__l.__size_;
if ( size <= v10 )
goto LABEL_56;
v15 = a3->__r_.__value_.__l.__data_;
}
else
{
size = v13 >> 1;
if ( v10 >= size )
goto LABEL_56;
v15 = a3->__r_.__value_.__s.__data_;
}
v16 = v10 + 1;
v17 = v11 + ~v10;
v18 = size - v16;
if ( v18 >= v17 )
v18 = v17;
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_55;
if ( v18 >= 0x17 )
{
v39 = v16;
v23 = 26;
if ( (v18 | 7) != 0x17 )
v23 = (v18 | 7) + 1;
v24 = (char *)operator new(v23);
v16 = v39;
v19 = v24;
__p = v24;
__dst = v23 + 1;
v43 = v18;
}
else
{
LOBYTE(__dst) = 2 * v18;
v19 = (char *)&__dst + 1;
if ( !v18 )
{
BYTE1(__dst) = 0;
if ( (__dst & 1) == 0 )
goto LABEL_26;
goto LABEL_33;
}
}
memmove(v19, &v15[v16], v18);
v19[v18] = 0;
if ( (__dst & 1) == 0 )
{
LABEL_26:
v12 = atoi((const char *)&__dst + 1);
v20 = (unsigned int)a3->__r_.__value_.__l.0;
if ( (v20 & 1) != 0 )
goto LABEL_27;
goto LABEL_34;
}
LABEL_33:
v25 = __p;
v12 = atoi((const char *)__p);
operator delete(v25);
v20 = (unsigned int)a3->__r_.__value_.__l.0;
if ( (v20 & 1) != 0 )
{
LABEL_27:
v21 = a3->__r_.__value_.__l.__size_;
if ( v21 > v11 )
{
v22 = a3->__r_.__value_.__l.__data_;
goto LABEL_36;
}
goto LABEL_56;
}
LABEL_34:
v21 = v20 >> 1;
if ( v11 < v21 )
{
v22 = a3->__r_.__value_.__s.__data_;
LABEL_36:
v26 = v11 + 1;
v27 = v21 - v26;
if ( v21 - v26 < 0xFFFFFFFFFFFFFFF8LL )
{
if ( v27 >= 0x17 )
{
v41 = v12;
v29 = 26;
if ( (v27 | 7) != 0x17 )
v29 = (v27 | 7) + 1;
v28 = (char *)operator new(v29);
__p = v28;
__dst = v29 + 1;
v12 = v41;
v43 = v27;
}
else
{
v28 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v27;
if ( v21 == v26 )
{
*((_BYTE *)&__dst + v27 + 1) = 0;
if ( (__dst & 1) == 0 )
{
LABEL_40:
v9 = atoi((const char *)&__dst + 1);
goto LABEL_46;
}
goto LABEL_45;
}
}
memmove(v28, &v22[v26], v27);
v28[v27] = 0;
if ( (__dst & 1) == 0 )
goto LABEL_40;
LABEL_45:
v30 = __p;
v9 = atoi((const char *)__p);
operator delete(v30);
goto LABEL_46;
}
LABEL_55:
sub_100003630();
}
LABEL_56:
sub_100056810();
}
LABEL_46:
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v31 = a2 + 1;
v32 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v31 = *((const void **)a2 + 2);
v32 = *((_QWORD *)a2 + 1);
}
v33 = 2;
if ( v32 < 2 )
v33 = v32;
result = memcmp(v31, (char *)&__dst + 1, v33);
v35 = *(_QWORD **)(a1 + 1264);
if ( v35 )
{
v36 = 64;
if ( !result )
v36 = 8LL * (v32 == 2) + 64;
return (*(__int64 (__fastcall **)(_QWORD *, _QWORD, _QWORD))(*v35 + v36))(v35, v12, v9);
}
return result;
}