#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*/ MatrixMultply(double **, int, int, double **, int,
                                 double **);
int main() {
  double A[2][3] = {
      1, 2, 3, 4, 5, 6,
  };
  double B[3][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  double C[2][4] = {{0}};
  MatrixMultply(A, 2, 3, B, 4, C);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8f(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe65(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
lea    -0x40(%rbp),%rdi
lea    -0xa0(%rbp),%rcx
lea    -0xe0(%rbp),%r9
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%r8d
call   1050 <MatrixMultply@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xd8,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf3f(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xf20(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
lea    0x70(%rsp),%rcx
lea    0x30(%rsp),%r9
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%r8d
call   1030 <MatrixMultply@plt>
xor    %eax,%eax
add    $0xd8,%rsp
ret

LLVM IR (-O0):
@__const.main.B = [3 x [4 x double]] [[4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00], [4 x double] [double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00], [4 x double] [double 9.000000e+00, double 1.000000e+01, double 1.100000e+01, double 1.200000e+01]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [3 x double]]
%3 = alloca [3 x [4 x double]]
%4 = alloca [2 x [4 x double]]
store i32 0, i32* %1
%5 = bitcast [2 x [3 x double]]* %2 to i8*
%6 = bitcast i8* %5 to [2 x [3 x double]]*
%7 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %6, i32 0, i32 0
%8 = getelementptr inbounds [3 x double], [3 x double]* %7, i32 0, i32 0
store double 1.000000e+00, double* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %7, i32 0, i32 1
store double 2.000000e+00, double* %9
%10 = getelementptr inbounds [3 x double], [3 x double]* %7, i32 0, i32 2
store double 3.000000e+00, double* %10
%11 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %6, i32 0, i32 1
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 0
store double 4.000000e+00, double* %12
%13 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 1
store double 5.000000e+00, double* %13
%14 = getelementptr inbounds [3 x double], [3 x double]* %11, i32 0, i32 2
store double 6.000000e+00, double* %14
%15 = bitcast [3 x [4 x double]]* %3 to i8*
%16 = bitcast [2 x [4 x double]]* %4 to i8*
%17 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %2, i64 0, i64 0
%18 = bitcast [3 x double]* %17 to double**
%19 = getelementptr inbounds [3 x [4 x double]], [3 x [4 x double]]* %3, i64 0, i64 0
%20 = bitcast [4 x double]* %19 to double**
%21 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %4, i64 0, i64 0
%22 = bitcast [4 x double]* %21 to double**
%23 = call i32 @MatrixMultply(double** %18, i32 2, i32 3, double** %20, i32 4, double** %22)
ret i32 0
}

LLVM IR (-O2):
@__const.main.B = [3 x [4 x double]] [[4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00], [4 x double] [double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00], [4 x double] [double 9.000000e+00, double 1.000000e+01, double 1.100000e+01, double 1.200000e+01]]
define i32 @main() {
%1 = alloca [2 x [3 x double]]
%2 = alloca [3 x [4 x double]]
%3 = alloca [2 x [4 x double]]
%4 = bitcast [2 x [3 x double]]* %1 to i8*
%5 = bitcast [2 x [3 x double]]* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %1, i64 0, i64 0, i64 2
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %7
%8 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %1, i64 0, i64 1, i64 1
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %9
%10 = bitcast [3 x [4 x double]]* %2 to i8*
%11 = bitcast [2 x [4 x double]]* %3 to i8*
%12 = bitcast [2 x [3 x double]]* %1 to double**
%13 = bitcast [3 x [4 x double]]* %2 to double**
%14 = bitcast [2 x [4 x double]]* %3 to double**
%15 = call i32 @MatrixMultply(double** %12, i32 2, i32 3, double** %13, i32 4, double** %14)
ret i32 0
}