void icmMulBy3x3(double out[3], double mat[3][3], double in[3]) {
  double tt[3];
  tt[0] = mat[0][0] * in[0] + mat[0][1] * in[1] + mat[0][2] * in[2];
  tt[1] = mat[1][0] * in[0] + mat[1][1] * in[1] + mat[1][2] * in[2];
  tt[2] = mat[2][0] * in[0] + mat[2][1] * in[1] + mat[2][2] * in[2];
  out[0] = tt[0];
  out[1] = tt[1];
  out[2] = tt[2];
}


x86 assembly (clang, -O0):
<icmMulBy3x3>:
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,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%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  0x28(%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  0x30(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x38(%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)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @icmMulBy3x3(double* %0, [3 x double]* %1, double* %2) {
%4 = alloca double*
%5 = alloca [3 x double]*
%6 = alloca double*
%7 = alloca [3 x double]
store double* %0, double** %4
store [3 x double]* %1, [3 x double]** %5
store double* %2, double** %6
%8 = load [3 x double]*, [3 x double]** %5
%9 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%11 = load double, double* %10
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load [3 x double]*, [3 x double]** %5
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, 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 %11, double %14, double %22)
%24 = load [3 x double]*, [3 x double]** %5
%25 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, 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 %23)
%32 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
store double %31, double* %32
%33 = load [3 x double]*, [3 x double]** %5
%34 = getelementptr inbounds [3 x double], [3 x double]* %33, i64 1
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 0, i64 0
%36 = load double, double* %35
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 0
%39 = load double, double* %38
%40 = load [3 x double]*, [3 x double]** %5
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 1
%42 = getelementptr inbounds [3 x double], [3 x double]* %41, i64 0, i64 1
%43 = load double, double* %42
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 1
%46 = load double, double* %45
%47 = fmul double %43, %46
%48 = call double @llvm.fmuladd.f64(double %36, double %39, double %47)
%49 = load [3 x double]*, [3 x double]** %5
%50 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 1
%51 = getelementptr inbounds [3 x double], [3 x double]* %50, i64 0, i64 2
%52 = load double, double* %51
%53 = load double*, double** %6
%54 = getelementptr inbounds double, double* %53, i64 2
%55 = load double, double* %54
%56 = call double @llvm.fmuladd.f64(double %52, double %55, double %48)
%57 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
store double %56, double* %57
%58 = load [3 x double]*, [3 x double]** %5
%59 = getelementptr inbounds [3 x double], [3 x double]* %58, i64 2
%60 = getelementptr inbounds [3 x double], [3 x double]* %59, i64 0, i64 0
%61 = load double, double* %60
%62 = load double*, double** %6
%63 = getelementptr inbounds double, double* %62, i64 0
%64 = load double, double* %63
%65 = load [3 x double]*, [3 x double]** %5
%66 = getelementptr inbounds [3 x double], [3 x double]* %65, i64 2
%67 = getelementptr inbounds [3 x double], [3 x double]* %66, i64 0, i64 1
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 1
%71 = load double, double* %70
%72 = fmul double %68, %71
%73 = call double @llvm.fmuladd.f64(double %61, double %64, double %72)
%74 = load [3 x double]*, [3 x double]** %5
%75 = getelementptr inbounds [3 x double], [3 x double]* %74, i64 2
%76 = getelementptr inbounds [3 x double], [3 x double]* %75, i64 0, i64 2
%77 = load double, double* %76
%78 = load double*, double** %6
%79 = getelementptr inbounds double, double* %78, i64 2
%80 = load double, double* %79
%81 = call double @llvm.fmuladd.f64(double %77, double %80, double %73)
%82 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
store double %81, double* %82
%83 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%84 = load double, double* %83
%85 = load double*, double** %4
%86 = getelementptr inbounds double, double* %85, i64 0
store double %84, double* %86
%87 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%88 = load double, double* %87
%89 = load double*, double** %4
%90 = getelementptr inbounds double, double* %89, i64 1
store double %88, double* %90
%91 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%92 = load double, double* %91
%93 = load double*, double** %4
%94 = getelementptr inbounds double, double* %93, i64 2
store double %92, double* %94
ret void
}

LLVM IR (-O2):
define void @icmMulBy3x3(double* nocapture writeonly %0, [3 x double]* nocapture %1, double* nocapture %2) {
%4 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%5 = load double, double* %4
%6 = load double, double* %2
%7 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %2, i64 1
%10 = load double, double* %9
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %2, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
%16 = load double, double* %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%18 = load double, double* %17
%19 = insertelement <2 x double> poison, double %10, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %8, i64 0
%22 = insertelement <2 x double> %21, double %18, i64 1
%23 = fmul <2 x double> %20, %22
%24 = insertelement <2 x double> poison, double %5, i64 0
%25 = insertelement <2 x double> %24, double %16, i64 1
%26 = insertelement <2 x double> poison, double %6, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %27, <2 x double> %23)
%29 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%30 = load double, double* %29
%31 = insertelement <2 x double> poison, double %12, i64 0
%32 = insertelement <2 x double> %31, double %30, i64 1
%33 = insertelement <2 x double> poison, double %14, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %34, <2 x double> %28)
%36 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%37 = load double, double* %36
%38 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
%39 = load double, double* %38
%40 = fmul double %10, %39
%41 = tail call double @llvm.fmuladd.f64(double %37, double %6, double %40)
%42 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
%43 = load double, double* %42
%44 = tail call double @llvm.fmuladd.f64(double %43, double %14, double %41)
%45 = bitcast double* %0 to <2 x double>*
store <2 x double> %35, <2 x double>* %45
%46 = getelementptr inbounds double, double* %0, i64 2
store double %44, double* %46
ret void
}