//
// cocos2d::CCMenu::alignItemsHorizontallyWithPadding from 0xd639e4 to 0xd63c08 (548 bytes)
//
// 12 xrefs:
// > FLAlertLayer::init @ 0x69a4bc
// > CCTextInputMenu::init @ 0x6b6ea4
// > MenuLayer::init @ 0x6eb8b8
// > PauseLayer::customSetup @ 0x7d8534
// > EditLevelLayer::init @ 0x7f0b40
// > GJGarageLayer::setupPage @ 0x8c09a0
// > GJGarageLayer::setupIconSelect @ 0x8c15fc
// > GJTransformControl::init @ 0xbd4a14
// > EditorUI::setupCreateMenu @ 0xbfe498
// > DailyRecallUnlockPopup::init @ 0xc5e2a0
// > cocos2d::CCMenu::alignItemsHorizontally @ 0xd63c0c
// > ??> @ 0x4d098
//
// 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 13:07:52 +0000
//
__int64 __fastcall cocos2d::CCMenu::alignItemsHorizontallyWithPadding(cocos2d::CCMenu *this, float a2)
{
float v4; // s8
int v5; // w0
cocos2d::CCArray *v6; // x20
float v7; // s8
__int64 v8; // x0
unsigned int *v9; // x1
const void **v10; // x20
__int64 v11; // x0
char *v12; // x21
const void *i; // x0
void *v14; // x0
void *v15; // x19
void (__fastcall *v16)(void *, float *); // x26
float v17; // s9
float v18; // s0
float v19; // s9
unsigned int *v21; // x1
const void **v22; // x19
__int64 v23; // x0
char *v24; // x25
const void *v25; // x0
void *v26; // x0
void *v27; // x20
float v28; // s9
float v29; // [xsp+70h] [xbp+70h] BYREF
v4 = -a2;
if ( !*((_QWORD *)this + 26) )
return _stack_chk_guard;
v5 = cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 26));
v6 = *((cocos2d::CCArray **)this + 26);
if ( !v5 )
goto LABEL_3;
if ( !v6 )
return _stack_chk_guard;
v21 = *((unsigned int **)v6 + 7);
if ( *v21 )
{
v22 = *((const void ***)v21 + 2);
v23 = 8LL * *v21 - 8;
v24 = (char *)v22 + v23;
if ( v22 <= (const void **)((char *)v22 + v23) )
{
v25 = *v22;
if ( *v22 )
{
do
{
v26 = _dynamic_cast(
v25,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
v27 = v26;
if ( v26 )
{
v28 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v26 + 328LL))(v26);
v4 = v4 + (float)(a2 + (float)(v28 * (*(float (__fastcall **)(void *))(*(_QWORD *)v27 + 136LL))(v27)));
}
if ( v24 < (char *)++v22 )
break;
v25 = *v22;
}
while ( *v22 );
v6 = *((cocos2d::CCArray **)this + 26);
LABEL_3:
if ( !v6 )
return _stack_chk_guard;
v7 = v4 * -0.5;
goto LABEL_5;
}
}
}
v7 = a2 * 0.5;
LABEL_5:
if ( (unsigned int)cocos2d::CCArray::count(v6) )
{
v8 = *((_QWORD *)this + 26);
if ( v8 )
{
v9 = *(unsigned int **)(v8 + 56);
if ( *v9 )
{
v10 = *((const void ***)v9 + 2);
v11 = 8LL * *v9 - 8;
v12 = (char *)v10 + v11;
if ( v10 <= (const void **)((char *)v10 + v11) )
{
for ( i = *v10; *v10; i = *v10 )
{
v14 = _dynamic_cast(
i,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
v15 = v14;
if ( v14 )
{
v16 = *(void (__fastcall **)(void *, float *))(*(_QWORD *)v14 + 184LL);
v17 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v14 + 328LL))(v14);
v18 = (*(float (__fastcall **)(void *))(*(_QWORD *)v15 + 136LL))(v15);
cocos2d::CCPoint::CCPoint(&v29, v7 + (float)((float)(v17 * v18) * 0.5), 0.0);
v16(v15, &v29);
v19 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v15 + 328LL))(v15);
v7 = v7 + (float)(a2 + (float)(v19 * (*(float (__fastcall **)(void *))(*(_QWORD *)v15 + 136LL))(v15)));
}
if ( v12 < (char *)++v10 )
break;
}
}
}
}
}
return _stack_chk_guard;
}