//
// sub_10057CF10 from 0x10057cf10 to 0x10057d2e2 (978 bytes)
//
// 2 xrefs:
// > sub_10057AC30 @ 0x10057ad89
// > sub_10057ADF0 @ 0x10057afa9
//
// 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:32:19 +0000
//
void __fastcall sub_10057CF10(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rax
const char *CString; // r12
size_t v6; // rax
size_t v7; // r15
char *v8; // r13
size_t v9; // rbx
__int64 v10; // rax
unsigned int *v11; // rax
_QWORD *v12; // rbx
const char *v13; // rax
const char *v14; // r12
__int64 StoredOnlineLevels; // r13
unsigned int i; // r15d
void (__fastcall ***v17)(_QWORD, __int64, const char *); // rdi
__int64 v18; // r13
size_t v19; // rax
size_t v20; // r15
char *v21; // rax
size_t v22; // r13
const char *v23; // rsi
char *v24; // r12
const char *v25; // rax
const char *v26; // r15
size_t v27; // rax
size_t v28; // r13
char *v29; // r14
__int64 v30; // rax
size_t v31; // r12
char v32; // [rsp+0h] [rbp-70h]
unsigned __int64 v33; // [rsp+0h] [rbp-70h]
__int64 v34; // [rsp+8h] [rbp-68h]
__int64 v35; // [rsp+8h] [rbp-68h]
size_t __dst; // [rsp+10h] [rbp-60h] BYREF
size_t __n; // [rsp+18h] [rbp-58h]
char *__s2; // [rsp+20h] [rbp-50h]
__int64 v39; // [rsp+28h] [rbp-48h]
__int64 v40; // [rsp+30h] [rbp-40h] BYREF
size_t v41; // [rsp+38h] [rbp-38h]
void *__p; // [rsp+40h] [rbp-30h]
v39 = a1;
v4 = sub_10088E820("fReqS_%i_", v32);
CString = (const char *)cocos2d::CCString::getCString(v4);
v6 = strlen(CString);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__s2 = v8;
__dst = v9 + 1;
__n = v7;
}
else
{
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( !v6 )
goto LABEL_9;
}
memmove(v8, CString, v7);
LABEL_9:
v8[v7] = 0;
v10 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(v39 + 1040));
if ( v10 )
{
v11 = *(unsigned int **)(v10 + 56);
if ( *v11 )
{
v12 = *((_QWORD **)v11 + 2);
v33 = (unsigned __int64)&v12[*v11 - 1];
if ( a3 <= 0 )
{
while ( 1 )
{
if ( !*v12 )
goto LABEL_53;
v25 = (const char *)cocos2d::CCString::getCString(*v12);
v26 = v25;
if ( (__dst & 1) != 0 )
{
if ( !strncmp(v25, __s2, __n) )
goto LABEL_43;
}
else if ( !strncmp(v25, (const char *)&__dst + 1, (unsigned __int8)__dst >> 1) )
{
LABEL_43:
v35 = *(_QWORD *)(v39 + 1040);
v27 = strlen(v26);
if ( v27 > 0xFFFFFFFFFFFFFFF7LL )
sub_100003630();
v28 = v27;
if ( v27 >= 0x17 )
{
v30 = v27 | 7;
v31 = 26;
if ( (v28 | 7) != 0x17 )
v31 = v30 + 1;
v29 = (char *)operator new(v31);
__p = v29;
v40 = v31 | 1;
v41 = v28;
}
else
{
LOBYTE(v40) = 2 * v27;
v29 = (char *)&v40 + 1;
if ( !v27 )
{
LABEL_51:
v29[v28] = 0;
cocos2d::CCDictionary::removeObjectForKey(v35, (char *)&v40);
if ( (v40 & 1) != 0 )
operator delete(__p);
goto LABEL_37;
}
}
memmove(v29, v26, v28);
goto LABEL_51;
}
LABEL_37:
if ( (unsigned __int64)++v12 > v33 )
goto LABEL_53;
}
}
do
{
if ( !*v12 )
break;
v13 = (const char *)cocos2d::CCString::getCString(*v12);
v14 = v13;
if ( (__dst & 1) != 0 )
{
if ( strncmp(v13, __s2, __n) )
goto LABEL_13;
}
else if ( strncmp(v13, (const char *)&__dst + 1, (unsigned __int8)__dst >> 1) )
{
goto LABEL_13;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v39, v14);
if ( StoredOnlineLevels )
{
for ( i = 0; ; ++i )
{
if ( i >= (unsigned int)sub_1007FEF90(StoredOnlineLevels) )
goto LABEL_13;
if ( *(_DWORD *)(sub_1007FEFE0(StoredOnlineLevels, i) + 376) == a3 )
break;
}
sub_1007FF150(StoredOnlineLevels, i, 1);
v17 = *(void (__fastcall ****)(_QWORD, __int64, const char *))(v39 + 1376);
if ( v17 )
(**v17)(v17, StoredOnlineLevels, v14);
if ( !(unsigned int)sub_1007FEF90(StoredOnlineLevels) )
{
v18 = *(_QWORD *)(v39 + 1040);
v19 = strlen(v14);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v20 = v19;
if ( v19 >= 0x17 )
{
v34 = *(_QWORD *)(v39 + 1040);
v22 = (v19 | 7) + 1;
if ( (v19 | 7) == 0x17 )
v22 = 26;
v21 = (char *)operator new(v22);
__p = v21;
v40 = v22 | 1;
v41 = v20;
v18 = v34;
}
else
{
LOBYTE(v40) = 2 * v19;
v21 = (char *)&v40 + 1;
if ( !v20 )
{
LABEL_35:
v21[v20] = 0;
cocos2d::CCDictionary::removeObjectForKey(v18, (char *)&v40);
if ( (v40 & 1) != 0 )
operator delete(__p);
goto LABEL_13;
}
}
v23 = v14;
v24 = v21;
memmove(v21, v23, v20);
v21 = v24;
goto LABEL_35;
}
}
LABEL_13:
++v12;
}
while ( (unsigned __int64)v12 <= v33 );
}
}
LABEL_53:
if ( (__dst & 1) != 0 )
operator delete(__s2);
}