//
// sub_75C048 from 0x75c048 to 0x75c1c8 (384 bytes)
//
// 0 xrefs:
//
// 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_75C048(int result, _DWORD *a2, __int64 a3, int a4, int a5)
{
__int64 v5; // r6
int v6; // r4
int v7; // r12
bool v8; // zf
_BOOL4 v9; // r4
char v10; // r9
char v11; // r5
int v12; // r9
int v13; // r5
int v14; // lr
char v15; // r11
_BOOL4 v16; // r3
unsigned int v17; // r2
__int64 v18; // r8
char v19; // r4
int v20; // r4
int v21; // r3
int v22; // r3
_BOOL4 v23; // r3
int v24; // r2
v5 = a3;
v6 = a2[8];
v7 = v6 & 8;
*(_QWORD *)result = -1;
v8 = (v6 & 0x10 & (unsigned __int8)a5) == 0;
v9 = ((unsigned __int8)a5 & v6 & 8) != 0;
*(_DWORD *)(result + 8) = 0;
v10 = !v8;
v11 = ((a5 & v7) != 0) & v10;
v12 = v10 & 1;
if ( a4 == 1 )
v13 = 0;
else
v13 = v11 & 1;
if ( (a5 & 0x10) != 0 )
v9 = 0;
if ( (a5 & 8) != 0 )
v12 = 0;
if ( v9 )
{
v14 = a2[1];
v15 = v12 | v13;
v16 = a3 == 0;
if ( v14 )
v16 = 1;
if ( v16 )
{
LABEL_15:
v17 = a2[5];
if ( v17 && v17 > a2[3] )
{
if ( !v7 )
{
a2[1] = v17;
a2[2] = v17;
}
a2[3] = v17;
}
if ( a4 == 1 )
{
v18 = v5 + __PAIR64__((int)(v17 - v14) >> 31, (int)(v17 - v14) >> 2);
v5 += __PAIR64__((a2[2] - v14) >> 31, (a2[2] - v14) >> 2);
}
else
{
if ( a4 == 2 )
v5 += __PAIR64__((a2[3] - v14) >> 31, (a2[3] - v14) >> 2);
v18 = v5;
}
v19 = v9 | v13;
if ( v5 >= 0 )
v20 = v19 & 1;
else
v20 = 0;
if ( v20 && __SPAIR64__((a2[3] - v14) >> 31, (a2[3] - v14) >> 2) >= v5 )
{
v24 = a2[1];
*(_QWORD *)result = v5;
a2[2] = v24 + 4 * v5;
}
if ( v18 >= 0 )
v21 = v15 & 1;
else
v21 = 0;
if ( v21 )
{
if ( (a2[3] - v14) >> 2 >= v18 )
{
v22 = a2[4];
*(_QWORD *)result = v18;
a2[5] = v22 + 4 * v18;
}
}
}
}
else
{
v14 = a2[4];
v23 = a3 == 0;
if ( v14 )
v23 = 1;
if ( v23 )
{
v15 = v12 | v13;
if ( v12 | v13 )
goto LABEL_15;
}
}
return result;
}