//
// ScrollableContentLayer::getOrCreateSection from 0x6e4b2c to 0x6e4d38 (524 bytes)
//
// 3 xrefs:
// > ScrollableContentLayer::getOrCreateSectionMenu @ 0x6e4de8
// > ScrollableContentLayer::sectionAddChild @ 0x6e4f94
// > ??> @ 0x8f218
//
// This function is hookable on this platform (idp: arm, 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:51:42 +0000
//
cocos2d::CCNode *__fastcall ScrollableContentLayer::getOrCreateSection(ScrollableContentLayer *this, int a2)
{
__int64 **v4; // x22
__int64 *v5; // x0
__int64 **v6; // x2
cocos2d::CCNode *v8; // x23
void (__fastcall *v9)(cocos2d::CCNode *, __int64 ***); // x24
long double v10; // q0
__int64 v11; // x24
int v12; // w1
bool v13; // cc
__int64 v14; // x1
int v15; // w1
__int64 *v16; // x1
__int64 v17; // x0
cocos2d::CCNode *v18; // x0
float v19; // s0
_BOOL8 v20; // x1
float v21; // s2
signed int v22; // w0
__int64 **v23; // [xsp+50h] [xbp+50h] BYREF
v4 = (__int64 **)((char *)this + 536);
v5 = *((__int64 **)this + 67);
if ( v5 )
{
v6 = v4;
do
{
while ( *((_DWORD *)v5 + 8) >= a2 )
{
v6 = (__int64 **)v5;
v5 = (__int64 *)*v5;
if ( !v5 )
goto LABEL_5;
}
v5 = (__int64 *)v5[1];
}
while ( v5 );
LABEL_5:
if ( v4 != v6 )
{
v5 = (__int64 *)*((unsigned int *)v6 + 8);
if ( a2 >= (int)v5 )
return (cocos2d::CCNode *)v6[5];
}
}
v8 = (cocos2d::CCNode *)cocos2d::CCNode::create((cocos2d::CCNode *)v5);
v9 = *(void (__fastcall **)(cocos2d::CCNode *, __int64 ***))(*(_QWORD *)v8 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v23, 0.0, 0.0);
v9(v8, &v23);
(*(void (__fastcall **)(cocos2d::CCNode *, void *))(*(_QWORD *)v8 + 184LL))(v8, &unk_155C360);
v11 = *((_QWORD *)this + 67);
if ( v11 )
{
v12 = *(_DWORD *)(v11 + 32);
v13 = a2 <= v12;
if ( a2 >= v12 )
goto LABEL_14;
while ( 1 )
{
v14 = *(_QWORD *)v11;
if ( !*(_QWORD *)v11 )
break;
while ( 1 )
{
v11 = v14;
v15 = *(_DWORD *)(v14 + 32);
v13 = a2 <= v15;
if ( a2 < v15 )
break;
LABEL_14:
if ( v13 )
goto LABEL_21;
v14 = *(_QWORD *)(v11 + 8);
if ( !v14 )
{
v23 = (__int64 **)v11;
v4 = (__int64 **)(v11 + 8);
goto LABEL_18;
}
}
}
v23 = (__int64 **)v11;
v4 = (__int64 **)v11;
}
else
{
v23 = v4;
}
LABEL_18:
v11 = operator new(0x30u);
*(_DWORD *)(v11 + 32) = a2;
v16 = (__int64 *)v11;
*(_QWORD *)(v11 + 40) = 0;
*(_QWORD *)(v11 + 16) = v23;
*(_QWORD *)v11 = 0;
*(_QWORD *)(v11 + 8) = 0;
*v4 = (__int64 *)v11;
v17 = **((_QWORD **)this + 66);
if ( v17 )
{
*((_QWORD *)this + 66) = v17;
v16 = *v4;
}
std::__tree_balance_after_insert *>(*((__int64 **)this + 67), v16);
++*((_QWORD *)this + 68);
LABEL_21:
*(_QWORD *)(v11 + 40) = v8;
v18 = *((cocos2d::CCNode **)this + 52);
if ( v18 )
cocos2d::CCNode::addChild(v18, v8, 0, 0);
v19 = *((float *)this + 109);
v20 = 0;
v21 = *((float *)this + 130);
v22 = vcvtms_s32_f32(v19 / v21) - 1;
*(float *)&v10 = floorf((float)(v19 + *((float *)this + 107)) / v21);
if ( v22 <= a2 )
v20 = (int)*(float *)&v10 + 1 >= a2;
(*(void (__fastcall **)(cocos2d::CCNode *, _BOOL8, long double))(*(_QWORD *)v8 + 344LL))(v8, v20, v10);
return v8;
}