//
// sub_844CC0 from 0x844cc0 to 0x844d60 (160 bytes)
//
// 9 xrefs:
// > sub_83ECB8 @ 0x83ece2
// > sub_83F23C @ 0x83f27c
// > ??> @ 0x83f972
// > sub_844D60 @ 0x844d7a
// > sub_844DF0 @ 0x844e0a
// > sub_844DF0 @ 0x844e4e
// > sub_844DF0 @ 0x844e84
// > sub_844E9C @ 0x844edc
// > sub_844E9C @ 0x844f16
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:02:23 +0000
//
int *__fastcall sub_844CC0(int a1, int a2, int *a3)
{
int *v5; // r5
int *v6; // r0
int v7; // r3
bool v8; // cc
int v9; // r3
int *v10; // r3
int v11; // r4
int v12; // r4
int v13; // r3
int v14; // r4
int *v15; // r4
int v16; // r3
int v18; // [sp+8h] [bp-1Ch] BYREF
int v19; // [sp+Ch] [bp-18h]
if ( !a3 )
return a3;
v19 = 0;
v18 = 0;
v5 = &v18;
v6 = &v18;
while ( 1 )
{
v7 = a3[3];
v8 = v7 < a1;
if ( v7 <= a1 )
break;
LABEL_14:
v10 = (int *)*a3;
if ( !*a3 )
{
v15 = nullptr;
goto LABEL_22;
}
v14 = v10[3];
if ( v14 <= a1 && (v14 < a1 || v10[4] <= a2) )
{
v10 = a3;
}
else
{
*a3 = v10[1];
v15 = (int *)*v10;
v10[1] = (int)a3;
if ( !v15 )
goto LABEL_26;
}
*v5 = (int)v10;
v5 = v10;
a3 = (int *)*v10;
}
while ( 1 )
{
if ( !v8 )
{
v9 = a3[4];
if ( v9 > a2 )
goto LABEL_14;
if ( v9 >= a2 )
goto LABEL_21;
}
v10 = (int *)a3[1];
if ( !v10 )
{
LABEL_21:
v15 = (int *)*a3;
goto LABEL_22;
}
v11 = v10[3];
if ( v11 <= a1 && (v11 < a1 || v10[4] < a2) )
break;
LABEL_13:
v6[1] = (int)a3;
v6 = a3;
a3 = (int *)a3[1];
v13 = a3[3];
v8 = v13 < a1;
if ( v13 > a1 )
goto LABEL_14;
}
a3[1] = *v10;
v12 = v10[1];
*v10 = (int)a3;
if ( v12 )
{
a3 = v10;
goto LABEL_13;
}
v15 = a3;
LABEL_26:
a3 = v10;
LABEL_22:
v6[1] = (int)v15;
*v5 = a3[1];
v16 = v18;
*a3 = v19;
a3[1] = v16;
return a3;
}