//
// ScrollableContentLayer::getOrCreateSection from 0x3f5a74 to 0x3f5be6 (370 bytes)
//
// 2 xrefs:
// > ScrollableContentLayer::getOrCreateSectionMenu @ 0x3f5c32
// > ScrollableContentLayer::sectionAddChild @ 0x3f5d40
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:47:17 +0000
//
cocos2d::CCNode *__fastcall ScrollableContentLayer::getOrCreateSection(ScrollableContentLayer *this, int a2)
{
char *v2; // r7
char *v5; // r1
char *v6; // r0
char *v7; // r3
cocos2d::CCNode *v9; // r4
void (__fastcall *v10)(cocos2d::CCNode *, _DWORD *); // r6
_DWORD *v11; // r6
int v12; // r3
_DWORD *v13; // r3
_DWORD *v14; // r7
_DWORD *v15; // r0
int v16; // r2
int v17; // r3
cocos2d::CCNode *v18; // r0
float v19; // s16
float v20; // s17
int v21; // r6
int v22; // r0
_BOOL4 v23; // r1
_DWORD v24[2]; // [sp+4h] [bp-Ch] BYREF
v2 = (char *)this + 420;
v5 = *((char **)this + 105);
v6 = (char *)this + 420;
while ( v5 )
{
if ( *((_DWORD *)v5 + 4) >= a2 )
{
v7 = *(char **)v5;
}
else
{
v7 = *((char **)v5 + 1);
v5 = v6;
}
v6 = v5;
v5 = v7;
}
if ( v6 != v2 && a2 >= *((_DWORD *)v6 + 4) )
return *((cocos2d::CCNode **)v6 + 5);
v9 = (cocos2d::CCNode *)cocos2d::CCNode::create((cocos2d::CCNode *)v6);
v10 = *(void (__fastcall **)(cocos2d::CCNode *, _DWORD *))(*(_DWORD *)v9 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, 0.0, 0.0);
v10(v9, v24);
(*(void (__fastcall **)(cocos2d::CCNode *, void *))(*(_DWORD *)v9 + 92))(v9, &unk_D2B5A0);
v11 = *((_DWORD **)this + 105);
if ( v11 )
{
while ( 1 )
{
v12 = v11[4];
if ( a2 >= v12 )
{
if ( v12 >= a2 )
{
v24[0] = v11;
v11 = v24;
goto LABEL_20;
}
v13 = (_DWORD *)v11[1];
if ( !v13 )
{
v24[0] = v11++;
goto LABEL_20;
}
}
else
{
v13 = (_DWORD *)*v11;
if ( !*v11 )
{
v24[0] = v11;
goto LABEL_20;
}
}
v11 = v13;
}
}
v11 = v2;
v24[0] = v2;
LABEL_20:
v14 = (_DWORD *)*v11;
if ( !*v11 )
{
v15 = (_DWORD *)operator new(0x18u);
v15[4] = a2;
v14 = v15;
v15[5] = 0;
v16 = v24[0];
*v15 = 0;
v15[1] = 0;
v15[2] = v16;
*v11 = v15;
v17 = **((_DWORD **)this + 104);
if ( v17 )
*((_DWORD *)this + 104) = v17;
std::__tree_balance_after_insert *>(*((_DWORD **)this + 105), (_DWORD *)*v11);
++*((_DWORD *)this + 106);
}
v14[5] = v9;
v18 = *((cocos2d::CCNode **)this + 80);
if ( v18 )
cocos2d::CCNode::addChild(v18, v9, 0, 0);
v19 = *((float *)this + 84);
v20 = *((float *)this + 102);
v21 = (int)floorf(v19 / v20);
v22 = (int)floorf((float)(v19 + *((float *)this + 82)) / v20);
v23 = a2 >= v21 - 1 && a2 <= v22 + 1;
(*(void (__fastcall **)(cocos2d::CCNode *, _BOOL4))(*(_DWORD *)v9 + 172))(v9, v23);
return v9;
}