void mulmp4(float *result, const float *s1, const float *s2) {
  const float x = s1[(0 + (0 << 2))] * s2[0] + s1[(0 + (1 << 2))] * s2[1] +
                  s1[(0 + (2 << 2))] * s2[2] + s1[(0 + (3 << 2))] * s2[3];
  const float y = s1[(1 + (0 << 2))] * s2[0] + s1[(1 + (1 << 2))] * s2[1] +
                  s1[(1 + (2 << 2))] * s2[2] + s1[(1 + (3 << 2))] * s2[3];
  const float z = s1[(2 + (0 << 2))] * s2[0] + s1[(2 + (1 << 2))] * s2[1] +
                  s1[(2 + (2 << 2))] * s2[2] + s1[(2 + (3 << 2))] * s2[3];
  const float w = s1[(3 + (0 << 2))] * s2[0] + s1[(3 + (1 << 2))] * s2[1] +
                  s1[(3 + (2 << 2))] * s2[2] + s1[(3 + (3 << 2))] * s2[3];
  result[0] = x;
  result[1] = y;
  result[2] = z;
  result[3] = w;
}


x86 assembly (clang, -O0):
<mulmp4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0x30(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x24(%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0x34(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x18(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x28(%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0x38(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x1c(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x2c(%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0x3c(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulmp4>:
movss  (%rdx),%xmm0
movss  0x4(%rdx),%xmm1
movss  0x8(%rdx),%xmm2
movss  0xc(%rdx),%xmm3
shufps $0x0,%xmm1,%xmm1
movups (%rsi),%xmm4
movups 0x10(%rsi),%xmm5
mulps  %xmm1,%xmm5
movups 0x20(%rsi),%xmm1
movups 0x30(%rsi),%xmm6
shufps $0x0,%xmm0,%xmm0
mulps  %xmm4,%xmm0
addps  %xmm5,%xmm0
shufps $0x0,%xmm2,%xmm2
mulps  %xmm1,%xmm2
addps  %xmm0,%xmm2
shufps $0x0,%xmm3,%xmm3
mulps  %xmm6,%xmm3
addps  %xmm2,%xmm3
movups %xmm3,(%rdi)
ret

LLVM IR (-O0):
define void @mulmp4(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%11 = load float*, float** %5
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = load float*, float** %6
%15 = getelementptr inbounds float, float* %14, i64 0
%16 = load float, float* %15
%17 = load float*, float** %5
%18 = getelementptr inbounds float, float* %17, i64 4
%19 = load float, float* %18
%20 = load float*, float** %6
%21 = getelementptr inbounds float, float* %20, i64 1
%22 = load float, float* %21
%23 = fmul float %19, %22
%24 = call float @llvm.fmuladd.f32(float %13, float %16, float %23)
%25 = load float*, float** %5
%26 = getelementptr inbounds float, float* %25, i64 8
%27 = load float, float* %26
%28 = load float*, float** %6
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = call float @llvm.fmuladd.f32(float %27, float %30, float %24)
%32 = load float*, float** %5
%33 = getelementptr inbounds float, float* %32, i64 12
%34 = load float, float* %33
%35 = load float*, float** %6
%36 = getelementptr inbounds float, float* %35, i64 3
%37 = load float, float* %36
%38 = call float @llvm.fmuladd.f32(float %34, float %37, float %31)
store float %38, float* %7
%39 = load float*, float** %5
%40 = getelementptr inbounds float, float* %39, i64 1
%41 = load float, float* %40
%42 = load float*, float** %6
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = load float, float* %43
%45 = load float*, float** %5
%46 = getelementptr inbounds float, float* %45, i64 5
%47 = load float, float* %46
%48 = load float*, float** %6
%49 = getelementptr inbounds float, float* %48, i64 1
%50 = load float, float* %49
%51 = fmul float %47, %50
%52 = call float @llvm.fmuladd.f32(float %41, float %44, float %51)
%53 = load float*, float** %5
%54 = getelementptr inbounds float, float* %53, i64 9
%55 = load float, float* %54
%56 = load float*, float** %6
%57 = getelementptr inbounds float, float* %56, i64 2
%58 = load float, float* %57
%59 = call float @llvm.fmuladd.f32(float %55, float %58, float %52)
%60 = load float*, float** %5
%61 = getelementptr inbounds float, float* %60, i64 13
%62 = load float, float* %61
%63 = load float*, float** %6
%64 = getelementptr inbounds float, float* %63, i64 3
%65 = load float, float* %64
%66 = call float @llvm.fmuladd.f32(float %62, float %65, float %59)
store float %66, float* %8
%67 = load float*, float** %5
%68 = getelementptr inbounds float, float* %67, i64 2
%69 = load float, float* %68
%70 = load float*, float** %6
%71 = getelementptr inbounds float, float* %70, i64 0
%72 = load float, float* %71
%73 = load float*, float** %5
%74 = getelementptr inbounds float, float* %73, i64 6
%75 = load float, float* %74
%76 = load float*, float** %6
%77 = getelementptr inbounds float, float* %76, i64 1
%78 = load float, float* %77
%79 = fmul float %75, %78
%80 = call float @llvm.fmuladd.f32(float %69, float %72, float %79)
%81 = load float*, float** %5
%82 = getelementptr inbounds float, float* %81, i64 10
%83 = load float, float* %82
%84 = load float*, float** %6
%85 = getelementptr inbounds float, float* %84, i64 2
%86 = load float, float* %85
%87 = call float @llvm.fmuladd.f32(float %83, float %86, float %80)
%88 = load float*, float** %5
%89 = getelementptr inbounds float, float* %88, i64 14
%90 = load float, float* %89
%91 = load float*, float** %6
%92 = getelementptr inbounds float, float* %91, i64 3
%93 = load float, float* %92
%94 = call float @llvm.fmuladd.f32(float %90, float %93, float %87)
store float %94, float* %9
%95 = load float*, float** %5
%96 = getelementptr inbounds float, float* %95, i64 3
%97 = load float, float* %96
%98 = load float*, float** %6
%99 = getelementptr inbounds float, float* %98, i64 0
%100 = load float, float* %99
%101 = load float*, float** %5
%102 = getelementptr inbounds float, float* %101, i64 7
%103 = load float, float* %102
%104 = load float*, float** %6
%105 = getelementptr inbounds float, float* %104, i64 1
%106 = load float, float* %105
%107 = fmul float %103, %106
%108 = call float @llvm.fmuladd.f32(float %97, float %100, float %107)
%109 = load float*, float** %5
%110 = getelementptr inbounds float, float* %109, i64 11
%111 = load float, float* %110
%112 = load float*, float** %6
%113 = getelementptr inbounds float, float* %112, i64 2
%114 = load float, float* %113
%115 = call float @llvm.fmuladd.f32(float %111, float %114, float %108)
%116 = load float*, float** %5
%117 = getelementptr inbounds float, float* %116, i64 15
%118 = load float, float* %117
%119 = load float*, float** %6
%120 = getelementptr inbounds float, float* %119, i64 3
%121 = load float, float* %120
%122 = call float @llvm.fmuladd.f32(float %118, float %121, float %115)
store float %122, float* %10
%123 = load float, float* %7
%124 = load float*, float** %4
%125 = getelementptr inbounds float, float* %124, i64 0
store float %123, float* %125
%126 = load float, float* %8
%127 = load float*, float** %4
%128 = getelementptr inbounds float, float* %127, i64 1
store float %126, float* %128
%129 = load float, float* %9
%130 = load float*, float** %4
%131 = getelementptr inbounds float, float* %130, i64 2
store float %129, float* %131
%132 = load float, float* %10
%133 = load float*, float** %4
%134 = getelementptr inbounds float, float* %133, i64 3
store float %132, float* %134
ret void
}

LLVM IR (-O2):
define void @mulmp4(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %2
%5 = getelementptr inbounds float, float* %1, i64 4
%6 = getelementptr inbounds float, float* %2, i64 1
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %1, i64 8
%9 = getelementptr inbounds float, float* %2, i64 2
%10 = load float, float* %9
%11 = getelementptr inbounds float, float* %1, i64 12
%12 = getelementptr inbounds float, float* %2, i64 3
%13 = load float, float* %12
%14 = bitcast float* %1 to <4 x float>*
%15 = load <4 x float>, <4 x float>* %14
%16 = bitcast float* %5 to <4 x float>*
%17 = load <4 x float>, <4 x float>* %16
%18 = insertelement <4 x float> poison, float %7, i64 0
%19 = shufflevector <4 x float> %18, <4 x float> poison, <4 x i32> zeroinitializer
%20 = fmul <4 x float> %19, %17
%21 = insertelement <4 x float> poison, float %4, i64 0
%22 = shufflevector <4 x float> %21, <4 x float> poison, <4 x i32> zeroinitializer
%23 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %15, <4 x float> %22, <4 x float> %20)
%24 = bitcast float* %8 to <4 x float>*
%25 = load <4 x float>, <4 x float>* %24
%26 = insertelement <4 x float> poison, float %10, i64 0
%27 = shufflevector <4 x float> %26, <4 x float> poison, <4 x i32> zeroinitializer
%28 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %25, <4 x float> %27, <4 x float> %23)
%29 = bitcast float* %11 to <4 x float>*
%30 = load <4 x float>, <4 x float>* %29
%31 = insertelement <4 x float> poison, float %13, i64 0
%32 = shufflevector <4 x float> %31, <4 x float> poison, <4 x i32> zeroinitializer
%33 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %30, <4 x float> %32, <4 x float> %28)
%34 = bitcast float* %0 to <4 x float>*
store <4 x float> %33, <4 x float>* %34
ret void
}