//
// GJLevelList::reorderLevel from 0x140272d00 to 0x140272df5 (245 bytes)
//
// 5 xrefs:
// > LevelListLayer::cellPerformedAction @ 0x14042ec7f
// > LevelListLayer::setIDPopupClosed @ 0x14042ee7e
// > ??> @ 0x1408ad020
// > ??> @ 0x1408ad030
// > ??> @ 0x14091cb5c
//
// 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:28:54 +0000
//
__int64 __fastcall GJLevelList::reorderLevel(__int64 a1, unsigned int a2, int a3)
{
unsigned __int64 v3; // rdi
__int64 v4; // rbx
char *v6; // rax
char *v7; // r8
int v8; // ebp
char *v9; // r9
char *v10; // rdi
int v12; // [rsp+30h] [rbp+8h] BYREF
v3 = a3;
v4 = a1 + 320;
v6 = (char *)sub_140677130(*(_QWORD *)(a1 + 320), *(_QWORD *)(a1 + 328), a2);
v7 = *(char **)(a1 + 328);
if ( v6 != v7 )
{
v8 = *(_DWORD *)v6;
v12 = *(_DWORD *)v6;
memmove(v6, v6 + 4, v7 - (v6 + 4));
v9 = (char *)(*(_QWORD *)(a1 + 328) - 4LL);
*(_QWORD *)(a1 + 328) = v9;
if ( (v3 & 0x80000000) == 0LL )
{
if ( v3 > (__int64)&v9[-*(_QWORD *)v4] >> 2 )
LODWORD(v3) = (__int64)&v9[-*(_QWORD *)v4] >> 2;
}
else
{
LODWORD(v3) = 0;
}
v10 = (char *)(*(_QWORD *)v4 + 4LL * (int)v3);
if ( v9 == *(char **)(v4 + 16) )
{
sub_140069B30((const void **)v4, v10, &v12);
}
else if ( v10 == v9 )
{
*(_DWORD *)v9 = v8;
*(_QWORD *)(v4 + 8) += 4LL;
}
else
{
*(_DWORD *)v9 = *((_DWORD *)v9 - 1);
*(_QWORD *)(v4 + 8) += 4LL;
memmove(v10 + 4, v10, v9 - v10 - 4);
*(_DWORD *)v10 = v8;
}
}
return GJLevelList::updateLevelsString(a1);
}