//
// sub_1000B4388 from 0x1000b4388 to 0x1000b4438 (176 bytes)
//
// 1 xrefs:
// > sub_1000B3E20 @ 0x1000b40cc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int *__fastcall sub_1000B4388(int *a1, int *a2)
{
int v2; // w9
int *v3; // x8
int v4; // t1
int *v5; // x10
int v6; // t1
int v7; // w10
int v8; // w11
int v9; // t1
int v10; // t1
v2 = *a1;
if ( *a1 <= *(a2 - 1) )
{
v5 = a1 + 1;
do
{
v3 = v5;
if ( v5 >= a2 )
break;
++v5;
}
while ( v2 <= *v3 );
}
else
{
v3 = a1;
do
{
v4 = v3[1];
++v3;
}
while ( v2 <= v4 );
}
if ( v3 < a2 )
{
do
v6 = *--a2;
while ( v2 > v6 );
}
if ( v3 < a2 )
{
v7 = *v3;
v8 = *a2;
do
{
*v3 = v8;
*a2 = v7;
do
{
v9 = v3[1];
++v3;
v7 = v9;
}
while ( v2 <= v9 );
do
{
v10 = *--a2;
v8 = v10;
}
while ( v2 > v10 );
}
while ( v3 < a2 );
}
if ( v3 - 1 != a1 )
*a1 = *(v3 - 1);
*(v3 - 1) = v2;
return v3;
}