#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*/ matrix_multiply(int *, int *, int *, int, int, int);
int main() {
  int MatOne[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 1, 1}};
  int MatTwo[4][5] = {{1, 2, 1, 4, 3},
                      {2, 8, 3, 3, 3},
                      {3, 1, 1, 6, 1},
                      {
                          4,
                          3,
                          1,
                          2,
                          3,
                      }};
  int MatThree[3][5] = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}};
  matrix_multiply(MatOne[0], MatTwo[0], MatThree[0], 3, 4, 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xecb(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
call   1030 <matrix_multiply@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf2e(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xf0f(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xef0(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x2c(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%rdi
lea    0x70(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
call   1030 <matrix_multiply@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@__const.main.MatOne = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 1, i32 1]]
@__const.main.MatTwo = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 2, i32 1, i32 4, i32 3], [5 x i32] [i32 2, i32 8, i32 3, i32 3, i32 3], [5 x i32] [i32 3, i32 1, i32 1, i32 6, i32 1], [5 x i32] [i32 4, i32 3, i32 1, i32 2, i32 3]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [4 x i32]]
%3 = alloca [4 x [5 x i32]]
%4 = alloca [3 x [5 x i32]]
store i32 0, i32* %1
%5 = bitcast [3 x [4 x i32]]* %2 to i8*
%6 = bitcast [4 x [5 x i32]]* %3 to i8*
%7 = bitcast [3 x [5 x i32]]* %4 to i8*
%8 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %2, i64 0, i64 0
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%10 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %3, i64 0, i64 0
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%12 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %4, i64 0, i64 0
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 0
%14 = call i32 @matrix_multiply(i32* %9, i32* %11, i32* %13, i32 3, i32 4, i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.MatOne = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 6, i32 7, i32 8], [4 x i32] [i32 9, i32 10, i32 1, i32 1]]
@__const.main.MatTwo = [4 x [5 x i32]] [[5 x i32] [i32 1, i32 2, i32 1, i32 4, i32 3], [5 x i32] [i32 2, i32 8, i32 3, i32 3, i32 3], [5 x i32] [i32 3, i32 1, i32 1, i32 6, i32 1], [5 x i32] [i32 4, i32 3, i32 1, i32 2, i32 3]]
define i32 @main() {
%1 = alloca [3 x [4 x i32]]
%2 = alloca [4 x [5 x i32]]
%3 = alloca [3 x [5 x i32]]
%4 = bitcast [3 x [4 x i32]]* %1 to i8*
%5 = bitcast [4 x [5 x i32]]* %2 to i8*
%6 = bitcast [3 x [5 x i32]]* %3 to i8*
%7 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%8 = getelementptr inbounds [4 x [5 x i32]], [4 x [5 x i32]]* %2, i64 0, i64 0, i64 0
%9 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %3, i64 0, i64 0, i64 0
%10 = call i32 @matrix_multiply(i32* %7, i32* %8, i32* %9, i32 3, i32 4, i32 5)
ret i32 0
}