//
// EditorUI::alignObjects from 0x100611250 to 0x100611788 (1336 bytes)
//
// 4 xrefs:
// > EditorUI::handleEditorAction @ 0x10060c430
// > EditorUI::handleEditorAction @ 0x10060ca13
// > EditorCommandsPopup::onCommand @ 0x1008dee63
// > EditorCommandsPopup::onCommand @ 0x1008dee9f
//
// This function is hookable on this platform (idp: pc, 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 12:34:35 +0000
//
void __fastcall EditorUI::alignObjects(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // r12
unsigned int v4; // eax
__int64 v5; // rax
_QWORD *v6; // rax
bool v7; // zf
__int64 v8; // r14
unsigned int v9; // r15d
__int64 v10; // rax
__int64 v11; // rbx
void *v12; // rax
__int64 v13; // r14
unsigned int v14; // r15d
__int64 v15; // rbx
__int64 StickyGroup; // rax
_DWORD *v17; // r12
_DWORD *v18; // rsi
__int64 v19; // r13
int (__cdecl *v20)(const void *, const void *); // rcx
unsigned int *v21; // rax
__int64 v22; // r14
_QWORD *v23; // r15
_QWORD *v24; // rax
__m128 v25; // xmm0
unsigned int v26; // r12d
_DWORD *v27; // r14
_QWORD *v28; // rax
float v29; // xmm0_4
float v30; // xmm1_4
__int64 v31; // r15
__int64 v32; // rax
__int64 v33; // r14
unsigned int v34; // ebx
__int64 v35; // r13
unsigned __int64 v36; // rbx
_QWORD *i; // r15
_QWORD *v38; // rsi
float v39; // xmm0_4
unsigned __int64 v40; // [rsp+Ch] [rbp-84h] BYREF
unsigned __int64 v41; // [rsp+14h] [rbp-7Ch] BYREF
double v42; // [rsp+1Ch] [rbp-74h] BYREF
__int64 v43; // [rsp+24h] [rbp-6Ch] BYREF
unsigned __int64 v44; // [rsp+2Ch] [rbp-64h] BYREF
unsigned int v45; // [rsp+34h] [rbp-5Ch]
unsigned __int64 v46; // [rsp+38h] [rbp-58h] BYREF
__int64 v47; // [rsp+40h] [rbp-50h]
__int64 v48; // [rsp+48h] [rbp-48h]
int v49; // [rsp+54h] [rbp-3Ch]
unsigned __int64 v50; // [rsp+58h] [rbp-38h] BYREF
unsigned __int64 v51[6]; // [rsp+60h] [rbp-30h] BYREF
v49 = a3;
if ( !a2 )
return;
v3 = a1;
if ( (unsigned int)sub_1007FEF90(a2) < 3 )
return;
v4 = sub_1007FEF90(a2);
v5 = sub_1007FEC20(v4);
v47 = a2;
sub_1007FEF70(v5, a2);
v6 = cocos2d::CCDictionary::create();
v7 = *(_BYTE *)(a1 + 867) == 1;
v48 = a1;
if ( v7 && !*(_BYTE *)(a1 + 868) )
{
v8 = (__int64)v6;
if ( (unsigned int)sub_1007FEF90(v47) )
{
v9 = 0;
do
{
v10 = sub_1007FEFE0(v47, v9);
if ( *(int *)(v10 + 872) <= 0 )
{
++v9;
}
else
{
v11 = v10;
sub_1007FF150(v47, v9, 1);
if ( !cocos2d::CCDictionary::objectForKey_1(v8, *(int *)(v11 + 872)) )
{
v12 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject_1(v8, (__int64)v12, *(int *)(v11 + 872));
}
}
}
while ( v9 < (unsigned int)sub_1007FEF90(v47) );
}
v13 = cocos2d::CCDictionary::allKeys(v8);
if ( (unsigned int)sub_1007FEF90(v13) )
{
v14 = 0;
do
{
v15 = *(unsigned int *)(sub_1007FEFE0(v13, v14) + 56);
StickyGroup = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(v3 + 1440));
if ( StickyGroup )
{
EditorUI::getGroupCenter((float *)v51, v15, StickyGroup, 1);
v17 = (_DWORD *)GameObject::createWithFrame("checkpoint_01_001.png");
v17[257] = 44;
v17[218] = v15;
sub_1002782D0(&v50, v51);
(*(void (__fastcall **)(_DWORD *, unsigned __int64 *))(*(_QWORD *)v17 + 1368LL))(v17, &v50);
v18 = v17;
v3 = v48;
sub_1007FEBF0(v47, v18);
}
++v14;
}
while ( v14 < (unsigned int)sub_1007FEF90(v13) );
}
}
v19 = v47;
if ( (_BYTE)v49 )
v20 = (int (__cdecl *)(const void *, const void *))sub_100603B80;
else
v20 = (int (__cdecl *)(const void *, const void *))sub_100603B30;
qsort(*(void **)(*(_QWORD *)(v47 + 56) + 16LL), **(unsigned int **)(v47 + 56), 8u, v20);
sub_1002782A0(v51);
sub_1002782A0(&v50);
v21 = *(unsigned int **)(v47 + 56);
v22 = *v21;
if ( *v21 )
{
v23 = *((_QWORD **)v21 + 2);
if ( *v23 )
{
v24 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*v23 + 192LL))(*v23);
sub_1002782D0(&v46, v24);
sub_100278300(v51, &v46);
sub_100278300(&v50, &v46);
if ( (_DWORD)v22 != 1 )
{
v36 = (unsigned __int64)&v23[v22 - 1];
for ( i = v23 + 1; (unsigned __int64)i <= v36; ++i )
{
if ( !*i )
break;
v38 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*i + 192LL))(*i);
sub_1002782D0(&v46, v38);
if ( *(float *)v51 > *(float *)&v46 )
{
LODWORD(v51[0]) = v46;
if ( *(float *)&v46 <= *(float *)&v50 )
{
LABEL_45:
v39 = *((float *)&v46 + 1);
if ( *((float *)v51 + 1) <= *((float *)&v46 + 1) )
goto LABEL_46;
goto LABEL_50;
}
}
else if ( *(float *)&v46 <= *(float *)&v50 )
{
goto LABEL_45;
}
LODWORD(v50) = v46;
v39 = *((float *)&v46 + 1);
if ( *((float *)v51 + 1) <= *((float *)&v46 + 1) )
{
LABEL_46:
if ( v39 > *((float *)&v50 + 1) )
goto LABEL_51;
continue;
}
LABEL_50:
*((float *)v51 + 1) = v39;
if ( v39 > *((float *)&v50 + 1) )
LABEL_51:
*((float *)&v50 + 1) = v39;
}
}
}
}
if ( *(float *)v51 != *(float *)&v50 || *((float *)v51 + 1) != *((float *)&v50 + 1) )
{
EditorUI::createUndoObject(v3, 5u, 0);
sub_100278370((double *)&v46, &v50, v51);
v25 = (__m128)0x3F800000u;
v25.f32[0] = 1.0 / (float)(int)(sub_1007FEF90(v19) - 1);
sub_1002783B0(&v42, &v46, v25);
if ( (unsigned int)sub_1007FEF90(v19) - 3 <= 0xFFFFFFFD )
{
v26 = 1;
do
{
v27 = (_DWORD *)sub_1007FEFE0(v19, v26);
v28 = (_QWORD *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v27 + 192LL))(v27);
sub_1002782D0(&v44, v28);
sub_1002782A0(&v40);
if ( (_BYTE)v49 )
{
v29 = *(float *)&v44;
v30 = (float)((float)(int)v26 * *((float *)&v42 + 1)) + *((float *)v51 + 1);
}
else
{
v29 = (float)((float)(int)v26 * *(float *)&v42) + *(float *)v51;
v30 = *((float *)&v44 + 1);
}
sub_100278250((float *)&v43, v29, v30);
sub_100278300(&v40, &v43);
v45 = v26;
sub_100278370((double *)&v43, &v40, &v44);
if ( v27[257] == 44 )
{
v31 = v48;
v32 = GJBaseGameLayer::getStickyGroup(*(_QWORD *)(v48 + 1440));
if ( v32 )
{
v33 = v32;
if ( (unsigned int)sub_1007FEF90(v32) )
{
v34 = 0;
do
{
v35 = sub_1007FEFE0(v33, v34);
sub_1002782D0(&v41, &v43);
EditorUI::moveObject(v31, v35, &v41);
++v34;
}
while ( v34 < (unsigned int)sub_1007FEF90(v33) );
}
}
}
else
{
sub_100278370((double *)&v41, &v40, &v44);
EditorUI::moveObject(v48, (__int64)v27, &v41);
}
v26 = v45 + 1;
v19 = v47;
}
while ( v26 < (unsigned int)sub_1007FEF90(v47) - 1 );
}
EditorUI::deactivateTransformControl(v48);
}
}