//
// sub_AF22EC from 0xaf22ec to 0xaf23ec (256 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::alignItemsInColumnsWithArray @ 0xaf2430
// > cocos2d::CCMenu::alignItemsInRowsWithArray @ 0xaf28d0
//
// 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
//
_QWORD *__usercall sub_AF22EC@(__int64 a1@, _QWORD *i@)
{
unsigned int *v2; // x0
unsigned __int64 v3; // x19
unsigned __int64 v4; // x20
_DWORD *v5; // x0
_DWORD *v6; // x2
int v7; // w1
_QWORD *v9; // [xsp+38h] [xbp+38h]
int v10; // [xsp+44h] [xbp+44h] BYREF
i[1] = 0;
i[2] = 0;
*i = 0;
if ( a1 )
{
v2 = *(unsigned int **)(a1 + 56);
if ( *v2 )
{
v3 = *((_QWORD *)v2 + 2);
v4 = v3 + 8LL * *v2 - 8;
if ( v3 <= v4 )
{
if ( *(_QWORD *)v3 )
{
v10 = *(_DWORD *)(*(_QWORD *)v3 + 56LL);
LABEL_11:
v9 = i;
v3 += 8LL;
std::vector::_M_emplace_back_aux((__int64)i, &v10);
for ( i = v9; v4 >= v3; v9[1] = v5 + 1 )
{
if ( !*(_QWORD *)v3 )
break;
v5 = (_DWORD *)v9[1];
v6 = (_DWORD *)v9[2];
v7 = *(_DWORD *)(*(_QWORD *)v3 + 56LL);
v10 = v7;
if ( v5 == v6 )
goto LABEL_11;
if ( v5 )
*v5 = v7;
v3 += 8LL;
}
}
}
}
}
return i;
}