#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 /*<<< orphan*/ print(int, int **);
int main() {
  int a[3][3] = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
  int b[3][3] = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
  int mat[3][3] = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
  matrix_multiply(3, a, b, mat);
  print(3, mat);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xee6(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x90(%rbp),%rcx
mov    $0x3,%edi
call   1030 <matrix_multiply@plt>
lea    -0x90(%rbp),%rsi
mov    $0x3,%edi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
mov    0xef2(%rip),%eax
mov    %eax,0x80(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xeb8(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
mov    %eax,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm1,0x30(%rsp)
mov    %eax,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm1,(%rsp)
lea    0x60(%rsp),%rsi
lea    0x30(%rsp),%rdx
mov    %rsp,%rbx
mov    $0x3,%edi
mov    %rbx,%rcx
call   1030 <matrix_multiply@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

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

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