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


x86 assembly (clang, -O0):
<mulpm4>:
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  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%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  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x28(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x48(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x50(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x58(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x60(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x68(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x70(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x78(%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):
<mulpm4>:
movsd  (%rsi),%xmm3
movsd  0x8(%rsi),%xmm4
movsd  0x10(%rsi),%xmm2
movsd  0x18(%rsi),%xmm0
unpcklpd %xmm4,%xmm4
movsd  (%rdx),%xmm5
movsd  0x8(%rdx),%xmm6
movsd  0x10(%rdx),%xmm7
movsd  0x18(%rdx),%xmm1
movhpd 0x28(%rdx),%xmm6
mulpd  %xmm4,%xmm6
unpcklpd %xmm3,%xmm3
movhpd 0x20(%rdx),%xmm5
mulpd  %xmm3,%xmm5
addpd  %xmm6,%xmm5
unpcklpd %xmm2,%xmm2
movhpd 0x30(%rdx),%xmm7
mulpd  %xmm2,%xmm7
addpd  %xmm5,%xmm7
movhpd 0x38(%rdx),%xmm1
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm1
addpd  %xmm7,%xmm1
movsd  0x48(%rdx),%xmm5
movhpd 0x68(%rdx),%xmm5
mulpd  %xmm4,%xmm5
movsd  0x40(%rdx),%xmm4
movhpd 0x60(%rdx),%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm5,%xmm4
movsd  0x50(%rdx),%xmm3
movhpd 0x70(%rdx),%xmm3
mulpd  %xmm2,%xmm3
addpd  %xmm4,%xmm3
movsd  0x58(%rdx),%xmm2
movhpd 0x78(%rdx),%xmm2
mulpd  %xmm0,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm1,(%rdi)
movupd %xmm2,0x10(%rdi)
ret

LLVM IR (-O0):
define void @mulpm4(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 1
%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 2
%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 3
%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 0
%41 = load double, double* %40
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 4
%44 = load double, double* %43
%45 = load double*, double** %5
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
%48 = load double*, double** %6
%49 = getelementptr inbounds double, double* %48, i64 5
%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 2
%55 = load double, double* %54
%56 = load double*, double** %6
%57 = getelementptr inbounds double, double* %56, i64 6
%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 3
%62 = load double, double* %61
%63 = load double*, double** %6
%64 = getelementptr inbounds double, double* %63, i64 7
%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 0
%69 = load double, double* %68
%70 = load double*, double** %6
%71 = getelementptr inbounds double, double* %70, i64 8
%72 = load double, double* %71
%73 = load double*, double** %5
%74 = getelementptr inbounds double, double* %73, i64 1
%75 = load double, double* %74
%76 = load double*, double** %6
%77 = getelementptr inbounds double, double* %76, i64 9
%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 2
%83 = load double, double* %82
%84 = load double*, double** %6
%85 = getelementptr inbounds double, double* %84, i64 10
%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 3
%90 = load double, double* %89
%91 = load double*, double** %6
%92 = getelementptr inbounds double, double* %91, i64 11
%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 0
%97 = load double, double* %96
%98 = load double*, double** %6
%99 = getelementptr inbounds double, double* %98, i64 12
%100 = load double, double* %99
%101 = load double*, double** %5
%102 = getelementptr inbounds double, double* %101, i64 1
%103 = load double, double* %102
%104 = load double*, double** %6
%105 = getelementptr inbounds double, double* %104, i64 13
%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 2
%111 = load double, double* %110
%112 = load double*, double** %6
%113 = getelementptr inbounds double, double* %112, i64 14
%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 3
%118 = load double, double* %117
%119 = load double*, double** %6
%120 = getelementptr inbounds double, double* %119, i64 15
%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 @mulpm4(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %2
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %2, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %2, i64 2
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %1, i64 3
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %2, i64 3
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %2, i64 4
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %2, i64 5
%21 = load double, double* %20
%22 = insertelement <2 x double> poison, double %7, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = insertelement <2 x double> poison, double %9, i64 0
%25 = insertelement <2 x double> %24, double %21, i64 1
%26 = fmul <2 x double> %23, %25
%27 = insertelement <2 x double> poison, double %4, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = insertelement <2 x double> poison, double %5, i64 0
%30 = insertelement <2 x double> %29, double %19, i64 1
%31 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %30, <2 x double> %26)
%32 = getelementptr inbounds double, double* %2, i64 6
%33 = load double, double* %32
%34 = insertelement <2 x double> poison, double %11, i64 0
%35 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%36 = insertelement <2 x double> poison, double %13, i64 0
%37 = insertelement <2 x double> %36, double %33, i64 1
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %37, <2 x double> %31)
%39 = getelementptr inbounds double, double* %2, i64 7
%40 = load double, double* %39
%41 = insertelement <2 x double> poison, double %15, i64 0
%42 = shufflevector <2 x double> %41, <2 x double> poison, <2 x i32> zeroinitializer
%43 = insertelement <2 x double> poison, double %17, i64 0
%44 = insertelement <2 x double> %43, double %40, i64 1
%45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %44, <2 x double> %38)
%46 = getelementptr inbounds double, double* %2, i64 8
%47 = load double, double* %46
%48 = getelementptr inbounds double, double* %2, i64 9
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %2, i64 10
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %2, i64 11
%53 = load double, double* %52
%54 = getelementptr inbounds double, double* %2, i64 12
%55 = load double, double* %54
%56 = getelementptr inbounds double, double* %2, i64 13
%57 = load double, double* %56
%58 = insertelement <2 x double> poison, double %49, i64 0
%59 = insertelement <2 x double> %58, double %57, i64 1
%60 = fmul <2 x double> %23, %59
%61 = insertelement <2 x double> poison, double %47, i64 0
%62 = insertelement <2 x double> %61, double %55, i64 1
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %62, <2 x double> %60)
%64 = getelementptr inbounds double, double* %2, i64 14
%65 = load double, double* %64
%66 = insertelement <2 x double> poison, double %51, i64 0
%67 = insertelement <2 x double> %66, double %65, i64 1
%68 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %67, <2 x double> %63)
%69 = getelementptr inbounds double, double* %2, i64 15
%70 = load double, double* %69
%71 = insertelement <2 x double> poison, double %53, i64 0
%72 = insertelement <2 x double> %71, double %70, i64 1
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %72, <2 x double> %68)
%74 = bitcast double* %0 to <2 x double>*
store <2 x double> %45, <2 x double>* %74
%75 = getelementptr inbounds double, double* %0, i64 2
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %73, <2 x double>* %76
ret void
}