//
// GJLevelList::reorderLevel from 0x4d8e5c to 0x4d8ee8 (140 bytes)
//
// 2 xrefs:
// > GJLevelList::reorderLevelStep @ 0x4d8f0c
// > LevelListLayer::setIDPopupClosed @ 0x6d4e80
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:50:54 +0000
//
void __fastcall GJLevelList::reorderLevel(GJLevelList *this, int a2, int a3)
{
int v3; // r7
char *v5; // r4
char *v6; // r2
_DWORD *v7; // r3
unsigned int v8; // r4
size_t v9; // r4
char *v10; // r4
char *v11; // r3
_DWORD v12[3]; // [sp+0h] [bp-Ch] BYREF
v12[0] = this;
v12[1] = a2;
v12[2] = a3;
v3 = a3;
v5 = *((char **)this + 67);
v6 = *((char **)this + 66);
while ( 1 )
{
v7 = v6;
if ( v6 == v5 )
break;
v6 += 4;
if ( *v7 == a2 )
{
v9 = v5 - v6;
v12[0] = a2;
if ( v9 >> 2 )
v7 = memmove(v7, v7 + 1, v9);
v10 = (char *)v7 + v9;
while ( 1 )
{
v11 = *((char **)this + 67);
if ( v10 == v11 )
break;
*((_DWORD *)this + 67) = v11 - 4;
}
if ( v3 < 0 )
{
v3 = 0;
}
else
{
v8 = (int)&v10[-*((_DWORD *)this + 66)] >> 2;
if ( v3 >= v8 )
v3 = v8;
}
std::vector::insert((_DWORD *)this + 66, (char *)(*((_DWORD *)this + 66) + 4 * v3), (char *)v12);
break;
}
}
GJLevelList::updateLevelsString(this);
}