void Matrix_Multiply(double a[3][3], double b[3][3], double out[3][3]) {
  for (int x = 0; x < 3; x++) {
    for (int y = 0; y < 3; y++) {
      out[x][y] = a[x][0] * b[0][y] + a[x][1] * b[1][y] + a[x][2] * b[2][y];
    }
  }
}


x86 assembly (clang, -O0):
<Matrix_Multiply>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11df <Matrix_Multiply+0xdf>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11cc <Matrix_Multiply+0xcc>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulsd  0x18(%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0x30(%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1128 <Matrix_Multiply+0x28>
jmp    11d1 <Matrix_Multiply+0xd1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <Matrix_Multiply+0x17>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Matrix_Multiply([3 x double]* nocapture %0, [3 x double]* nocapture %1, [3 x double]* nocapture writeonly %2) {
%4 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%5 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%7 = load double, double* %4
%8 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%9 = load double, double* %8
%10 = load double, double* %5
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
%12 = load double, double* %11
%13 = fmul double %10, %12
%14 = tail call double @llvm.fmuladd.f64(double %7, double %9, double %13)
%15 = load double, double* %6
%16 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double %14)
%19 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
store double %18, double* %19
%20 = load double, double* %4
%21 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%22 = load double, double* %21
%23 = load double, double* %5
%24 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%25 = load double, double* %24
%26 = fmul double %23, %25
%27 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %26)
%28 = load double, double* %6
%29 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
%30 = load double, double* %29
%31 = tail call double @llvm.fmuladd.f64(double %28, double %30, double %27)
%32 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
store double %31, double* %32
%33 = load double, double* %4
%34 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%35 = load double, double* %34
%36 = load double, double* %5
%37 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%38 = load double, double* %37
%39 = fmul double %36, %38
%40 = tail call double @llvm.fmuladd.f64(double %33, double %35, double %39)
%41 = load double, double* %6
%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 %41, double %43, double %40)
%45 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 2
store double %44, double* %45
%46 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%47 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%48 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%49 = load double, double* %46
%50 = load double, double* %8
%51 = load double, double* %47
%52 = load double, double* %11
%53 = fmul double %51, %52
%54 = tail call double @llvm.fmuladd.f64(double %49, double %50, double %53)
%55 = load double, double* %48
%56 = load double, double* %16
%57 = tail call double @llvm.fmuladd.f64(double %55, double %56, double %54)
%58 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 0
store double %57, double* %58
%59 = load double, double* %46
%60 = load double, double* %21
%61 = load double, double* %47
%62 = load double, double* %24
%63 = fmul double %61, %62
%64 = tail call double @llvm.fmuladd.f64(double %59, double %60, double %63)
%65 = load double, double* %48
%66 = load double, double* %29
%67 = tail call double @llvm.fmuladd.f64(double %65, double %66, double %64)
%68 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 1
store double %67, double* %68
%69 = load double, double* %46
%70 = load double, double* %34
%71 = load double, double* %47
%72 = load double, double* %37
%73 = fmul double %71, %72
%74 = tail call double @llvm.fmuladd.f64(double %69, double %70, double %73)
%75 = load double, double* %48
%76 = load double, double* %42
%77 = tail call double @llvm.fmuladd.f64(double %75, double %76, double %74)
%78 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 2
store double %77, double* %78
%79 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%80 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%81 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%82 = load double, double* %79
%83 = load double, double* %8
%84 = load double, double* %80
%85 = load double, double* %11
%86 = fmul double %84, %85
%87 = tail call double @llvm.fmuladd.f64(double %82, double %83, double %86)
%88 = load double, double* %81
%89 = load double, double* %16
%90 = tail call double @llvm.fmuladd.f64(double %88, double %89, double %87)
%91 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 0
store double %90, double* %91
%92 = load double, double* %79
%93 = load double, double* %21
%94 = load double, double* %80
%95 = load double, double* %24
%96 = fmul double %94, %95
%97 = tail call double @llvm.fmuladd.f64(double %92, double %93, double %96)
%98 = load double, double* %81
%99 = load double, double* %29
%100 = tail call double @llvm.fmuladd.f64(double %98, double %99, double %97)
%101 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 1
store double %100, double* %101
%102 = load double, double* %79
%103 = load double, double* %34
%104 = load double, double* %80
%105 = load double, double* %37
%106 = fmul double %104, %105
%107 = tail call double @llvm.fmuladd.f64(double %102, double %103, double %106)
%108 = load double, double* %81
%109 = load double, double* %42
%110 = tail call double @llvm.fmuladd.f64(double %108, double %109, double %107)
%111 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 2
store double %110, double* %111
ret void
}