//
// ScrollableContentLayer::getOrCreateSectionMenu from 0x6e4d38 to 0x6e4ecc (404 bytes)
//
// 2 xrefs:
// > ScrollableContentLayer::sectionAddChild @ 0x6e4f44
// > ??> @ 0xcf460
//
// 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
//
__int64 *__fastcall ScrollableContentLayer::getOrCreateSectionMenu(ScrollableContentLayer *this, int a2)
{
__int64 **v4; // x22
__int64 **v5; // x0
__int64 **v6; // x2
cocos2d::CCNode *Section; // x24
__int64 OwnedMenu; // x0
__int64 v10; // x25
__int64 v11; // x23
int v12; // w1
bool v13; // cc
__int64 v14; // x1
int v15; // w1
__int64 *v16; // x1
__int64 v17; // x0
__int64 **v18; // [xsp+50h] [xbp+50h]
v4 = (__int64 **)((char *)this + 560);
v5 = *((__int64 ***)this + 70);
if ( v5 )
{
v6 = v4;
do
{
while ( *((_DWORD *)v5 + 8) >= a2 )
{
v6 = v5;
v5 = (__int64 **)*v5;
if ( !v5 )
goto LABEL_5;
}
v5 = (__int64 **)v5[1];
}
while ( v5 );
LABEL_5:
if ( v4 != v6 && a2 >= *((_DWORD *)v6 + 8) )
return v6[5];
}
Section = ScrollableContentLayer::getOrCreateSection(this, a2);
OwnedMenu = ScrollableContentLayer::createOwnedMenu(this);
v10 = *((_QWORD *)this + 70);
v11 = OwnedMenu;
if ( v10 )
{
v12 = *(_DWORD *)(v10 + 32);
v13 = a2 <= v12;
if ( a2 >= v12 )
goto LABEL_14;
while ( 1 )
{
v14 = *(_QWORD *)v10;
if ( !*(_QWORD *)v10 )
break;
while ( 1 )
{
v10 = v14;
v15 = *(_DWORD *)(v14 + 32);
v13 = a2 <= v15;
if ( a2 < v15 )
break;
LABEL_14:
if ( v13 )
goto LABEL_21;
v14 = *(_QWORD *)(v10 + 8);
if ( !v14 )
{
v18 = (__int64 **)v10;
v4 = (__int64 **)(v10 + 8);
goto LABEL_18;
}
}
}
v18 = (__int64 **)v10;
v4 = (__int64 **)v10;
}
else
{
v18 = v4;
}
LABEL_18:
v10 = operator new(0x30u);
*(_QWORD *)v10 = 0;
v16 = (__int64 *)v10;
*(_DWORD *)(v10 + 32) = a2;
*(_QWORD *)(v10 + 40) = 0;
*(_QWORD *)(v10 + 8) = 0;
*(_QWORD *)(v10 + 16) = v18;
*v4 = (__int64 *)v10;
v17 = **((_QWORD **)this + 69);
if ( v17 )
{
*((_QWORD *)this + 69) = v17;
v16 = *v4;
}
std::__tree_balance_after_insert *>(*((__int64 **)this + 70), v16);
++*((_QWORD *)this + 71);
LABEL_21:
*(_QWORD *)(v10 + 40) = v11;
(*(void (__fastcall **)(cocos2d::CCNode *, __int64, __int64))(*(_QWORD *)Section + 464LL))(Section, v11, 10);
return (__int64 *)v11;
}