//
// GameToolbox::alignItemsHorisontally from 0x1004ee2d0 to 0x1004ee5fd (813 bytes)
//
// 44 xrefs:
// > EditLevelLayer::setupLevelInfo @ 0x1001fc6e9
// > EditLevelLayer::setupLevelInfo @ 0x1001fc731
// > EditLevelLayer::setupLevelInfo @ 0x1001fc777
// > EditLevelLayer::setupLevelInfo @ 0x1001fc7f4
// > NewgroundsInfoLayer::init @ 0x100217c2e
// > NCSInfoLayer::init @ 0x10021872d
// > ShareLevelLayer::init @ 0x100280b99
// > ShareLevelLayer::setupStars @ 0x10028103d
// > ShareLevelLayer::setupStars @ 0x100281078
// > RateDemonLayer::init @ 0x100284073
// > RateDemonLayer::init @ 0x100284163
// > RateStarsLayer::init @ 0x10028c073
// > RateStarsLayer::init @ 0x10028c0e1
// > RateStarsLayer::init @ 0x10028c2e6
// > GJAccountSettingsLayer::init @ 0x1002a0e99
// > GJWriteMessagePopup::init @ 0x1002a9203
// > UIPOptionsLayer::init @ 0x1002b7568
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x1002cfcc5
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x1002cfd21
// > SetGroupIDLayer::init @ 0x10031351c
// > PurchaseItemPopup::init @ 0x10032819e
// > ShareListLayer::init @ 0x100362693
// > WorldLevelPage::init @ 0x1003c63b4
// > AccountRegisterLayer::init @ 0x1004957fc
// > AccountLoginLayer::init @ 0x1004990fb
// > EndLevelLayer::customSetup @ 0x1004c151e
// > UILayer::init @ 0x1004c802a
// > LevelFeatureLayer::init @ 0x100504f87
// > GJRateLevelLayer::init @ 0x100505e59
// > GJRateLevelLayer::init @ 0x100505ebe
// > GJRateLevelLayer::init @ 0x1005063af
// > RateLevelLayer::init @ 0x100568243
// > RateLevelLayer::init @ 0x100568333
// > GauntletSelectLayer::setupGauntlets @ 0x10057241c
// > ShareCommentLayer::init @ 0x1005e04f8
// > SetupGradientPopup::init @ 0x1005f2a40
// > SetupGradientPopup::init @ 0x1005f2a9d
// > SongInfoLayer::init @ 0x1006016c1
// > LevelSearchLayer::init @ 0x10062974b
// > LevelSearchLayer::init @ 0x100629ae3
// > DemonFilterSelectLayer::init @ 0x10062f85e
// > ProfilePage::loadPageFromUserInfo @ 0x1007bb769
// > ProfilePage::loadPageFromUserInfo @ 0x1007bbf4f
// > DemonInfoPopup::init @ 0x1007c16f1
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall GameToolbox::alignItemsHorisontally(cocos2d::CCArray *a1, float a2, cocos2d::CCPoint a3, bool a4)
{
int v4; // edx
cocos2d::ccArray *data; // rax
__int64 num; // rcx
__m128 v7; // xmm0
cocos2d::CCObject **arr; // rbx
unsigned __int64 v9; // r15
cocos2d::CCObject *v10; // r14
float v11; // xmm0_4
cocos2d::CCObject *v12; // r13
_QWORD *v13; // rsi
cocos2d::ccArray *v14; // rax
__int64 v15; // rcx
__m128 v16; // xmm0
cocos2d::CCObject **v17; // r14
unsigned __int64 v18; // rbx
cocos2d::CCObject *v19; // r13
float v20; // xmm0_4
unsigned __int64 *v21; // rax
float v22; // xmm0_4
cocos2d::CCObject *v23; // r12
_QWORD *v24; // rsi
float v25; // xmm0_4
unsigned __int64 *v26; // rax
double v27; // [rsp+8h] [rbp-88h] BYREF
cocos2d::CCArray *v28; // [rsp+10h] [rbp-80h]
_BOOL8 v29; // [rsp+18h] [rbp-78h]
__m128 v30; // [rsp+20h] [rbp-70h]
int v31; // [rsp+3Ch] [rbp-54h]
__m128 v32; // [rsp+40h] [rbp-50h]
__int64 v33; // [rsp+5Ch] [rbp-34h] BYREF
float v34; // [rsp+64h] [rbp-2Ch]
v29 = a4;
v30 = *(__m128 *)&a2;
if ( a1 )
{
data = a1->data;
num = data->num;
if ( data->num )
{
v28 = a1;
v7 = _mm_xor_ps((__m128)xmmword_1008150B0, v30);
v32 = v7;
arr = data->arr;
v9 = (unsigned __int64)&arr[num - 1];
v31 = v4;
if ( (_BYTE)v4 )
{
do
{
v10 = *arr;
if ( !*arr )
break;
sub_10028CFC0(&v33, &qword_1009A2438);
v34 = *(float *)&v33;
v11 = ((float (__fastcall *)(cocos2d::CCObject *, float, double))v10->__vftable[1].canEncode)(
v10,
*(float *)&v33,
*(double *)&a3);
*(__m128 *)&a3.x = v32;
a3.x = v32.f32[0] + (float)((float)(v11 * v34) + v30.f32[0]);
v32 = *(__m128 *)&a3.x;
++arr;
}
while ( (unsigned __int64)arr <= v9 );
}
else
{
do
{
v12 = *arr;
if ( !*arr )
break;
v13 = (_QWORD *)((__int64 (__fastcall *)(cocos2d::CCObject *, double, double))v12->__vftable[3].setTag)(
*arr,
*(double *)v7.i64,
*(double *)&a3);
sub_10028CFC0(&v33, v13);
v7.i64[0] = (unsigned int)v33;
v34 = *(float *)&v33;
v7.f32[0] = ((float (__fastcall *)(cocos2d::CCObject *))v12->__vftable[1].canEncode)(v12);
v7.f32[0] = (float)(v7.f32[0] * v34) + v30.f32[0];
*(__m128 *)&a3.x = v32;
a3.x = v32.f32[0] + v7.f32[0];
v32 = *(__m128 *)&a3.x;
++arr;
}
while ( (unsigned __int64)arr <= v9 );
}
v14 = v28->data;
v15 = v14->num;
if ( v14->num )
{
v16 = v32;
v16.f32[0] = v32.f32[0] * -0.5;
v32 = v16;
v17 = v14->arr;
v18 = (unsigned __int64)&v17[v15 - 1];
if ( (_BYTE)v31 )
{
do
{
v19 = *v17;
if ( !*v17 )
break;
sub_10028CFC0(&v33, &qword_1009A2438);
v34 = *(float *)&v33;
v20 = ((float (__fastcall *)(cocos2d::CCObject *, float, double))v19->__vftable[1].canEncode)(
v19,
*(float *)&v33,
*(double *)&a3);
sub_10028CBE0((float *)&v27, (float)((float)(v20 * v34) * 0.5) + v32.f32[0], 0.0);
((void (__fastcall *)(cocos2d::CCObject *, double *))v19->__vftable[2].isEqual)(v19, &v27);
v21 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCObject *))v19->__vftable[2].acceptVisitor)(v19);
sub_10028CCE0(&v27, (unsigned __int64 *)v29, v21);
((void (__fastcall *)(cocos2d::CCObject *, double *))v19->__vftable[2].isEqual)(v19, &v27);
v34 = *(float *)&v33;
v22 = ((float (__fastcall *)(cocos2d::CCObject *))v19->__vftable[1].canEncode)(v19);
*(__m128 *)&a3.x = v32;
a3.x = v32.f32[0] + (float)((float)(v22 * v34) + v30.f32[0]);
v32 = *(__m128 *)&a3.x;
++v17;
}
while ( (unsigned __int64)v17 <= v18 );
}
else
{
do
{
v23 = *v17;
if ( !*v17 )
break;
v24 = (_QWORD *)((__int64 (__fastcall *)(cocos2d::CCObject *, double, double))v23->__vftable[3].setTag)(
*v17,
*(double *)v16.i64,
*(double *)&a3);
sub_10028CFC0(&v33, v24);
v34 = *(float *)&v33;
v25 = ((float (__fastcall *)(cocos2d::CCObject *))v23->__vftable[1].canEncode)(v23);
sub_10028CBE0((float *)&v27, (float)((float)(v25 * v34) * 0.5) + v32.f32[0], 0.0);
((void (__fastcall *)(cocos2d::CCObject *, double *))v23->__vftable[2].isEqual)(v23, &v27);
v26 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCObject *))v23->__vftable[2].acceptVisitor)(v23);
sub_10028CCE0(&v27, (unsigned __int64 *)v29, v26);
((void (__fastcall *)(cocos2d::CCObject *, double *))v23->__vftable[2].isEqual)(v23, &v27);
v16.i64[0] = (unsigned int)v33;
v34 = *(float *)&v33;
v16.f32[0] = ((float (__fastcall *)(cocos2d::CCObject *))v23->__vftable[1].canEncode)(v23);
v16.f32[0] = (float)(v16.f32[0] * v34) + v30.f32[0];
*(__m128 *)&a3.x = v32;
a3.x = v32.f32[0] + v16.f32[0];
v32 = *(__m128 *)&a3.x;
++v17;
}
while ( (unsigned __int64)v17 <= v18 );
}
}
}
}
}