//
// std::__ndk1::__sort std::__ndk1::__sort std::__ndk1::__sort LevelEditorLayer::updateGameObjects @ 0x79e610
// > ??> @ 0xc5ba8
//
// 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 12:53:37 +0000
//
__int64 __fastcall std::__sort(
__int64 *a1,
__int64 *a2,
__int64 (__fastcall **a3)(__int64 *, __int64 *))
{
__int64 v6; // x1
__int64 *v7; // x19
__int64 *v8; // x21
int v9; // w27
__int64 *v10; // x23
__int64 (__fastcall *v11)(__int64 *, __int64 *); // x2
__int64 *v12; // x21
__int64 v13; // x0
__int64 v14; // x0
__int64 v16; // x0
__int64 *v17; // x24
__int64 *v18; // x23
__int64 v19; // x0
__int64 *v20; // x19
__int64 *v21; // x0
__int64 v22; // x0
__int64 *v23; // x1
int v24; // w21
__int64 v25; // x0
__int64 *v26; // x24
__int64 *v27; // x23
__int64 *v28; // x19
__int64 *v29; // x21
__int64 *v30; // x1
__int64 v31; // [xsp+60h] [xbp+60h] BYREF
while ( 1 )
{
while ( 1 )
{
v6 = a2 - a1;
if ( (unsigned __int64)v6 <= 5 )
{
switch ( (int)v6 )
{
case 0:
case 1:
return _stack_chk_guard;
case 2:
if ( (unsigned __int8)(*a3)(a2 - 1, a1) )
{
v14 = *a1;
*a1 = *(a2 - 1);
*(a2 - 1) = v14;
}
break;
case 3:
std::__sort3(
a1,
a1 + 1,
a2 - 1,
a3);
break;
case 4:
std::__sort4(
a1,
a1 + 1,
a1 + 2,
a2 - 1,
a3);
break;
case 5:
std::__sort5(
a1,
a1 + 1,
a1 + 2,
a1 + 3,
a2 - 1,
a3);
break;
}
return _stack_chk_guard;
}
if ( v6 <= 30 )
{
v26 = a1 + 2;
v27 = a1 + 3;
std::__sort3(
a1,
a1 + 1,
a1 + 2,
a3);
if ( a2 != a1 + 3 )
{
do
{
v28 = v26;
if ( (unsigned __int8)(*a3)(v27, v26) )
{
v31 = *v27;
*v27 = *v26;
if ( a1 != v26 )
{
do
{
v29 = v28 - 1;
if ( !(unsigned __int8)(*a3)(&v31, v28 - 1) )
break;
v30 = v28--;
*v30 = *v29;
}
while ( a1 != v29 );
}
*v28 = v31;
}
++v27;
++v26;
}
while ( a2 != v27 );
}
return _stack_chk_guard;
}
v7 = a2 - 1;
v8 = &a1[((char *)a2 - (char *)a1) >> 4];
v9 = v6 <= 999
? std::__sort3(
a1,
&a1[((char *)a2 - (char *)a1) >> 4],
a2 - 1,
a3)
: std::__sort5(
a1,
&a1[((char *)a2 - (char *)a1) >> 5],
v8,
&v8[((char *)a2 - (char *)a1) >> 5],
a2 - 1,
a3);
if ( !(unsigned __int8)(*a3)(a1, v8) )
break;
LABEL_27:
v17 = a1 + 1;
v18 = a1 + 2;
if ( v7 > a1 + 1 )
{
while ( 1 )
{
while ( 1 )
{
v17 = v18 - 1;
if ( !(unsigned __int8)(*a3)(v18 - 1, v8) )
break;
++v18;
}
do
--v7;
while ( !(unsigned __int8)(*a3)(v7, v8) );
if ( v17 > v7 )
break;
v22 = *(v18 - 1);
++v9;
*(v18 - 1) = *v7;
if ( v8 == v17 )
v8 = v7;
*v7 = v22;
++v18;
}
}
if ( v17 != v8 && (unsigned __int8)(*a3)(v8, v17) )
{
++v9;
v19 = *v17;
*v17 = *v8;
*v8 = v19;
}
if ( v9 )
{
v20 = v17 + 1;
LABEL_33:
if ( a2 - v17 <= v17 - a1 )
{
v23 = a2;
a2 = v17;
std::__sort(v20, v23, a3);
}
else
{
v21 = a1;
a1 = v20;
std::__sort(v21, v17, a3);
}
}
else
{
v20 = v17 + 1;
v24 = (unsigned __int8)std::__insertion_sort_incomplete(
a1,
v17,
a3);
if ( (unsigned __int8)std::__insertion_sort_incomplete(
v17 + 1,
a2,
a3) )
{
if ( v24 )
return _stack_chk_guard;
a2 = v17;
}
else
{
if ( !v24 )
goto LABEL_33;
a1 = v17 + 1;
}
}
}
v10 = a2 - 1;
while ( 1 )
{
--v10;
v11 = *a3;
if ( a1 == v10 )
break;
if ( (unsigned __int8)v11(v10, v8) )
{
v7 = v10;
v16 = *a1;
++v9;
*a1 = *v10;
*v10 = v16;
goto LABEL_27;
}
}
v12 = a1 + 1;
if ( !(unsigned __int8)v11(a1, a2 - 1) )
break;
LABEL_10:
if ( v12 == v7 )
return _stack_chk_guard;
while ( 1 )
{
do
++v12;
while ( !(unsigned __int8)(*a3)(a1, v12 - 1) );
do
--v7;
while ( (unsigned __int8)(*a3)(a1, v7) );
if ( v12 - 1 >= v7 )
break;
v13 = *(v12 - 1);
*(v12 - 1) = *v7;
*v7 = v13;
}
a1 = v12 - 1;
}
while ( v7 != v12 )
{
if ( (unsigned __int8)(*a3)(a1, v12) )
{
v25 = *v12;
*v12++ = *(a2 - 1);
*(a2 - 1) = v25;
goto LABEL_10;
}
++v12;
}
return _stack_chk_guard;
}