void mulT(double A[3][3], double B[3][3], double P[3][3]) {
  int i, j, k;
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      P[i][j] = 0.;
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      for (k = 0; k < 3; k++)
        P[i][j] += A[k][i] * B[k][j];
}


x86 assembly (clang, -O0):
<mulT>:
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    116e <mulT+0x6e>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    115b <mulT+0x5b>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1128 <mulT+0x28>
jmp    1160 <mulT+0x60>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <mulT+0x17>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    122a <mulT+0x12a>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    1217 <mulT+0x117>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1204 <mulT+0x104>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1197 <mulT+0x97>
jmp    1209 <mulT+0x109>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1186 <mulT+0x86>
jmp    121c <mulT+0x11c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <mulT+0x75>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulT>:
xorpd  %xmm0,%xmm0
movupd %xmm0,0x30(%rdx)
movupd %xmm0,0x20(%rdx)
movupd %xmm0,0x10(%rdx)
movupd %xmm0,(%rdx)
movq   $0x0,0x40(%rdx)
add    $0x10,%rdx
mov    $0xfffffffffffffffd,%rax
nopw   0x0(%rax,%rax,1)
movsd  0x18(%rdi,%rax,8),%xmm0
mulsd  (%rsi),%xmm0
addsd  -0x10(%rdx),%xmm0
movsd  %xmm0,-0x10(%rdx)
movsd  0x30(%rdi,%rax,8),%xmm1
mulsd  0x18(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x10(%rdx)
movsd  0x48(%rdi,%rax,8),%xmm0
mulsd  0x30(%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rdx)
movsd  0x18(%rdi,%rax,8),%xmm0
mulsd  0x8(%rsi),%xmm0
addsd  -0x8(%rdx),%xmm0
movsd  %xmm0,-0x8(%rdx)
movsd  0x30(%rdi,%rax,8),%xmm1
mulsd  0x20(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x8(%rdx)
movsd  0x48(%rdi,%rax,8),%xmm0
mulsd  0x38(%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rdx)
movsd  0x18(%rdi,%rax,8),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x30(%rdi,%rax,8),%xmm1
mulsd  0x28(%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx)
movsd  0x48(%rdi,%rax,8),%xmm0
mulsd  0x40(%rsi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
add    $0x18,%rdx
inc    %rax
jne    1130 <mulT+0x30>
ret

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

LLVM IR (-O2):
define void @mulT([3 x double]* nocapture %0, [3 x double]* nocapture %1, [3 x double]* nocapture %2) {
%4 = bitcast [3 x double]* %2 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 0
%7 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 0
%8 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%9 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%10 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 1
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
%12 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
%13 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
br label %14
14: ; preds = %3, %14
%15 = phi i64 [ 0, %3 ], [ %52, %14 ]
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 %15
%17 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 %15, i64 0
%18 = load double, double* %16
%19 = load double, double* %5
%20 = load double, double* %17
%21 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %20)
store double %21, double* %17
%22 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 %15
%23 = load double, double* %22
%24 = load double, double* %6
%25 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %21)
store double %25, double* %17
%26 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 %15
%27 = load double, double* %26
%28 = load double, double* %7
%29 = tail call double @llvm.fmuladd.f64(double %27, double %28, double %25)
store double %29, double* %17
%30 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 %15, i64 1
%31 = load double, double* %16
%32 = load double, double* %8
%33 = load double, double* %30
%34 = tail call double @llvm.fmuladd.f64(double %31, double %32, double %33)
store double %34, double* %30
%35 = load double, double* %22
%36 = load double, double* %9
%37 = tail call double @llvm.fmuladd.f64(double %35, double %36, double %34)
store double %37, double* %30
%38 = load double, double* %26
%39 = load double, double* %10
%40 = tail call double @llvm.fmuladd.f64(double %38, double %39, double %37)
store double %40, double* %30
%41 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 %15, i64 2
%42 = load double, double* %16
%43 = load double, double* %11
%44 = load double, double* %41
%45 = tail call double @llvm.fmuladd.f64(double %42, double %43, double %44)
store double %45, double* %41
%46 = load double, double* %22
%47 = load double, double* %12
%48 = tail call double @llvm.fmuladd.f64(double %46, double %47, double %45)
store double %48, double* %41
%49 = load double, double* %26
%50 = load double, double* %13
%51 = tail call double @llvm.fmuladd.f64(double %49, double %50, double %48)
store double %51, double* %41
%52 = add nuw nsw i64 %15, 1
%53 = icmp eq i64 %52, 3
br i1 %53, label %54, label %14
54: ; preds = %14
ret void
}