//
// sub_634CE0 from 0x634ce0 to 0x634d6c (140 bytes)
//
// 3 xrefs:
// > sub_62F93C @ 0x62fa62
// > sub_6311F8 @ 0x631330
// > sub_6313B8 @ 0x6314be
//
// 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_634CE0(int a1, int a2, int *a3, int *a4)
{
int *v4; // r5
int *v8; // r0
int v9; // r2
int v10; // r1
int v12; // r1
v4 = a3;
if ( a4 )
{
if ( !a3 )
{
a4[1] = 0;
*a4 = 0;
goto LABEL_7;
}
v8 = sub_634C40(a1, a2, a3);
v9 = v8[3];
if ( v9 == a1 )
{
v10 = v8[4];
if ( v10 == a2 )
{
a4[3] = v9;
v4 = a4;
a4[2] = (int)v8;
a4[4] = v10;
*a4 = *v8;
a4[1] = v8[1];
*v8 = (int)a4;
v8[3] = -1;
v8[4] = -1;
return v4;
}
}
else
{
if ( v9 > a1 )
goto LABEL_6;
if ( v9 < a1 )
{
LABEL_12:
v12 = v8[1];
*a4 = (int)v8;
a4[1] = v12;
v8[1] = 0;
goto LABEL_7;
}
v10 = v8[4];
}
if ( a2 < v10 )
{
LABEL_6:
*a4 = *v8;
a4[1] = (int)v8;
*v8 = 0;
LABEL_7:
v4 = a4;
a4[3] = a1;
a4[4] = a2;
a4[2] = 0;
return v4;
}
goto LABEL_12;
}
return v4;
}