void mulmv(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];
  const double y = s1[(1 + (0 << 2))] * s2[0] + s1[(1 + (1 << 2))] * s2[1] +
                   s1[(1 + (2 << 2))] * s2[2];
  const double z = s1[(2 + (0 << 2))] * s2[0] + s1[(2 + (1 << 2))] * s2[1] +
                   s1[(2 + (2 << 2))] * s2[2];
  result[0] = x;
  result[1] = y;
  result[2] = z;
}


x86 assembly (clang, -O0):
<mulmv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulmv>:
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
movsd  0x10(%rdx),%xmm2
movapd %xmm1,%xmm3
unpcklpd %xmm1,%xmm3
movupd (%rsi),%xmm4
movupd 0x20(%rsi),%xmm5
mulpd  %xmm3,%xmm5
movupd 0x40(%rsi),%xmm3
movapd %xmm0,%xmm6
unpcklpd %xmm0,%xmm6
mulpd  %xmm4,%xmm6
addpd  %xmm5,%xmm6
movapd %xmm2,%xmm4
unpcklpd %xmm2,%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm6,%xmm4
mulsd  0x30(%rsi),%xmm1
mulsd  0x10(%rsi),%xmm0
mulsd  0x50(%rsi),%xmm2
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
movupd %xmm4,(%rdi)
movsd  %xmm2,0x10(%rdi)
ret

LLVM IR (-O0):
define void @mulmv(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double*, double** %6
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 4
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fmul double %18, %21
%23 = call double @llvm.fmuladd.f64(double %12, double %15, double %22)
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 8
%26 = load double, double* %25
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %26, double %29, double %23)
store double %30, double* %7
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 0
%36 = load double, double* %35
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 5
%39 = load double, double* %38
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
%43 = fmul double %39, %42
%44 = call double @llvm.fmuladd.f64(double %33, double %36, double %43)
%45 = load double*, double** %5
%46 = getelementptr inbounds double, double* %45, i64 9
%47 = load double, double* %46
%48 = load double*, double** %6
%49 = getelementptr inbounds double, double* %48, i64 2
%50 = load double, double* %49
%51 = call double @llvm.fmuladd.f64(double %47, double %50, double %44)
store double %51, double* %8
%52 = load double*, double** %5
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 0
%57 = load double, double* %56
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 6
%60 = load double, double* %59
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 1
%63 = load double, double* %62
%64 = fmul double %60, %63
%65 = call double @llvm.fmuladd.f64(double %54, double %57, double %64)
%66 = load double*, double** %5
%67 = getelementptr inbounds double, double* %66, i64 10
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 2
%71 = load double, double* %70
%72 = call double @llvm.fmuladd.f64(double %68, double %71, double %65)
store double %72, double* %9
%73 = load double, double* %7
%74 = load double*, double** %4
%75 = getelementptr inbounds double, double* %74, i64 0
store double %73, double* %75
%76 = load double, double* %8
%77 = load double*, double** %4
%78 = getelementptr inbounds double, double* %77, i64 1
store double %76, double* %78
%79 = load double, double* %9
%80 = load double*, double** %4
%81 = getelementptr inbounds double, double* %80, i64 2
store double %79, double* %81
ret void
}

LLVM IR (-O2):
define void @mulmv(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 = bitcast double* %1 to <2 x double>*
%12 = load <2 x double>, <2 x double>* %11
%13 = bitcast double* %5 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = insertelement <2 x double> poison, double %7, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fmul <2 x double> %16, %14
%18 = insertelement <2 x double> poison, double %4, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %19, <2 x double> %17)
%21 = bitcast double* %8 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = insertelement <2 x double> poison, double %10, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> %20)
%26 = getelementptr inbounds double, double* %1, i64 2
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %1, i64 6
%29 = load double, double* %28
%30 = fmul double %7, %29
%31 = tail call double @llvm.fmuladd.f64(double %27, double %4, double %30)
%32 = getelementptr inbounds double, double* %1, i64 10
%33 = load double, double* %32
%34 = tail call double @llvm.fmuladd.f64(double %33, double %10, double %31)
%35 = bitcast double* %0 to <2 x double>*
store <2 x double> %25, <2 x double>* %35
%36 = getelementptr inbounds double, double* %0, i64 2
store double %34, double* %36
ret void
}