//
// sub_634D70 from 0x634d70 to 0x634e1a (170 bytes)
//
// 2 xrefs:
// > sub_6311F8 @ 0x6312b2
// > sub_6313B8 @ 0x63143e
//
// 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_634D70(int a1, int a2, int *a3, int **a4)
{
int *result; // r0
int v8; // r3
int *v9; // r4
int *v10; // r3
int v11; // r1
int *v12; // r0
int v13; // r3
int *v14; // r0
if ( !a3 )
{
*a4 = nullptr;
return a3;
}
result = sub_634C40(a1, a2, a3);
v8 = result[3];
v9 = result;
if ( v8 <= a1 && (v8 < a1 || result[4] <= a2) )
goto LABEL_5;
if ( *result )
{
v12 = sub_634C40(*(_DWORD *)(*result + 12), *(_DWORD *)(*result + 16), result);
v13 = v12[3];
v9 = v12;
if ( v13 <= a1 && (v13 < a1 || a2 >= v12[4]) )
{
LABEL_5:
v10 = (int *)v9[2];
if ( v10 )
{
v11 = v9[4];
v10[3] = v9[3];
v10[4] = v11;
v10[1] = v9[1];
*v10 = *v9;
*a4 = v9;
return v10;
}
if ( *v9 )
{
v14 = sub_634C40(a1, a2, (int *)*v9);
v14[1] = v9[1];
}
else
{
v14 = (int *)v9[1];
}
*a4 = v9;
return v14;
}
a3 = v12;
*a4 = nullptr;
return a3;
}
*a4 = nullptr;
return result;
}