//
// sub_365358 from 0x365358 to 0x3653b2 (90 bytes)
//
// 2 xrefs:
// > hashRemapMap @ 0x369f06
// > hashRemapMap @ 0x369f34
//
// 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
//
_DWORD *__fastcall sub_365358(_DWORD *result, _DWORD *a2)
{
_DWORD *i; // r3
int v3; // r5
int v4; // r6
_DWORD *v5; // r2
int v6; // r4
int v7; // r7
_DWORD *j; // r2
int v9; // r4
if ( result != a2 )
{
for ( i = result + 2; i != a2; i += 2 )
{
v3 = *i;
v4 = i[1];
if ( *i >= *result )
{
for ( j = i; ; j[3] = j[1] )
{
v9 = *(j - 2);
if ( v3 >= v9 )
break;
*j = v9;
j -= 2;
}
*j = v3;
j[1] = v4;
}
else
{
v5 = i + 2;
v6 = ((char *)i - (char *)result) >> 3;
while ( v6 > 0 )
{
v7 = *(v5 - 4);
--v6;
v5 -= 2;
*v5 = v7;
v5[1] = *(v5 - 1);
}
*result = v3;
result[1] = v4;
}
}
}
return result;
}