//
// sub_10057ADF0 from 0x10057adf0 to 0x10057afce (478 bytes)
//
// 3 xrefs:
// > sub_100528690 @ 0x10052884c
// > sub_1005288A0 @ 0x100528a50
// > sub_100528E70 @ 0x100529015
//
// 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:18 +0000
//
void __fastcall sub_10057ADF0(__int64 a1, unsigned int a2, int a3)
{
__int64 v3; // rax
const char *CString; // r13
__int64 StoredOnlineLevels; // rax
__int64 v6; // r12
int v7; // r15d
__int64 v8; // rax
unsigned int v9; // ebx
void (__fastcall ***v10)(_QWORD, __int64, const char *); // rdi
__int64 v11; // r15
size_t v12; // rax
size_t v13; // r12
char *v14; // rbx
size_t v15; // rbx
char v16; // bl
__int64 v17; // r15
_QWORD __dst[2]; // [rsp+0h] [rbp-50h] BYREF
void *__p; // [rsp+10h] [rbp-40h]
__int64 v20; // [rsp+18h] [rbp-38h]
int v21; // [rsp+24h] [rbp-2Ch]
v21 = a3;
v3 = sub_10088E820("%s_%i_%i", __dst[0]);
CString = (const char *)cocos2d::CCString::getCString(v3);
v20 = a1;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(a1, CString);
if ( StoredOnlineLevels )
{
v6 = StoredOnlineLevels;
v7 = 0;
while ( !(unsigned int)sub_1007FEF90(v6) )
{
LABEL_3:
++v7;
v8 = sub_10088E820("%s_%i_%i", __dst[0]);
CString = (const char *)cocos2d::CCString::getCString(v8);
v6 = GameLevelManager::getStoredOnlineLevels(v20, CString);
if ( !v6 )
goto LABEL_21;
}
v9 = 0;
while ( *(_DWORD *)(sub_1007FEFE0(v6, v9) + 376) != a2 )
{
if ( ++v9 >= (unsigned int)sub_1007FEF90(v6) )
goto LABEL_3;
}
sub_1007FF150(v6, v9, 1);
v10 = *(void (__fastcall ****)(_QWORD, __int64, const char *))(v20 + 1376);
if ( v10 )
{
(**v10)(v10, v6, CString);
if ( !(unsigned int)sub_1007FEF90(v6) )
{
v11 = *(_QWORD *)(v20 + 1040);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v13 = v12;
v14 = (char *)__dst + 1;
if ( v12 >= 0x17 )
{
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = (v12 | 7) + 1;
__p = operator new(v15);
__dst[0] = v15 + 1;
v14 = (char *)__p;
__dst[1] = v13;
}
else
{
LOBYTE(__dst[0]) = 2 * v12;
if ( !v12 )
{
LABEL_19:
v14[v13] = 0;
cocos2d::CCDictionary::removeObjectForKey(v11, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
goto LABEL_21;
}
}
memmove(v14, CString, v13);
goto LABEL_19;
}
}
}
LABEL_21:
v16 = v21;
v17 = v20;
sub_10057CF10(v20, (unsigned __int8)v21, a2);
if ( !v16 )
sub_10056BC50(v17);
}