//
// sub_1004421E8 from 0x1004421e8 to 0x100442344 (348 bytes)
//
// 1 xrefs:
// > sub_1004420AC @ 0x10044210c
//
// 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_1004421E8(__int64 a1, double a2, double a3, double a4)
{
__int64 v4; // x19
__int64 v5; // x20
_QWORD *v6; // x8
float v7; // s0
float v8; // s1
float32x2_t v9; // d0
float v10; // s1
float v11; // s2
float v12; // s2
float v13; // s3
v4 = a1 + 70492;
v5 = 12;
do
{
if ( *(_BYTE *)(v4 + 12) )
{
*(_QWORD *)(v4 - 8) = *(_QWORD *)(v4 - 20);
v6 = (_QWORD *)(v4 - 8);
*(_DWORD *)v4 = *(_DWORD *)(v4 - 12);
v7 = *(float *)(v4 - 8);
v8 = *(float *)v4;
*(float *)&a4 = sqrtf((float)((float)(v7 * v7) + 0.0) + (float)(v8 * v8));
if ( *(float *)&a4 <= 0.0 )
{
*v6 = 0;
v9.i32[0] = 0;
v10 = 0.0;
}
else
{
v9 = vdiv_f32((float32x2_t)LODWORD(v7), (float32x2_t)vdup_lane_s32(*(int32x2_t *)&a4, 0));
*v6 = v9;
v10 = v8 / *(float *)&a4;
}
*(float *)v4 = v10;
if ( v9.f32[0] != 0.0 || (v11 = 0.0, v10 != 0.0) )
{
v12 = -v10;
if ( v10 >= 0.0 )
v12 = v10;
v13 = -v9.f32[0];
if ( v9.f32[0] >= 0.0 )
v13 = v9.f32[0];
if ( v13 <= v12 )
{
v11 = (float)(v9.f32[0] / v12) + 1.0;
if ( v10 < 0.0 )
v11 = 6.0 - v11;
}
else
{
v11 = 3.0 - (float)(v10 / v13);
if ( v9.f32[0] < 0.0 )
v11 = 10.0 - v11;
}
}
*(float *)(v4 + 4) = v11;
*(float *)(v4 + 8) = (float)(atan2f(v9.f32[0], v10) * 180.0) / 3.1416;
}
v4 += 48;
--v5;
}
while ( v5 );
return 0;
}