//
// GJGameLevel::dtExpandOrder from 0x100586540 to 0x100586761 (545 bytes)
//
// 21 xrefs:
// > GJGameLevel::getSessionBest @ 0x100586b05
// > sub_1005871C0 @ 0x100587316
// > DeathTrackerPopup::init @ 0x1008caa14
// > sub_1008CCC60 @ 0x1008ccddd
// > sub_1008CD740 @ 0x1008cd882
// > sub_1008CDF10 @ 0x1008ce0e3
// > sub_1008CDF10 @ 0x1008ce190
// > sub_1008CDF10 @ 0x1008ce1d9
// > sub_1008CDF10 @ 0x1008ce392
// > sub_1008CFEC0 @ 0x1008cff31
// > sub_1008CFEC0 @ 0x1008cffd8
// > sub_1008CFEC0 @ 0x1008d0098
// > sub_1008CFEC0 @ 0x1008d0180
// > sub_1008D27A0 @ 0x1008d2841
// > sub_1008D27A0 @ 0x1008d2a00
// > sub_1008D2D90 @ 0x1008d3000
// > sub_1008D2D90 @ 0x1008d3027
// > sub_1008D3CC0 @ 0x1008d456c
// > sub_1008D3CC0 @ 0x1008d45ed
// > sub_1008D3CC0 @ 0x1008d47ee
// > sub_1008D3CC0 @ 0x1008d484e
//
// 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:22 +0000
//
void __fastcall GJGameLevel::dtExpandOrder(std::string *this, void **a2)
{
std::string *v2; // rbx
unsigned int v3; // r13d
std::string::size_type size; // r13
std::string::size_type v5; // r14
std::string::size_type v6; // rax
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 *v7; // r12
const char *v8; // r15
int v9; // r13d
void **v10; // r12
char *v11; // r14
__int64 v12; // rbx
unsigned __int64 v13; // rax
signed __int64 v14; // r14
__int64 v15; // rbx
unsigned __int64 v16; // rcx
__int64 v17; // rax
unsigned __int64 v18; // r15
_DWORD *v19; // r12
void *__src; // [rsp+8h] [rbp-68h]
char *v21; // [rsp+10h] [rbp-60h]
std::string::size_type v22; // [rsp+18h] [rbp-58h]
unsigned __int64 v23; // [rsp+28h] [rbp-48h]
int v24; // [rsp+44h] [rbp-2Ch]
v2 = this;
v3 = (unsigned int)this->__r_.__value_.__l.0;
if ( (v3 & 1) != 0 )
{
size = this->__r_.__value_.__l.__size_;
if ( !size )
return;
goto LABEL_5;
}
size = v3 >> 1;
if ( size )
{
LABEL_5:
v5 = 0;
v23 = size;
while ( 1 )
{
v6 = std::string::find(v2, 44, v5);
if ( v6 == -1 )
v6 = size;
v22 = v6;
v7 = (*(_BYTE *)&v2->__r_.__value_.__s.0 & 1) != 0
? (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 *)v2->__r_.__value_.__r.__words[2]
: (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 *)((char *)&this->__r_.__value_.__l.0 + 1);
v8 = (const char *)memchr((char *)v7 + v5, 120, v6 - v5);
v24 = atoi((const char *)v7 + v5);
if ( !v8 )
break;
v9 = atoi(v8 + 1);
v10 = a2;
if ( v9 > 0 )
goto LABEL_16;
LABEL_6:
v5 = v22 + 1;
size = v23;
v2 = this;
if ( v22 + 1 >= v23 )
return;
}
v9 = 1;
v10 = a2;
LABEL_16:
v11 = (char *)v10[1];
do
{
v13 = (unsigned __int64)v10[2];
if ( (unsigned __int64)v11 < v13 )
{
*(_DWORD *)v11 = v24;
v12 = (__int64)(v11 + 4);
}
else
{
v14 = v11 - (_BYTE *)*v10;
v15 = v14 >> 2;
v16 = (v14 >> 2) + 1;
if ( v16 > 0x3FFFFFFFFFFFFFFFLL )
sub_100093980();
v17 = v13 - (_QWORD)*v10;
v18 = v17 >> 1;
if ( v17 >> 1 <= v16 )
v18 = (v14 >> 2) + 1;
if ( (unsigned __int64)v17 >= 0x7FFFFFFFFFFFFFFCLL )
v18 = 0x3FFFFFFFFFFFFFFFLL;
__src = *v10;
if ( v18 )
{
if ( v18 > 0x3FFFFFFFFFFFFFFFLL )
sub_10001ADB0();
v19 = operator new(4 * v18);
}
else
{
v19 = nullptr;
}
v21 = (char *)&v19[v18];
v19[v15] = v24;
v12 = (__int64)&v19[v15 + 1];
memcpy(v19, __src, v14);
*a2 = v19;
v10 = a2;
a2[1] = (void *)v12;
a2[2] = v21;
if ( __src )
operator delete(__src);
}
v10[1] = (void *)v12;
v11 = (char *)v12;
--v9;
}
while ( v9 );
goto LABEL_6;
}
}