//
// sub_100885910 from 0x100885910 to 0x100885d55 (1093 bytes)
//
// 3 xrefs:
// > ParentalOptionsLayer::init @ 0x1008849f4
// > sub_1008858D0 @ 0x1008858dd
// > sub_1008858F0 @ 0x1008858fd
//
// 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_100885910(__int64 a1, int a2)
{
__int64 result; // rax
int v3; // edx
int v4; // r14d
__int64 v5; // r15
__int64 v6; // rax
const char *CString; // r13
size_t v8; // rax
size_t v9; // r12
char *v10; // r15
size_t v11; // r14
__int64 v12; // r15
unsigned int v13; // r12d
__int64 v14; // rax
__int64 v15; // r14
__int64 v16; // rax
const char *v17; // r13
size_t v18; // rax
size_t v19; // r12
char *v20; // r15
int v21; // r14d
size_t v22; // r14
__int64 v23; // r15
__int64 v24; // r15
__int64 v25; // rax
const char *v26; // r13
size_t v27; // rax
size_t v28; // r12
char *v29; // r15
size_t v30; // r14
__int64 v31; // r15
unsigned int v32; // r12d
__int64 v33; // rax
__int64 v34; // r15
__int64 v35; // rax
const char *v36; // r13
size_t v37; // rax
size_t v38; // r12
char *v39; // r15
size_t v40; // r14
__int64 v41; // r15
char v42; // [rsp+0h] [rbp-50h]
__int64 v43; // [rsp+0h] [rbp-50h]
__int64 v44; // [rsp+0h] [rbp-50h]
__int64 v45; // [rsp+0h] [rbp-50h]
__int64 v46; // [rsp+0h] [rbp-50h]
int v47; // [rsp+Ch] [rbp-44h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v49; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
result = (unsigned int)a2;
v3 = a2;
if ( a2 < 0 )
v3 = *(_DWORD *)(a1 + 668);
v4 = 0;
if ( *(_DWORD *)(a1 + 668) >= a2 )
v4 = v3;
if ( *(_DWORD *)(a1 + 660) != v4 )
{
v5 = *(_QWORD *)(a1 + 680);
v6 = sub_10088E820("object_%i", v42);
CString = (const char *)cocos2d::CCString::getCString(v6);
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_60;
v9 = v8;
v43 = v5;
v47 = v4;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
__p = v10;
__dst = v11 + 1;
v49 = v9;
}
else
{
LOBYTE(__dst) = 2 * v8;
v10 = (char *)&__dst + 1;
if ( !v8 )
{
LABEL_14:
v10[v9] = 0;
v12 = cocos2d::CCDictionary::objectForKey(v43, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v12 && (unsigned int)sub_1007FEF90(v12) )
{
v13 = 0;
do
{
v14 = sub_1007FEFE0(v12, v13);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v14 + 344LL))(v14, 0);
++v13;
}
while ( v13 < (unsigned int)sub_1007FEF90(v12) );
}
v15 = *(_QWORD *)(a1 + 680);
v16 = sub_10088E820("layer_%i", v43);
v17 = (const char *)cocos2d::CCString::getCString(v16);
v18 = strlen(v17);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_60;
v19 = v18;
v44 = v15;
if ( v18 >= 0x17 )
{
v22 = 26;
if ( (v18 | 7) != 0x17 )
v22 = (v18 | 7) + 1;
v20 = (char *)operator new(v22);
__p = v20;
__dst = v22 + 1;
v49 = v19;
v21 = v47;
}
else
{
LOBYTE(__dst) = 2 * v18;
v20 = (char *)&__dst + 1;
v21 = v47;
if ( !v18 )
{
LABEL_28:
v20[v19] = 0;
v23 = cocos2d::CCDictionary::objectForKey(v44, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v23 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v23 + 344LL))(v23, 0);
v24 = *(_QWORD *)(a1 + 680);
v25 = sub_10088E820("object_%i", v44);
v26 = (const char *)cocos2d::CCString::getCString(v25);
v27 = strlen(v26);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_60;
v28 = v27;
v45 = v24;
if ( v27 >= 0x17 )
{
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = (v27 | 7) + 1;
v29 = (char *)operator new(v30);
__p = v29;
__dst = v30 + 1;
v21 = v47;
v49 = v28;
}
else
{
LOBYTE(__dst) = 2 * v27;
v29 = (char *)&__dst + 1;
if ( !v27 )
{
LABEL_40:
v29[v28] = 0;
v31 = cocos2d::CCDictionary::objectForKey(v45, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v31 && (unsigned int)sub_1007FEF90(v31) )
{
v32 = 0;
do
{
v33 = sub_1007FEFE0(v31, v32);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v33 + 344LL))(v33, 1);
++v32;
}
while ( v32 < (unsigned int)sub_1007FEF90(v31) );
}
v34 = *(_QWORD *)(a1 + 680);
v35 = sub_10088E820("layer_%i", v45);
v36 = (const char *)cocos2d::CCString::getCString(v35);
v37 = strlen(v36);
if ( v37 < 0xFFFFFFFFFFFFFFF8LL )
{
v38 = v37;
v46 = v34;
if ( v37 >= 0x17 )
{
v40 = 26;
if ( (v37 | 7) != 0x17 )
v40 = (v37 | 7) + 1;
v39 = (char *)operator new(v40);
__p = v39;
__dst = v40 + 1;
v21 = v47;
v49 = v38;
}
else
{
LOBYTE(__dst) = 2 * v37;
v39 = (char *)&__dst + 1;
if ( !v37 )
goto LABEL_54;
}
memmove(v39, v36, v38);
LABEL_54:
v39[v38] = 0;
v41 = cocos2d::CCDictionary::objectForKey(v46, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v41 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v41 + 344LL))(v41, 1);
*(_DWORD *)(a1 + 660) = v21;
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 736) + 344LL))(
*(_QWORD *)(a1 + 736),
v21 > 0);
return (*(__int64 (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 744) + 344LL))(
*(_QWORD *)(a1 + 744),
*(_DWORD *)(a1 + 660) < *(_DWORD *)(a1 + 668));
}
LABEL_60:
sub_100003630();
}
}
memmove(v29, v26, v28);
goto LABEL_40;
}
}
memmove(v20, v17, v19);
goto LABEL_28;
}
}
memmove(v10, CString, v9);
goto LABEL_14;
}
return result;
}