//
// sub_10058C090 from 0x10058c090 to 0x10058c17b (235 bytes)
//
// 2 xrefs:
// > sub_1006CC260 @ 0x1006ccae0
// > LocalLevelManager::importLevelsFromPaths @ 0x1006cf015
//
// 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:24 +0000
//
void *__fastcall sub_10058C090(unsigned __int8 *a1)
{
unsigned int v1; // eax
_QWORD *v2; // rbx
void *v3; // r14
void *v4; // rdi
v1 = *a1;
if ( (v1 & 1) != 0 )
{
if ( *((_QWORD *)a1 + 1) )
{
LABEL_3:
v2 = operator new(0xF0u);
sub_100158EB0((__int64)v2);
if ( (unsigned __int8)DS_Dictionary::loadRootSubDictFromString((__int64)v2, a1)
&& (unsigned int)DS_Dictionary::getIntegerForKey((__int64)v2, "kCEK") == 4 )
{
v3 = operator new(0x740u);
GJGameLevel::GJGameLevel(v3);
if ( (*(unsigned __int8 (__fastcall **)(void *))(*(_QWORD *)v3 + 80LL))(v3) )
{
cocos2d::CCObject::autorelease((__int64)v3);
}
else
{
(*(void (__fastcall **)(void *))(*(_QWORD *)v3 + 16LL))(v3);
v3 = nullptr;
}
GJGameLevel::dataLoaded((__int64)v3, v2);
v4 = (void *)v2[26];
if ( !v4 )
goto LABEL_11;
}
else
{
v3 = nullptr;
v4 = (void *)v2[26];
if ( !v4 )
{
LABEL_11:
pugi::xml_document::dxml_document(v2);
operator delete(v2);
return v3;
}
}
v2[27] = v4;
operator delete(v4);
goto LABEL_11;
}
}
else if ( v1 >> 1 )
{
goto LABEL_3;
}
return nullptr;
}