//
// sub_100885240 from 0x100885240 to 0x10088576e (1326 bytes)
//
// 4 xrefs:
// > ParentalOptionsLayer::init @ 0x10088468b
// > ParentalOptionsLayer::init @ 0x1008846ad
// > ParentalOptionsLayer::init @ 0x1008846cf
// > ParentalOptionsLayer::init @ 0x1008846f1
//
// 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:58 +0000
//
__int64 __fastcall sub_100885240(__int64 a1, char *a2, const char *a3, int a4, char *a5)
{
int v6; // eax
int v7; // r13d
__int64 v8; // rax
unsigned __int8 GameVariable; // r12
size_t v10; // rax
size_t v11; // r14
char *v12; // r12
size_t v13; // r13
__int64 v14; // rax
unsigned int v15; // r14d
__int64 v16; // r15
size_t v17; // rax
size_t v18; // r14
char *v19; // r12
size_t v20; // r13
__int64 v21; // r14
char *v22; // r12
unsigned int v23; // r14d
__int64 v24; // r14
__int64 result; // rax
size_t v26; // rax
size_t v27; // r14
char *v28; // r15
size_t v29; // r13
__int64 v30; // rax
size_t v31; // rax
size_t v32; // r13
char *v33; // r15
char *v34; // r14
void *v35; // rsi
size_t v36; // r14
char *v37; // rax
unsigned int v38; // r15d
char *v39; // r14
void *v40; // r14
unsigned __int64 *v41; // rbx
char v42; // [rsp+0h] [rbp-E0h]
__int64 v43; // [rsp+40h] [rbp-A0h] BYREF
_QWORD v44[2]; // [rsp+48h] [rbp-98h] BYREF
void *v45; // [rsp+58h] [rbp-88h]
unsigned __int64 v46[2]; // [rsp+60h] [rbp-80h] BYREF
void *v47; // [rsp+70h] [rbp-70h]
__int64 v48; // [rsp+78h] [rbp-68h]
char *__s; // [rsp+80h] [rbp-60h]
void *__src; // [rsp+88h] [rbp-58h]
char *v51; // [rsp+90h] [rbp-50h]
size_t __dst; // [rsp+98h] [rbp-48h] BYREF
size_t v53; // [rsp+A0h] [rbp-40h]
void *__p; // [rsp+A8h] [rbp-38h]
int v55; // [rsp+B0h] [rbp-30h]
unsigned __int8 v56; // [rsp+B7h] [rbp-29h]
v51 = a5;
__s = a2;
++*(_DWORD *)(a1 + 664);
v6 = *(_DWORD *)(a1 + 668);
LODWORD(v48) = a4;
if ( v6 <= a4 )
v6 = a4;
*(_DWORD *)(a1 + 668) = v6;
v7 = atoi(a3);
v8 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v8, a3);
__src = *(void **)(a1 + 688);
v10 = strlen(a3);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_46;
v11 = v10;
v56 = GameVariable;
v55 = v7;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
__p = v12;
__dst = v13 + 1;
v7 = v55;
v53 = v11;
goto LABEL_10;
}
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
LABEL_10:
memcpy(v12, a3, v11);
v12[v11] = 0;
v14 = sub_10088E600(&__dst);
cocos2d::CCDictionary::setObject_1((__int64)__src, v14, v7);
if ( (__dst & 1) != 0 )
operator delete(__p);
v15 = v48;
sub_100886590(&v43, a1, (unsigned int)v48);
v16 = sub_100885D80(a1, v15);
v17 = strlen(__s);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_46;
v18 = v17;
if ( v17 >= 0x17 )
{
v20 = 26;
if ( (v17 | 7) != 0x17 )
v20 = (v17 | 7) + 1;
v19 = (char *)operator new(v20);
v45 = v19;
v44[0] = v20 + 1;
v7 = v55;
v44[1] = v18;
goto LABEL_20;
}
LOBYTE(v44[0]) = 2 * v17;
v19 = (char *)v44 + 1;
if ( v17 )
LABEL_20:
memcpy(v19, __s, v18);
v19[v18] = 0;
v21 = *(_QWORD *)(a1 + 552);
sub_1002782D0(&__dst, &v43);
sub_100278250((float *)v46, 8.0, 0.0);
v22 = GameToolbox::createToggleButton(
(__int64)v44,
(__int64)ParentalOptionsLayer::onToggle,
0,
v56,
v21,
&__dst,
COERCE_DOUBLE(1061997773),
0.5,
110.0,
a1,
v16,
(float *)v46,
(__int64)"bigFont.fnt",
0,
0,
*(_QWORD *)(a1 + 728));
if ( (v44[0] & 1) != 0 )
operator delete(v45);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v22 + 72LL))(v22, (unsigned int)v7);
CCMenuItemToggler::setSizeMult((__int64)v22, 1.0);
v23 = v48;
sub_100886280(a1, (unsigned int)v48);
v24 = sub_100885F70(a1, v23);
sub_1007FEBF0(v24, (__int64)v22);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v22 + 344LL))(v22, 0);
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 344LL))(v16, 0);
if ( v51 )
{
v48 = v24;
v26 = strlen(v51);
if ( v26 < 0xFFFFFFFFFFFFFFF8LL )
{
v27 = v26;
__s = *(char **)(a1 + 680);
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
__p = v28;
__dst = v29 + 1;
v53 = v27;
}
else
{
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( !v26 )
{
LABEL_32:
v28[v27] = 0;
v51 = (char *)sub_10088E600(&__dst);
v30 = sub_10088E820("info_%i", v42);
__src = (void *)cocos2d::CCString::getCString(v30);
v31 = strlen((const char *)__src);
if ( v31 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v32 = v31;
if ( v31 >= 0x17 )
{
v36 = 26;
if ( (v31 | 7) != 0x17 )
v36 = (v31 | 7) + 1;
v37 = (char *)operator new(v36);
v35 = __src;
v33 = v37;
v47 = v37;
v46[0] = v36 | 1;
v46[1] = v32;
v34 = v51;
}
else
{
LOBYTE(v46[0]) = 2 * v31;
v33 = (char *)v46 + 1;
v34 = v51;
v35 = __src;
if ( !v31 )
goto LABEL_40;
}
memmove(v33, v35, v32);
LABEL_40:
v33[v32] = 0;
cocos2d::CCDictionary::setObject((__int64)__s, (__int64)v34, (char *)v46);
v38 = v55;
if ( (v46[0] & 1) != 0 )
operator delete(v47);
if ( (__dst & 1) != 0 )
operator delete(__p);
v39 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_infoIcon_001.png", COERCE_DOUBLE(1065353216));
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v39 + 160LL))(v39, 0.5);
v40 = CCMenuItemSpriteExtra::create((__int64)v39, 0, a1, (__int64)sub_1008863C0, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v40, 2.0);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v40 + 72LL))(v40, v38);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v40);
v41 = (unsigned __int64 *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v22 + 192LL))(v22);
sub_100278250((float *)v46, -18.0, 16.0);
sub_100278350((double *)&__dst, v41, v46);
(*(void (__fastcall **)(void *, size_t *))(*(_QWORD *)v40 + 184LL))(v40, &__dst);
sub_1007FEBF0(v48, (__int64)v40);
return (*(__int64 (__fastcall **)(void *, _QWORD))(*(_QWORD *)v40 + 344LL))(v40, 0);
}
}
memcpy(v28, v51, v27);
goto LABEL_32;
}
LABEL_46:
sub_100003630();
}
return result;
}