//
// sub_3755EA from 0x3755ea to 0x375740 (342 bytes)
//
// 3 xrefs:
// > sub_3755EA @ 0x375716
// > sub_3755EA @ 0x375736
// > sub_378A90 @ 0x378ad4
//
// 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_3755EA(int *result, int *a2, int a3, int a4, int a5, char a6)
{
int *v7; // r11
int *v10; // r6
int *v11; // r5
int v12; // r7
int v13; // r3
int v14; // r2
int *v15; // lr
int v16; // r9
int v17; // r3
int v18; // r2
int *v19; // r7
char *v20; // r4
int v22; // [sp+4h] [bp-10h]
int v23; // [sp+Ch] [bp-8h]
v7 = result;
if ( a4 && a5 )
{
if ( a4 + a5 == 2 )
{
if ( (*a2 == 1) < (*result == 1) )
return (int *)std::swap(result, a2);
}
else
{
v10 = result;
if ( a4 <= a5 )
{
v16 = a5 / 2;
v17 = ((char *)a2 - (char *)result) >> 5;
v11 = &a2[8 * (a5 / 2)];
while ( v17 > 0 )
{
v18 = v17 >> 1;
v19 = &v10[8 * (v17 >> 1)];
if ( (*v11 == 1) >= (*v19 == 1) )
{
v10 = v19 + 8;
v18 = v17 - v18 - 1;
}
v17 = v18;
}
v12 = ((char *)v10 - (char *)result) >> 5;
}
else
{
v11 = a2;
v12 = a4 / 2;
v13 = (a3 - (int)a2) >> 5;
v10 = &result[8 * (a4 / 2)];
while ( v13 > 0 )
{
v14 = v13 >> 1;
v15 = &v11[8 * (v13 >> 1)];
if ( (*v15 == 1) < (*v10 == 1) )
{
v11 = v15 + 8;
v14 = v13 - v14 - 1;
}
v13 = v14;
}
v16 = ((char *)v11 - (char *)a2) >> 5;
}
v23 = a3;
std::__rotate<__gnu_cxx::__normal_iterator>>((int)v10, a2, v11);
v20 = (char *)v10 + (char *)v11 - (char *)a2;
sub_3755EA(v7, v10, v20, v12, v16, a6);
LOBYTE(v22) = a6;
return (int *)sub_3755EA(v20, v11, v23, a4 - v12, a5 - v16, v22);
}
}
return result;
}