void MatrixMulti3Rotate33(double *a, double *b, double *r) {
  int i, j;
  int m = 3, n = 3;
  for (j = 0; j < n; j++) {
    r[j] = 0.0;
    for (i = 0; i < m; i++)
      r[j] += a[i] * b[(i * m) + j];
  }
}


x86 assembly (clang, -O0):
<MatrixMulti3Rotate33>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x3,-0x24(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11b2 <MatrixMulti3Rotate33+0xb2>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    119f <MatrixMulti3Rotate33+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <MatrixMulti3Rotate33+0x48>
jmp    11a4 <MatrixMulti3Rotate33+0xa4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1125 <MatrixMulti3Rotate33+0x25>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @MatrixMulti3Rotate33(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 3, i32* %9
store i32 3, i32* %10
store i32 0, i32* %8
br label %11
11: ; preds = %49, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %10
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %52
15: ; preds = %11
%16 = load double*, double** %6
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
store double 0.000000e+00, double* %19
store i32 0, i32* %7
br label %20
20: ; preds = %45, %15
%21 = load i32, i32* %7
%22 = load i32, i32* %9
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %48
24: ; preds = %20
%25 = load double*, double** %4
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
%29 = load double, double* %28
%30 = load double*, double** %5
%31 = load i32, i32* %7
%32 = load i32, i32* %9
%33 = mul nsw i32 %31, %32
%34 = load i32, i32* %8
%35 = add nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %30, i64 %36
%38 = load double, double* %37
%39 = load double*, double** %6
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = call double @llvm.fmuladd.f64(double %29, double %38, double %43)
store double %44, double* %42
br label %45
45: ; preds = %24
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %20
48: ; preds = %20
br label %49
49: ; preds = %48
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %11
52: ; preds = %11
ret void
}

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