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


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

LLVM IR (-O0):
define void @mulvm(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 1
%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 2
%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 0
%33 = load double, double* %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 4
%36 = load double, double* %35
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 1
%39 = load double, double* %38
%40 = load double*, double** %6
%41 = getelementptr inbounds double, double* %40, i64 5
%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 2
%47 = load double, double* %46
%48 = load double*, double** %6
%49 = getelementptr inbounds double, double* %48, i64 6
%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 0
%54 = load double, double* %53
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 8
%57 = load double, double* %56
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = load double*, double** %6
%62 = getelementptr inbounds double, double* %61, i64 9
%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 2
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 10
%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 @mulvm(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* %2, i64 4
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %2, i64 5
%17 = load double, 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 = insertelement <2 x double> poison, double %9, i64 0
%21 = insertelement <2 x double> %20, double %17, i64 1
%22 = fmul <2 x double> %19, %21
%23 = insertelement <2 x double> poison, double %4, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = insertelement <2 x double> poison, double %5, i64 0
%26 = insertelement <2 x double> %25, double %15, i64 1
%27 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %26, <2 x double> %22)
%28 = getelementptr inbounds double, double* %2, i64 6
%29 = load double, double* %28
%30 = insertelement <2 x double> poison, double %11, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = insertelement <2 x double> poison, double %13, i64 0
%33 = insertelement <2 x double> %32, double %29, i64 1
%34 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> %33, <2 x double> %27)
%35 = getelementptr inbounds double, double* %2, i64 8
%36 = load double, double* %35
%37 = getelementptr inbounds double, double* %2, i64 9
%38 = load double, double* %37
%39 = fmul double %7, %38
%40 = tail call double @llvm.fmuladd.f64(double %4, double %36, double %39)
%41 = getelementptr inbounds double, double* %2, i64 10
%42 = load double, double* %41
%43 = tail call double @llvm.fmuladd.f64(double %11, double %42, double %40)
%44 = bitcast double* %0 to <2 x double>*
store <2 x double> %34, <2 x double>* %44
%45 = getelementptr inbounds double, double* %0, i64 2
store double %43, double* %45
ret void
}