#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ ltr_int_transpose(double **, double **);
void ltr_int_mul_matrix(double m1[3][3], double m2[3][3], double res[3][3]) {
  int i, j;
  double m2t[3][3];
  ltr_int_transpose(m2, m2t);
  for (i = 0; i < 3; ++i) {
    for (j = 0; j < 3; ++j) {
      res[i][j] =
          m1[i][0] * m2[0][j] + m1[i][1] * m2[1][j] + m1[i][2] * m2[2][j];
    }
  }
}


x86 assembly (clang, -O0):
<ltr_int_mul_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <ltr_int_transpose@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1200 <ltr_int_mul_matrix+0xf0>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11ed <ltr_int_mul_matrix+0xdd>
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    1149 <ltr_int_mul_matrix+0x39>
jmp    11f2 <ltr_int_mul_matrix+0xe2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <ltr_int_mul_matrix+0x28>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltr_int_mul_matrix>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <ltr_int_transpose@plt>
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
mulsd  0x18(%rbx),%xmm1
mulsd  (%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%r15),%xmm1
mulsd  0x30(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
mulsd  0x20(%rbx),%xmm1
mulsd  0x8(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%r15),%xmm1
mulsd  0x38(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
mulsd  0x28(%rbx),%xmm1
mulsd  0x10(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%r15),%xmm1
mulsd  0x40(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r14)
movsd  0x18(%r15),%xmm0
movsd  0x20(%r15),%xmm1
mulsd  0x18(%rbx),%xmm1
mulsd  (%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%r15),%xmm1
mulsd  0x30(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%r14)
movsd  0x18(%r15),%xmm0
movsd  0x20(%r15),%xmm1
mulsd  0x20(%rbx),%xmm1
mulsd  0x8(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%r15),%xmm1
mulsd  0x38(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%r14)
movsd  0x18(%r15),%xmm0
movsd  0x20(%r15),%xmm1
mulsd  0x28(%rbx),%xmm1
mulsd  0x10(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%r15),%xmm1
mulsd  0x40(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%r14)
movsd  0x30(%r15),%xmm0
movsd  0x38(%r15),%xmm1
mulsd  0x18(%rbx),%xmm1
mulsd  (%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%r15),%xmm1
mulsd  0x30(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%r14)
movsd  0x30(%r15),%xmm0
movsd  0x38(%r15),%xmm1
mulsd  0x20(%rbx),%xmm1
mulsd  0x8(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%r15),%xmm1
mulsd  0x38(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%r14)
movsd  0x30(%r15),%xmm0
movsd  0x38(%r15),%xmm1
mulsd  0x28(%rbx),%xmm1
mulsd  0x10(%rbx),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%r15),%xmm1
mulsd  0x40(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%r14)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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