void applyMatrix(double *V, double *M) {
  double V0 = V[0], V1 = V[1], V2 = V[2];
  V[0] = M[0] * V0 + M[1] * V1 + M[2] * V2;
  V[1] = M[3] * V0 + M[4] * V1 + M[5] * V2;
  V[2] = M[6] * V0 + M[7] * V1 + M[8] * V2;
}


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

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

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

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