//
// cocos2d::CCMenu::alignItemsInColumnsWithArray from 0x100793ce0 to 0x100794052 (882 bytes)
//
// 1 xrefs:
// > cocos2d::CCMenu::alignItemsInColumns @ 0x100793cc5
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::CCMenu::alignItemsInColumnsWithArray(cocos2d::CCMenu *a1, cocos2d::CCArray *a2)
{
cocos2d::CCMenu *v2; // rbx
cocos2d::CCArray *m_pChildren; // rdi
int v4; // r13d
cocos2d::CCArray *v5; // rax
cocos2d::ccArray *data; // rax
__int64 num; // rcx
const void **arr; // r14
int v9; // r12d
int v10; // ebx
void *v11; // rax
unsigned int v12; // r15d
__m128 v13; // xmm0
__m128 v14; // xmm1
__m128 v15; // xmm2
float v16; // xmm3_4
__m128 v17; // xmm1
__int64 v18; // rdi
cocos2d::CCArray *v19; // rax
cocos2d::ccArray *v20; // rax
const void **v21; // rbx
int v22; // r14d
unsigned int v23; // r15d
void *v24; // rax
void *v25; // r12
__int64 v26; // rax
__m128 v27; // xmm0
__m128 v28; // xmm1
__m128 v29; // xmm3
void *__p; // [rsp+0h] [rbp-A0h] BYREF
float v31; // [rsp+18h] [rbp-88h] BYREF
unsigned __int64 v32; // [rsp+20h] [rbp-80h]
_DWORD *v33; // [rsp+28h] [rbp-78h]
__m128 v34; // [rsp+30h] [rbp-70h]
float v35; // [rsp+48h] [rbp-58h] BYREF
_DWORD *v36; // [rsp+50h] [rbp-50h]
__int64 v37; // [rsp+58h] [rbp-48h]
float v38; // [rsp+64h] [rbp-3Ch]
unsigned __int64 v39; // [rsp+68h] [rbp-38h]
__int64 v40; // [rsp+70h] [rbp-30h]
v2 = a1;
sub_100794080(&__p, a2);
m_pChildren = a1->m_pChildren;
LODWORD(v40) = -1073741824;
v4 = 0;
if ( m_pChildren )
{
if ( (unsigned int)sub_100720070((__int64)m_pChildren) )
{
v5 = v2->m_pChildren;
if ( v5 )
{
data = v5->data;
num = data->num;
if ( data->num )
{
v34.i64[0] = (__int64)v2;
arr = (const void **)data->arr;
v39 = (unsigned __int64)&arr[num - 1];
v9 = 0;
v40 = 4294967291LL;
v36 = __p;
v10 = 0;
v4 = 0;
do
{
if ( !*arr )
break;
v11 = __dynamic_cast(
*arr,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
if ( v11 )
{
v12 = v36[v9];
v13 = 0;
v13.f32[0] = (float)v10;
v14 = (__m128)*(unsigned int *)((*(__int64 (__fastcall **)(void *))(*(_QWORD *)v11 + 312LL))(v11) + 4);
v15 = _mm_cmpunord_ss(v14, v14);
v16 = _mm_andnot_ps(v15, v14).f32[0];
v17 = _mm_cmpgt_ss(v14, v13);
v10 = (int)COERCE_FLOAT(
_mm_andnot_ps(v17, v13).u32[0]
| (v15.i32[0] & COERCE_UNSIGNED_INT((float)v10) | LODWORD(v16)) & v17.i32[0]);
if ( ++v4 >= v12 )
{
v40 = (unsigned int)(v10 + v40 + 5);
++v9;
v4 = 0;
v10 = 0;
}
}
++arr;
}
while ( (unsigned __int64)arr <= v39 );
*(float *)&v40 = (float)((int)v40 / 2);
v2 = (cocos2d::CCMenu *)v34.i64[0];
}
}
}
}
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v35);
v18 = (__int64)v2->m_pChildren;
if ( v18 )
{
if ( (unsigned int)sub_100720070(v18) )
{
v19 = v2->m_pChildren;
if ( v19 )
{
v20 = v19->data;
if ( v20->num )
{
v21 = (const void **)v20->arr;
v32 = (unsigned __int64)&v21[v20->num - 1];
LODWORD(v39) = 0;
v37 = 0;
v33 = __p;
v22 = 0;
v38 = 0.0;
v23 = 0;
do
{
if ( !*v21 )
break;
v24 = __dynamic_cast(
*v21,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
if ( v24 )
{
v25 = v24;
if ( !v23 )
{
v23 = v33[(unsigned int)v37];
v38 = v35 / (float)(int)(v23 + 1);
*(float *)&v39 = v38;
}
v34 = (__m128)*(unsigned int *)((*(__int64 (__fastcall **)(void *))(*(_QWORD *)v24 + 312LL))(v24) + 4);
*(float *)&v36 = v35;
v26 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v25 + 312LL))(v25);
sub_10028CBE0(
&v31,
*(float *)&v39 - (float)(*(float *)&v36 * 0.5),
*(float *)&v40 - (float)(*(float *)(v26 + 4) * 0.5));
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v25 + 184LL))(v25, &v31);
v27 = 0;
v27.f32[0] = (float)v22;
v28 = _mm_cmpunord_ss(v34, v34);
v29 = _mm_cmpgt_ss(v34, v27);
v22 = (int)COERCE_FLOAT(
_mm_andnot_ps(v29, v27).u32[0]
| (v28.i32[0] & COERCE_UNSIGNED_INT((float)v22) | _mm_andnot_ps(v28, v34).u32[0]) & v29.i32[0]);
*(float *)&v39 = *(float *)&v39 + v38;
if ( ++v4 >= v23 )
{
*(float *)&v40 = *(float *)&v40 - (float)(v22 + 5);
v37 = (unsigned int)(v37 + 1);
v23 = 0;
v4 = 0;
v22 = 0;
}
}
++v21;
}
while ( (unsigned __int64)v21 <= v32 );
}
}
}
}
if ( __p )
operator delete(__p);
}