//
// GJBaseGameLayer::sortSectionVector from 0x14032fc30 to 0x14032fe47 (535 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x140519b9a
// > ??> @ 0x14091f4e4
//
// 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 11:30:32 +0000
//
__int64 __fastcall GJBaseGameLayer::sortSectionVector(_QWORD *a1)
{
__int64 v1; // rdx
int v2; // r12d
__int64 v4; // r14
_QWORD *v5; // rcx
__int64 v6; // rax
__int64 v7; // rdi
__int64 i; // r15
_QWORD *v9; // rbx
__int64 v10; // rsi
int v11; // edx
__int64 v12; // r8
__int64 v13; // rdx
int v14; // r12d
__int64 result; // rax
__int64 v16; // r14
_QWORD *v17; // rcx
__int64 v18; // rax
__int64 v19; // rdi
__int64 j; // r15
_QWORD *v21; // rbx
__int64 v22; // rsi
int v23; // eax
__int64 v24; // r8
v1 = a1[1750];
v2 = 0;
if ( (a1[1751] - v1) >> 3 )
{
v4 = 0;
do
{
v5 = *(_QWORD **)(v4 + v1);
if ( v5 )
v6 = (__int64)(v5[1] - *v5) >> 3;
else
LODWORD(v6) = -1;
v7 = 0;
for ( i = (int)v6; v7 < i; ++v7 )
{
v9 = *(_QWORD **)(**(_QWORD **)(v4 + a1[1750]) + 8 * v7);
if ( v9 )
{
v10 = *(int *)(**(_QWORD **)(v4 + a1[1771]) + 4 * v7);
sub_140355B30(*v9, *v9 + 8 * v10, v10, sub_14030B120);
v11 = 0;
if ( (int)v10 > 0 )
{
v12 = 0;
do
{
v12 += 8;
*(_DWORD *)(*(_QWORD *)(v12 + *v9 - 8) + 628LL) = v11++;
}
while ( v11 < (int)v10 );
}
}
}
v1 = a1[1750];
++v2;
v4 += 8;
}
while ( v2 < (unsigned __int64)((a1[1751] - v1) >> 3) );
}
v13 = a1[1753];
v14 = 0;
result = (a1[1754] - v13) >> 3;
if ( result )
{
v16 = 0;
do
{
v17 = *(_QWORD **)(v13 + v16);
if ( v17 )
v18 = (__int64)(v17[1] - *v17) >> 3;
else
LODWORD(v18) = -1;
v19 = 0;
for ( j = (int)v18; v19 < j; ++v19 )
{
v21 = *(_QWORD **)(**(_QWORD **)(v16 + a1[1753]) + 8 * v19);
if ( v21 )
{
v22 = *(int *)(**(_QWORD **)(v16 + a1[1774]) + 4 * v19);
sub_140355ED0(*v21, *v21 + 8 * v22, v22, sub_14030B120);
v23 = 0;
if ( (int)v22 > 0 )
{
v24 = 0;
do
{
v24 += 8;
*(_DWORD *)(*(_QWORD *)(*v21 + v24 - 8) + 628LL) = v23++;
}
while ( v23 < (int)v22 );
}
}
}
v13 = a1[1753];
++v14;
v16 += 8;
result = v14;
}
while ( v14 < (unsigned __int64)((a1[1754] - v13) >> 3) );
}
return result;
}