#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_di3(double m[3][3], double a[3][3], int 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_di3>:
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    11f7 <mat_multiply_matrix_di3+0xe7>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11e4 <mat_multiply_matrix_di3+0xd4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cvtsi2sdl 0xc(%rax,%rcx,4),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cvtsi2sdl 0x18(%rax,%rcx,4),%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_di3+0x2c>
jmp    11e9 <mat_multiply_matrix_di3+0xd9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <mat_multiply_matrix_di3+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_di3>:
sub    $0x48,%rsp
cvtdq2pd (%rdx),%xmm11
cvtdq2pd 0xc(%rdx),%xmm12
movsd  (%rsi),%xmm2
movsd  0x8(%rsi),%xmm5
movsd  0x10(%rsi),%xmm6
movapd %xmm5,%xmm3
unpcklpd %xmm5,%xmm3
mulpd  %xmm12,%xmm3
movapd %xmm2,%xmm4
unpcklpd %xmm2,%xmm4
mulpd  %xmm11,%xmm4
addpd  %xmm3,%xmm4
cvtdq2pd 0x18(%rdx),%xmm3
movapd %xmm6,%xmm7
unpcklpd %xmm6,%xmm7
mulpd  %xmm3,%xmm7
addpd  %xmm4,%xmm7
movapd %xmm7,(%rsp)
cvtsi2sdl 0x8(%rdx),%xmm9
cvtsi2sdl 0x14(%rdx),%xmm10
cvtsi2sdl 0x20(%rdx),%xmm8
movsd  0x18(%rsi),%xmm4
movsd  0x20(%rsi),%xmm0
movsd  0x28(%rsi),%xmm7
unpcklpd %xmm0,%xmm5
movapd %xmm10,%xmm1
unpcklpd %xmm12,%xmm1
mulpd  %xmm5,%xmm1
unpcklpd %xmm4,%xmm2
movapd %xmm9,%xmm5
unpcklpd %xmm11,%xmm5
mulpd  %xmm2,%xmm5
addpd  %xmm1,%xmm5
unpcklpd %xmm7,%xmm6
movapd %xmm8,%xmm1
unpcklpd %xmm3,%xmm1
mulpd  %xmm6,%xmm1
addpd  %xmm5,%xmm1
movapd %xmm1,0x10(%rsp)
unpcklpd %xmm0,%xmm0
movapd %xmm12,%xmm1
shufpd $0x1,%xmm10,%xmm1
mulpd  %xmm0,%xmm1
unpcklpd %xmm4,%xmm4
movapd %xmm11,%xmm0
shufpd $0x1,%xmm9,%xmm0
mulpd  %xmm4,%xmm0
addpd  %xmm1,%xmm0
unpcklpd %xmm7,%xmm7
movapd %xmm3,%xmm1
shufpd $0x1,%xmm8,%xmm1
mulpd  %xmm7,%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x30(%rsi),%xmm0
movsd  0x38(%rsi),%xmm1
movsd  0x40(%rsi),%xmm2
movapd %xmm1,%xmm4
unpcklpd %xmm1,%xmm4
mulpd  %xmm12,%xmm4
movapd %xmm0,%xmm5
unpcklpd %xmm0,%xmm5
mulpd  %xmm11,%xmm5
addpd  %xmm4,%xmm5
movapd %xmm2,%xmm4
unpcklpd %xmm2,%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm5,%xmm4
movapd %xmm4,0x30(%rsp)
mulsd  %xmm10,%xmm1
mulsd  %xmm9,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm8,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x40(%rsp)
mov    %rsp,%rsi
call   1030 <mat_copy_matrix_d3@plt>
add    $0x48,%rsp
ret

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