#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 */
typedef int /*<<< orphan*/ LocalResult;

/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, double **, int);
void MatMul333(const double Mat33a[3][3], const double Mat33b[3][3],
               double *Result) {
  double LocalResult[3][3];
  int iRowIndex, iColIndex;
  for (iRowIndex = 0; iRowIndex < 3; iRowIndex++) {
    for (iColIndex = 0; iColIndex < 3; iColIndex++) {
      LocalResult[iRowIndex][iColIndex] =
          Mat33a[iRowIndex][0] * Mat33b[0][iColIndex] +
          Mat33a[iRowIndex][1] * Mat33b[1][iColIndex] +
          Mat33a[iRowIndex][2] * Mat33b[2][iColIndex];
    }
  }
  memcpy(Result, LocalResult, sizeof(LocalResult));
}


x86 assembly (clang, -O0):
<MatMul333>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    11f3 <MatMul333+0xe3>
movl   $0x0,-0x68(%rbp)
cmpl   $0x3,-0x68(%rbp)
jge    11e0 <MatMul333+0xd0>
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
mulsd  0x18(%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  0x30(%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    113c <MatMul333+0x2c>
jmp    11e5 <MatMul333+0xd5>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    112b <MatMul333+0x1b>
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x48,%edx
call   1030 <memcpy@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatMul333>:
sub    $0x48,%rsp
movsd  (%rdi),%xmm2
movsd  0x8(%rdi),%xmm5
movsd  0x10(%rdi),%xmm6
movapd %xmm5,%xmm4
unpcklpd %xmm5,%xmm4
movupd (%rsi),%xmm12
movupd 0x18(%rsi),%xmm3
movupd 0x30(%rsi),%xmm11
mulpd  %xmm3,%xmm4
movapd %xmm2,%xmm7
unpcklpd %xmm2,%xmm7
mulpd  %xmm12,%xmm7
addpd  %xmm4,%xmm7
movapd %xmm6,%xmm4
unpcklpd %xmm6,%xmm4
mulpd  %xmm11,%xmm4
addpd  %xmm7,%xmm4
movapd %xmm4,(%rsp)
movsd  0x10(%rsi),%xmm9
movsd  0x28(%rsi),%xmm10
movsd  0x40(%rsi),%xmm8
movsd  0x18(%rdi),%xmm4
movsd  0x20(%rdi),%xmm0
movsd  0x28(%rdi),%xmm7
unpcklpd %xmm0,%xmm5
movapd %xmm10,%xmm1
unpcklpd %xmm3,%xmm1
mulpd  %xmm5,%xmm1
unpcklpd %xmm4,%xmm2
movapd %xmm9,%xmm5
unpcklpd %xmm12,%xmm5
mulpd  %xmm2,%xmm5
addpd  %xmm1,%xmm5
unpcklpd %xmm7,%xmm6
movapd %xmm8,%xmm1
unpcklpd %xmm11,%xmm1
mulpd  %xmm6,%xmm1
addpd  %xmm5,%xmm1
movapd %xmm1,0x10(%rsp)
unpcklpd %xmm0,%xmm0
movapd %xmm3,%xmm1
shufpd $0x1,%xmm10,%xmm1
mulpd  %xmm0,%xmm1
unpcklpd %xmm4,%xmm4
movapd %xmm12,%xmm0
shufpd $0x1,%xmm9,%xmm0
mulpd  %xmm4,%xmm0
addpd  %xmm1,%xmm0
unpcklpd %xmm7,%xmm7
movapd %xmm11,%xmm1
shufpd $0x1,%xmm8,%xmm1
mulpd  %xmm7,%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x30(%rdi),%xmm0
movsd  0x38(%rdi),%xmm1
movsd  0x40(%rdi),%xmm2
movapd %xmm1,%xmm4
unpcklpd %xmm1,%xmm4
mulpd  %xmm3,%xmm4
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm12,%xmm3
addpd  %xmm4,%xmm3
movapd %xmm2,%xmm4
unpcklpd %xmm2,%xmm4
mulpd  %xmm11,%xmm4
addpd  %xmm3,%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
mov    %rdx,%rdi
mov    $0x48,%edx
call   1030 <memcpy@plt>
add    $0x48,%rsp
ret

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

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