//
// sub_100572E0C from 0x100572e0c to 0x100572eec (224 bytes)
//
// 2 xrefs:
// > sub_10056C89C @ 0x10056ca68
// > sub_10056EC08 @ 0x10056ecbc
//
// 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
//
__int64 **__fastcall sub_100572E0C(__int64 *a1, __int64 a2, __int64 **a3, _QWORD *a4)
{
_QWORD *v4; // x19
__int64 *v7; // x0
__int64 *v8; // x9
__int64 v9; // x8
v4 = a4;
if ( !a4 )
return a3;
if ( !a3 )
goto LABEL_12;
v7 = sub_100572CEC(a1, a2, a3);
v8 = (__int64 *)v7[3];
if ( a1 != v8 )
{
if ( v7 )
goto LABEL_8;
LABEL_12:
*v4 = 0;
v4[1] = 0;
LABEL_14:
v4[3] = a1;
v4[4] = a2;
v4[2] = 0;
return (__int64 **)v4;
}
if ( (_DWORD)a2 != *((_DWORD *)v7 + 8) )
{
LABEL_8:
if ( (__int64)a1 >= (__int64)v8 && ((__int64)a1 > (__int64)v8 || (int)a2 >= *((_DWORD *)v7 + 8)) )
{
v9 = v7[1];
*v4 = v7;
v4[1] = v9;
v7[1] = 0;
}
else
{
*v4 = *v7;
v4[1] = v7;
*v7 = 0;
}
goto LABEL_14;
}
v4[2] = v7;
v4[3] = a1;
v4[4] = a2;
*v4 = *v7;
v4[1] = v7[1];
*v7 = (__int64)v4;
*(_OWORD *)(v7 + 3) = xmmword_100669E30;
return (__int64 **)v4;
}