//
// cocos2d::CCMenu::alignItemsInColumnsWithArray from 0xd64370 to 0xd6469c (812 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::alignItemsInColumns @ 0xd64768
// > ??> @ 0xce938
//
// 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::alignItemsInColumnsWithArray(cocos2d::CCMenu *this, cocos2d::CCArray *a2)
{
__int64 v3; // x0
int v4; // w22
unsigned int v5; // w19
cocos2d::CCDirector *v6; // x0
cocos2d::CCArray *v7; // x0
unsigned int *v9; // x1
__int64 *v10; // x21
char *v11; // x23
unsigned int v12; // w20
unsigned int v13; // w24
int v14; // w22
unsigned int v15; // w28
float v16; // s8
float v17; // s0
__int64 v18; // x0
unsigned int *v19; // x1
const void **v20; // x20
const void *v21; // x0
float v22; // s9
unsigned int v23; // w21
float v24; // s8
unsigned int v25; // w22
float v26; // s10
void *v27; // x28
float v28; // s11
float v29; // s0
void (__fastcall *v30)(void *, float *); // x23
__int64 v31; // x0
float v32; // s0
const void **v33; // [xsp+90h] [xbp+90h]
unsigned int v34; // [xsp+9Ch] [xbp+9Ch]
float v35; // [xsp+A0h] [xbp+A0h]
__int64 v36; // [xsp+B0h] [xbp+B0h] BYREF
float v37; // [xsp+B8h] [xbp+B8h] BYREF
void *v38; // [xsp+C0h] [xbp+C0h] BYREF
char *v39; // [xsp+C8h] [xbp+C8h]
sub_D64268((__int64)a2, (__int64)&v38);
v3 = *((_QWORD *)this + 26);
if ( !v3 )
goto LABEL_3;
v3 = cocos2d::CCArray::count((cocos2d::CCArray *)v3);
if ( !(_DWORD)v3 )
goto LABEL_3;
v3 = *((_QWORD *)this + 26);
if ( v3
&& (v9 = *(unsigned int **)(v3 + 56), v3 = *v9, (_DWORD)v3)
&& (v10 = *((__int64 **)v9 + 2),
v3 = 8LL * (unsigned int)v3 - 8,
v11 = (char *)v10 + v3,
v10 <= (__int64 *)((char *)v10 + v3))
&& (v3 = *v10) != 0 )
{
v5 = 0;
v12 = 0;
v13 = 0;
v14 = -5;
do
{
v3 = (__int64)_dynamic_cast(
(const void *)v3,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
if ( v3 )
{
v15 = *((_DWORD *)v38 + v13);
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 328LL))(v3);
v16 = (float)v12;
v17 = *(float *)(v3 + 4);
if ( v17 <= (float)v12 || (v12 = (unsigned int)v17, v3 = __isnanf(v17), (_DWORD)v3) )
v12 = (unsigned int)v16;
if ( v15 <= ++v5 )
{
++v13;
v14 += 5 + v12;
v5 = 0;
v12 = 0;
}
}
if ( v11 < (char *)++v10 )
break;
v3 = *v10;
}
while ( *v10 );
v4 = v14 / 2;
}
else
{
LABEL_3:
v4 = -2;
v5 = 0;
}
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v3);
cocos2d::CCDirector::getWinSize(&v36, v6);
v7 = *((cocos2d::CCArray **)this + 26);
if ( v7 )
{
if ( (unsigned int)cocos2d::CCArray::count(v7) )
{
v18 = *((_QWORD *)this + 26);
if ( v18 )
{
v19 = *(unsigned int **)(v18 + 56);
if ( *v19 )
{
v20 = *((const void ***)v19 + 2);
v33 = &v20[*v19 - 1];
if ( v20 <= v33 )
{
v21 = *v20;
if ( *v20 )
{
v22 = 0.0;
v23 = 0;
v24 = (float)v4;
v34 = 0;
v25 = 0;
v26 = 0.0;
do
{
v27 = _dynamic_cast(
v21,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
if ( v27 )
{
if ( !v23 )
{
v23 = *((_DWORD *)v38 + v34);
v26 = *(float *)&v36 / (float)(v23 + 1);
v22 = v26;
}
v28 = (float)v25;
v29 = *(float *)((*(__int64 (__fastcall **)(void *))(*(_QWORD *)v27 + 328LL))(v27) + 4);
if ( v29 <= (float)v25 || (v25 = (unsigned int)v29, __isnanf(v29)) )
v25 = (unsigned int)v28;
++v5;
v30 = *(void (__fastcall **)(void *, float *))(*(_QWORD *)v27 + 184LL);
v35 = v22 - (float)(*(float *)&v36 * 0.5);
v31 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v27 + 328LL))(v27);
cocos2d::CCPoint::CCPoint(&v37, v35, v24 - (float)(*(float *)(v31 + 4) * 0.5));
v30(v27, &v37);
v22 = v22 + v26;
if ( v23 <= v5 )
{
v23 = 0;
v5 = 0;
v32 = (float)(v25 + 5);
v25 = 0;
++v34;
v24 = v24 - v32;
}
}
if ( v33 < ++v20 )
break;
v21 = *v20;
}
while ( *v20 );
}
}
}
}
}
}
if ( v38 )
{
if ( v38 != v39 )
v39 += 4 * ~((unsigned __int64)(v39 - 4 - (_BYTE *)v38) >> 2);
operator delete(v38);
}
return _stack_chk_guard;
}