//
// sub_1004EDC50 from 0x1004edc50 to 0x1004ee06a (1050 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
//
unsigned __int64 __fastcall sub_1004EDC50(
unsigned __int64 a1,
int a2,
unsigned __int64 a3,
int a4,
float *a5,
unsigned int a6)
{
unsigned __int64 result; // rax
__int64 v7; // rdi
__int64 v8; // r9
unsigned int v9; // r10d
unsigned int v10; // r11d
__int64 v11; // rdi
__int64 v12; // rbx
float v13; // xmm3_4
float v14; // xmm1_4
float v15; // xmm0_4
__int64 v16; // r9
float v17; // xmm2_4
float v18; // xmm3_4
unsigned __int64 v19; // r11
bool v20; // r14
bool v21; // r11
__int64 v22; // r10
__int64 v23; // r10
__int64 v24; // r11
__m128 v25; // xmm1
__m128 v26; // xmm3
__m128 v27; // xmm2
__m128 v28; // xmm0
__m128 v29; // xmm8
__m128 v30; // xmm7
__m128 v31; // xmm3
__m128 inserted; // xmm4
__m128 v33; // xmm1
__m128 v34; // xmm0
__m128 v35; // xmm5
__m128 v36; // xmm7
__m128 v37; // xmm3
__m128 v38; // xmm0
result = a1;
if ( a6 )
{
v7 = a6;
if ( a6 < 5 || a4 ^ 1 | a2 ^ 1 )
{
v8 = 0;
}
else
{
v19 = result + 16LL * a6;
v20 = v19 > a3;
v21 = v19 > (unsigned __int64)a5;
v8 = 0;
if ( (!v20 || a3 + 16 * v7 <= result) && (!v21 || (unsigned __int64)(a5 + 16) <= result) )
{
v22 = 4;
if ( (v7 & 3) != 0 )
v22 = v7 & 3;
v8 = v7 - v22;
v23 = 0;
do
{
v24 = 16LL * ((unsigned int)v23 & 0xFFFFFFFC);
v25 = *(__m128 *)(a3 + v24 + 16);
v26 = *(__m128 *)(a3 + v24 + 32);
v27 = *(__m128 *)(a3 + v24 + 48);
v28 = *(__m128 *)(a3 + v24);
v29 = _mm_shuffle_ps(_mm_unpacklo_ps(v28, v25), _mm_movelh_ps(v27, v26), 36);
v30 = _mm_blend_ps(_mm_unpacklo_ps(v26, v27), _mm_insert_ps(v25, v28, 76), 3);
v31 = _mm_blend_ps(_mm_insert_ps(v26, v27, 179), _mm_unpackhi_ps(v28, v25), 3);
inserted = _mm_insert_ps(
_mm_insert_ps(
_mm_insert_ps(
(__m128)*(unsigned int *)(a3 + v24 + 12),
(__m128)*(unsigned int *)(a3 + v24 + 28),
16),
(__m128)*(unsigned int *)(a3 + v24 + 44),
32),
(__m128)*(unsigned int *)(a3 + v24 + 60),
48);
v33 = _mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 12), (__m128)*((unsigned int *)a5 + 12), 0),
inserted),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 8), (__m128)*((unsigned int *)a5 + 8), 0),
v31),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 4), (__m128)*((unsigned int *)a5 + 4), 0),
v30),
_mm_mul_ps(_mm_shuffle_ps((__m128)*(unsigned int *)a5, (__m128)*(unsigned int *)a5, 0), v29))));
v34 = _mm_insert_ps(
_mm_insert_ps(
_mm_insert_ps(v28, (__m128)*(unsigned int *)(a3 + v24 + 16), 16),
(__m128)*(unsigned int *)(a3 + v24 + 32),
32),
(__m128)*(unsigned int *)(a3 + v24 + 48),
48);
v35 = _mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 13), (__m128)*((unsigned int *)a5 + 13), 0),
inserted),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 9), (__m128)*((unsigned int *)a5 + 9), 0),
v31),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 1), (__m128)*((unsigned int *)a5 + 1), 0),
v34),
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 5), (__m128)*((unsigned int *)a5 + 5), 0),
v30))));
v36 = _mm_insert_ps(
_mm_insert_ps(
_mm_insert_ps((__m128)*(unsigned int *)(a3 + v24 + 4), (__m128)*(unsigned int *)(a3 + v24 + 20), 16),
(__m128)*(unsigned int *)(a3 + v24 + 36),
32),
(__m128)*(unsigned int *)(a3 + v24 + 52),
48);
v37 = _mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 14), (__m128)*((unsigned int *)a5 + 14), 0),
inserted),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 10), (__m128)*((unsigned int *)a5 + 10), 0),
v31),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 2), (__m128)*((unsigned int *)a5 + 2), 0),
v34),
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 6), (__m128)*((unsigned int *)a5 + 6), 0),
v36))));
v38 = _mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 15), (__m128)*((unsigned int *)a5 + 15), 0),
inserted),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 11), (__m128)*((unsigned int *)a5 + 11), 0),
_mm_insert_ps(
_mm_insert_ps(
_mm_insert_ps(
(__m128)*(unsigned int *)(a3 + v24 + 8),
(__m128)*(unsigned int *)(a3 + v24 + 24),
16),
(__m128)*(unsigned int *)(a3 + v24 + 40),
32),
(__m128)*(unsigned int *)(a3 + v24 + 56),
48)),
_mm_add_ps(
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 3), (__m128)*((unsigned int *)a5 + 3), 0),
v34),
_mm_mul_ps(
_mm_shuffle_ps((__m128)*((unsigned int *)a5 + 7), (__m128)*((unsigned int *)a5 + 7), 0),
v36))));
*(__m128 *)(result + v24 + 48) = _mm_shuffle_ps(_mm_shuffle_ps(v35, v33, 51), _mm_unpackhi_ps(v37, v38), 226);
*(__m128 *)(result + v24 + 32) = _mm_blend_ps(_mm_insert_ps(v37, v38, 179), _mm_unpackhi_ps(v33, v35), 3);
*(__m128 *)(result + v24 + 16) = _mm_blend_ps(_mm_unpacklo_ps(v37, v38), _mm_insert_ps(v35, v33, 76), 3);
*(__m128 *)(result + v24) = _mm_shuffle_ps(_mm_unpacklo_ps(v33, v35), _mm_movelh_ps(v38, v37), 36);
v23 += 4;
}
while ( v8 != v23 );
}
}
v9 = v8 * a2;
v10 = v8 * a4;
v11 = v7 - v8;
do
{
v12 = 16LL * v10;
v13 = *(float *)(a3 + v12 + 4);
v14 = *(float *)(a3 + v12 + 8);
v15 = *(float *)(a3 + v12 + 12);
v16 = 16LL * v9;
*(float *)(result + v16) = (float)(a5[12] * v15)
+ (float)((float)(a5[8] * v14)
+ (float)((float)(*(float *)(a3 + v12) * *a5) + (float)(a5[4] * v13)));
v17 = *(float *)(a3 + v12);
*(float *)(result + v16 + 4) = (float)(a5[13] * v15)
+ (float)((float)(a5[9] * v14) + (float)((float)(a5[1] * v17) + (float)(v13 * a5[5])));
v18 = *(float *)(a3 + v12 + 4);
*(float *)(result + v16 + 8) = (float)(a5[14] * v15)
+ (float)((float)(v14 * a5[10]) + (float)((float)(a5[2] * v17) + (float)(a5[6] * v18)));
*(float *)(result + v16 + 12) = (float)(v15 * a5[15])
+ (float)((float)(*(float *)(a3 + v12 + 8) * a5[11])
+ (float)((float)(v17 * a5[3]) + (float)(v18 * a5[7])));
v9 += a2;
v10 += a4;
--v11;
}
while ( v11 );
}
return result;
}