//
// GJLevelList::reorderLevelStep from 0x10058f790 to 0x10058f88b (251 bytes)
//
// 1 xrefs:
// > LevelListLayer::cellPerformedAction @ 0x10034ad54
//
// 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:32:26 +0000
//
__int64 __fastcall GJLevelList::reorderLevelStep(std::string *a1, int a2, unsigned __int8 a3)
{
__int64 v3; // rax
std::string::size_type size; // rax
std::string::pointer data; // rbx
int v6; // ecx
_DWORD *v7; // r8
int v8; // r12d
_DWORD *v9; // r14
std::string::size_type *p_size; // r15
size_t v11; // rbx
char *v12; // r14
unsigned __int64 v13; // r14
__int64 v14; // rcx
char v16[44]; // [rsp+0h] [rbp-2Ch] BYREF
*(_DWORD *)v16 = HIDWORD(v3);
size = a1[13].__r_.__value_.__l.__size_;
data = a1[13].__r_.__value_.__l.__data_;
if ( (std::string::pointer)size == data )
{
v8 = -a3 | 1;
v9 = (_DWORD *)a1[13].__r_.__value_.__l.__size_;
}
else
{
v6 = 0;
v7 = (_DWORD *)a1[13].__r_.__value_.__l.__size_;
do
{
if ( *v7 == a2 )
break;
++v6;
++v7;
}
while ( v7 != (_DWORD *)data );
v8 = v6 + (-a3 | 1);
v9 = (_DWORD *)a1[13].__r_.__value_.__l.__size_;
while ( *v9 != a2 )
{
if ( ++v9 == (_DWORD *)data )
return GJLevelList::updateLevelsString(a1);
}
}
if ( v9 != (_DWORD *)data )
{
p_size = &a1[13].__r_.__value_.__l.__size_;
*(_DWORD *)v16 = *v9;
v11 = data - (std::string::pointer)(v9 + 1);
if ( v11 )
{
memmove(v9, v9 + 1, v11);
size = *p_size;
}
v12 = (char *)v9 + v11;
a1[13].__r_.__value_.__r.__words[2] = (std::string::size_type)v12;
v13 = (__int64)&v12[-size] >> 2;
if ( v13 >= (unsigned int)v8 )
LODWORD(v13) = v8;
v14 = 0;
if ( v8 >= 0 )
v14 = (unsigned int)v13;
sub_1000D9CD0(p_size, (char *)(size + 4 * v14), v16);
}
return GJLevelList::updateLevelsString(a1);
}