void mulmp4(double *result, const double *s1, const double *s2) {
  const double 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 double 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 double 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 double 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
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x70(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x58(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x78(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulmp4>:
movsd  (%rdx),%xmm1
movsd  0x8(%rdx),%xmm3
movsd  0x10(%rdx),%xmm2
movsd  0x18(%rdx),%xmm0
unpcklpd %xmm3,%xmm3
movupd (%rsi),%xmm4
movupd 0x10(%rsi),%xmm5
movupd 0x20(%rsi),%xmm6
movupd 0x30(%rsi),%xmm7
mulpd  %xmm3,%xmm6
unpcklpd %xmm1,%xmm1
mulpd  %xmm1,%xmm4
addpd  %xmm6,%xmm4
movupd 0x40(%rsi),%xmm6
unpcklpd %xmm2,%xmm2
mulpd  %xmm2,%xmm6
addpd  %xmm4,%xmm6
movupd 0x60(%rsi),%xmm4
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm3,%xmm7
mulpd  %xmm5,%xmm1
addpd  %xmm7,%xmm1
movupd 0x50(%rsi),%xmm3
mulpd  %xmm2,%xmm3
addpd  %xmm1,%xmm3
movupd 0x70(%rsi),%xmm1
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
movupd %xmm4,(%rdi)
movupd %xmm1,0x10(%rdi)
ret

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

LLVM IR (-O2):
define void @mulmp4(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %2
%5 = getelementptr inbounds double, double* %1, i64 4
%6 = getelementptr inbounds double, double* %2, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 8
%9 = getelementptr inbounds double, double* %2, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 12
%12 = getelementptr inbounds double, double* %2, i64 3
%13 = load double, double* %12
%14 = bitcast double* %1 to <2 x double>*
%15 = load <2 x double>, <2 x double>* %14
%16 = bitcast double* %5 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = insertelement <2 x double> poison, double %7, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fmul <2 x double> %19, %17
%21 = insertelement <2 x double> poison, double %4, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %22, <2 x double> %20)
%24 = bitcast double* %8 to <2 x double>*
%25 = load <2 x double>, <2 x double>* %24
%26 = insertelement <2 x double> poison, double %10, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %27, <2 x double> %23)
%29 = bitcast double* %11 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = insertelement <2 x double> poison, double %13, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %32, <2 x double> %28)
%34 = getelementptr inbounds double, double* %1, i64 2
%35 = getelementptr inbounds double, double* %1, i64 6
%36 = getelementptr inbounds double, double* %1, i64 10
%37 = getelementptr inbounds double, double* %1, i64 14
%38 = bitcast double* %34 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = bitcast double* %35 to <2 x double>*
%41 = load <2 x double>, <2 x double>* %40
%42 = fmul <2 x double> %19, %41
%43 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %22, <2 x double> %42)
%44 = bitcast double* %36 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %45, <2 x double> %27, <2 x double> %43)
%47 = bitcast double* %37 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %32, <2 x double> %46)
%50 = bitcast double* %0 to <2 x double>*
store <2 x double> %33, <2 x double>* %50
%51 = getelementptr inbounds double, double* %0, i64 2
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %49, <2 x double>* %52
ret void
}