void matrix_vector_multiply_3x3_3d(const double m[9], const double v[3],
                                   double result[3]) {
  result[0] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2];
  result[1] = m[3] * v[0] + m[4] * v[1] + m[5] * v[2];
  result[2] = m[6] * v[0] + m[7] * v[1] + m[8] * v[2];
}


x86 assembly (clang, -O0):
<matrix_vector_multiply_3x3_3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_vector_multiply_3x3_3d>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rdi),%xmm1
mulsd  0x10(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx)
movsd  0x18(%rdi),%xmm0
movsd  0x20(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%rdi),%xmm1
mulsd  0x10(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rdx)
movsd  0x30(%rdi),%xmm0
movsd  0x38(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%rdi),%xmm1
mulsd  0x10(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rdx)
ret

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

LLVM IR (-O2):
define void @matrix_vector_multiply_3x3_3d(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fmul double %7, %9
%11 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %10)
%12 = getelementptr inbounds double, double* %0, i64 2
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %1, i64 2
%15 = load double, double* %14
%16 = tail call double @llvm.fmuladd.f64(double %13, double %15, double %11)
store double %16, double* %2
%17 = getelementptr inbounds double, double* %0, i64 3
%18 = load double, double* %17
%19 = load double, double* %1
%20 = getelementptr inbounds double, double* %0, i64 4
%21 = load double, double* %20
%22 = load double, double* %8
%23 = fmul double %21, %22
%24 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %23)
%25 = getelementptr inbounds double, double* %0, i64 5
%26 = load double, double* %25
%27 = load double, double* %14
%28 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %24)
%29 = getelementptr inbounds double, double* %2, i64 1
store double %28, double* %29
%30 = getelementptr inbounds double, double* %0, i64 6
%31 = load double, double* %30
%32 = load double, double* %1
%33 = getelementptr inbounds double, double* %0, i64 7
%34 = load double, double* %33
%35 = load double, double* %8
%36 = fmul double %34, %35
%37 = tail call double @llvm.fmuladd.f64(double %31, double %32, double %36)
%38 = getelementptr inbounds double, double* %0, i64 8
%39 = load double, double* %38
%40 = load double, double* %14
%41 = tail call double @llvm.fmuladd.f64(double %39, double %40, double %37)
%42 = getelementptr inbounds double, double* %2, i64 2
store double %41, double* %42
ret void
}