#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*/ mat_copy_matrix_d3(double **, double **);
void mat_multiply_matrix_id3(double m[3][3], int a[3][3], double b[3][3]) {
  int i, j;
  double c[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      c[i][j] = a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j];
    }
  }
  mat_copy_matrix_d3(m, c);
}


x86 assembly (clang, -O0):
<mat_multiply_matrix_id3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11f3 <mat_multiply_matrix_id3+0xe3>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11e0 <mat_multiply_matrix_id3+0xd0>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cvtsi2sdl (%rax),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cvtsi2sdl 0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulsd  0x18(%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cvtsi2sdl 0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0x30(%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rcx
lea    -0x70(%rbp),%rax
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    113c <mat_multiply_matrix_id3+0x2c>
jmp    11e5 <mat_multiply_matrix_id3+0xd5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <mat_multiply_matrix_id3+0x1b>
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <mat_copy_matrix_d3@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_multiply_matrix_id3>:
sub    $0x48,%rsp
movss  0x10(%rsi),%xmm0
movss  0x4(%rsi),%xmm1
unpcklps %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm6
movapd %xmm6,%xmm3
unpcklpd %xmm6,%xmm3
movupd (%rdx),%xmm1
movupd 0x18(%rdx),%xmm2
movupd 0x30(%rdx),%xmm10
mulpd  %xmm2,%xmm3
movss  0xc(%rsi),%xmm4
movss  (%rsi),%xmm5
unpcklps %xmm4,%xmm5
cvtdq2pd %xmm5,%xmm7
movapd %xmm7,%xmm4
unpcklpd %xmm7,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm3,%xmm4
movss  0x14(%rsi),%xmm3
movss  0x8(%rsi),%xmm5
unpcklps %xmm3,%xmm5
cvtdq2pd %xmm5,%xmm3
movapd %xmm3,%xmm5
unpcklpd %xmm3,%xmm5
mulpd  %xmm10,%xmm5
addpd  %xmm4,%xmm5
movapd %xmm5,(%rsp)
movsd  0x10(%rdx),%xmm9
movsd  0x28(%rdx),%xmm5
movsd  0x40(%rdx),%xmm8
movapd %xmm5,%xmm4
unpcklpd %xmm2,%xmm4
mulpd  %xmm6,%xmm4
movapd %xmm9,%xmm0
unpcklpd %xmm1,%xmm0
mulpd  %xmm7,%xmm0
addpd  %xmm4,%xmm0
movapd %xmm8,%xmm4
unpcklpd %xmm10,%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm0,%xmm4
movapd %xmm4,0x10(%rsp)
movapd %xmm2,%xmm0
shufpd $0x1,%xmm5,%xmm0
unpckhpd %xmm6,%xmm6
mulpd  %xmm0,%xmm6
unpckhpd %xmm7,%xmm7
movapd %xmm1,%xmm0
shufpd $0x1,%xmm9,%xmm0
mulpd  %xmm7,%xmm0
addpd  %xmm6,%xmm0
unpckhpd %xmm3,%xmm3
movapd %xmm10,%xmm4
shufpd $0x1,%xmm8,%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm0,%xmm4
movapd %xmm4,0x20(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x18(%rsi),%xmm0
xorps  %xmm3,%xmm3
cvtsi2sdl 0x1c(%rsi),%xmm3
xorps  %xmm4,%xmm4
cvtsi2sdl 0x20(%rsi),%xmm4
mulsd  %xmm3,%xmm5
unpcklpd %xmm3,%xmm3
mulpd  %xmm2,%xmm3
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movapd %xmm4,%xmm1
unpcklpd %xmm4,%xmm1
mulpd  %xmm10,%xmm1
addpd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
mulsd  %xmm9,%xmm0
addsd  %xmm5,%xmm0
mulsd  %xmm8,%xmm4
addsd  %xmm0,%xmm4
movsd  %xmm4,0x40(%rsp)
mov    %rsp,%rsi
call   1030 <mat_copy_matrix_d3@plt>
add    $0x48,%rsp
ret

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

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