//
// sub_10020B5F8 from 0x10020b5f8 to 0x10020b724 (300 bytes)
//
// 1 xrefs:
// > sub_10020AA24 @ 0x10020ae4c
//
// 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
//
__int64 *__fastcall sub_10020B5F8(__int64 *a1, __int64 *a2, __int64 (__fastcall **a3)(__int64 *, __int64 *))
{
__int64 v6; // x23
__int64 *v7; // x24
__int64 *v8; // x22
__int64 *v9; // x22
__int64 *v10; // x23
__int64 v11; // x8
__int64 v13; // [xsp+8h] [xbp-38h] BYREF
v6 = 0;
v13 = *a1;
do
++v6;
while ( ((*a3)(&a1[v6], &v13) & 1) != 0 );
v7 = &a1[v6];
v8 = &a1[v6 - 1];
if ( v6 == 1 )
{
do
{
if ( v7 >= a2 )
break;
--a2;
}
while ( ((*a3)(a2, &v13) & 1) == 0 );
}
else
{
do
--a2;
while ( !(unsigned int)(*a3)(a2, &v13) );
}
if ( v7 < a2 )
{
v9 = &a1[v6];
v10 = a2;
do
{
v11 = *v9;
*v9 = *v10;
*v10 = v11;
do
++v9;
while ( ((*a3)(v9, &v13) & 1) != 0 );
do
--v10;
while ( !(unsigned int)(*a3)(v10, &v13) );
}
while ( v9 < v10 );
v8 = v9 - 1;
}
if ( v8 != a1 )
*a1 = *v8;
*v8 = v13;
return v8;
}