//
// sub_1004EB838 from 0x1004eb838 to 0x1004eba68 (560 bytes)
//
// 2 xrefs:
// > sub_100451774 @ 0x1004517a8
// > sub_100451814 @ 0x100451890
//
// 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_1004EB838(__int64 a1)
{
int v2; // w11
int v3; // w8
int v4; // w9
__int64 v5; // x10
float32x4_t *v6; // x1
__int64 v7; // x12
__int64 v8; // x14
float32x2_t v9; // d2
float32x2_t v10; // d4
int v11; // w13
int v12; // w14
int v13; // w9
float32x4_t *v14; // x11
int32x4_t *v15; // x10
int32x4_t v16; // q1
int32x4_t v17; // q2
float32x4_t v18; // q3
float32x4_t v19; // q4
float32x4_t v20; // q2
float *v21; // x10
int v22; // w8
float *v23; // x9
float *v24; // x10
float v25; // t1
__int64 result; // x0
__int64 v27; // x12
int v28; // w8
float32x4_t *v29; // x9
float32x4_t *v30; // x10
float32x4_t *v31; // x11
__int64 v32; // x12
float v33; // s0
float32x4_t v34; // q1
v2 = *(_DWORD *)(a1 + 20);
if ( v2 <= 0 )
{
v6 = *(float32x4_t **)(a1 + 120);
v4 = *(_DWORD *)(a1 + 16);
}
else
{
v3 = 0;
v4 = *(_DWORD *)(a1 + 16);
v5 = *(_QWORD *)(a1 + 96);
v7 = *(_QWORD *)(a1 + 112);
v6 = *(float32x4_t **)(a1 + 120);
do
{
v11 = (v4 + 1) * ((*(_DWORD *)(a1 + 84) + v3 + *(_DWORD *)(a1 + 24)) % *(_DWORD *)(a1 + 32));
v12 = (v4 + 1) * v3;
if ( (unsigned int)v4 >= 4 )
{
v13 = v4 >> 2;
v14 = (float32x4_t *)(v7 + 8LL * v12);
v15 = (int32x4_t *)(v5 + 8LL * v11);
do
{
v16 = *v15;
v17 = v15[1];
v15 += 2;
v18 = *v14;
v19 = v14[1];
v14 += 2;
v20 = vaddq_f32(
v6[1],
vaddq_f32(
vmulq_f32((float32x4_t)vtrn1q_s32(v17, v17), v19),
vmulq_f32(
vmulq_f32((float32x4_t)vtrn2q_s32(v17, v17), (float32x4_t)vrev64q_s32((int32x4_t)v19)),
(float32x4_t)xmmword_1006489C0)));
*v6 = vaddq_f32(
*v6,
vaddq_f32(
vmulq_f32((float32x4_t)vtrn1q_s32(v16, v16), v18),
vmulq_f32(
vmulq_f32((float32x4_t)vtrn2q_s32(v16, v16), (float32x4_t)vrev64q_s32((int32x4_t)v18)),
(float32x4_t)xmmword_1006489C0)));
v6[1] = v20;
v6 += 2;
--v13;
}
while ( v13 );
v5 = *(_QWORD *)(a1 + 96);
v7 = *(_QWORD *)(a1 + 112);
v6 = *(float32x4_t **)(a1 + 120);
v4 = *(_DWORD *)(a1 + 16);
v2 = *(_DWORD *)(a1 + 20);
}
v8 = v7 + 8LL * (v4 + v12);
v9.i32[0] = *(_DWORD *)(v8 + 4);
v10 = *(float32x2_t *)(v5 + 8LL * (v4 + v11));
v9.f32[1] = -v9.f32[0];
*(float32x2_t *)&v6->f32[2 * v4] = vadd_f32(
vmla_f32(
(float32x2_t)vrev64_s32((int32x2_t)vmul_f32(v10, v9)),
v10,
vld1_dup_f32((const float *)v8)),
*(float32x2_t *)&v6->f32[2 * v4]);
++v3;
}
while ( v3 < v2 );
}
v21 = &v6->f32[2 * *(int *)(a1 + 36)];
*(v21 - 3) = -v6[1].f32[1];
*(v21 - 5) = -v6[1].f32[3];
*(v21 - 7) = -v6[2].f32[1];
v22 = (v4 >> 2) - 1;
if ( v4 >> 2 != 1 )
{
v23 = v21 - 15;
v24 = &v6[4].f32[1];
do
{
v23[6] = -*(v24 - 6);
v23[4] = -*(v24 - 4);
v23[2] = -*(v24 - 2);
v25 = *v24;
v24 += 8;
*v23 = -v25;
v23 -= 8;
--v22;
}
while ( v22 );
}
result = sub_100436F30(*(_QWORD *)(a1 + 72), (__int64)v6, *(_QWORD *)(a1 + 128), 0, 1);
if ( !(_DWORD)result )
{
v27 = *(unsigned int *)(a1 + 16);
if ( (int)v27 >= 1 )
{
v28 = 0;
v29 = *(float32x4_t **)(a1 + 64);
v30 = (float32x4_t *)(*(_QWORD *)(a1 + 56) + 4LL * *(int *)(a1 + 92));
v31 = *(float32x4_t **)(a1 + 128);
v32 = 4 * v27;
v33 = 1.0 / (float)*(int *)(a1 + 36);
do
{
v34 = vmulq_n_f32(vaddq_f32(*v31, *v29), v33);
*v29++ = *(float32x4_t *)((char *)v31 + v32);
*v30++ = v34;
++v31;
v28 += 4;
}
while ( v28 < *(_DWORD *)(a1 + 16) );
}
return 0;
}
return result;
}