//
// sub_100885D80 from 0x100885d80 to 0x100885f46 (454 bytes)
//
// 2 xrefs:
// > sub_100884A10 @ 0x100884b23
// > sub_100885240 @ 0x100885367
//
// 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:36:59 +0000
//
__int64 __fastcall sub_100885D80(__int64 a1)
{
__int64 v1; // r15
__int64 v2; // rax
const char *CString; // r13
size_t v4; // rax
size_t v5; // r12
char *v6; // r14
size_t v7; // rbx
__int64 v8; // rbx
__int64 v9; // r15
__int64 v10; // rax
const char *v11; // r12
size_t v12; // rax
size_t v13; // r14
char *v14; // r13
size_t v15; // r15
char v17; // [rsp+0h] [rbp-50h]
char v18; // [rsp+0h] [rbp-50h]
__int64 v19; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v21; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
v1 = *(_QWORD *)(a1 + 680);
v2 = sub_10088E820("layer_%i", v17);
CString = (const char *)cocos2d::CCString::getCString(v2);
v4 = strlen(CString);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_23;
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
__p = v6;
__dst = v7 + 1;
v21 = v5;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v4;
v6 = (char *)&__dst + 1;
if ( v4 )
LABEL_8:
memmove(v6, CString, v5);
v6[v5] = 0;
v8 = cocos2d::CCDictionary::objectForKey(v1, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v8 )
{
v8 = (__int64)cocos2d::CCLayer::create();
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v8);
v9 = *(_QWORD *)(a1 + 680);
v10 = sub_10088E820("layer_%i", v18);
v11 = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(v11);
if ( v12 < 0xFFFFFFFFFFFFFFF8LL )
{
v13 = v12;
if ( v12 >= 0x17 )
{
v19 = v9;
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = (v12 | 7) + 1;
v14 = (char *)operator new(v15);
__p = v14;
__dst = v15 + 1;
v9 = v19;
v21 = v13;
}
else
{
LOBYTE(__dst) = 2 * v12;
v14 = (char *)&__dst + 1;
if ( !v12 )
{
LABEL_20:
v14[v13] = 0;
cocos2d::CCDictionary::setObject(v9, v8, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
return v8;
}
}
memmove(v14, v11, v13);
goto LABEL_20;
}
LABEL_23:
sub_100003630();
}
return v8;
}