#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*/ mult_matr(int **, int **, int **, int);
int /*<<< orphan*/ print_matr(int **, int);
int main() {
  int val = 3;
  static int matr1[3][3] = {{4, 2, 4}, {3, 8, 6}, {4, 7, 9}};
  static int matr2[3][3] = {{5, 1, 6}, {1, 4, 3}, {4, 6, 7}};
  int matr_res[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
  mult_matr(matr1, matr2, matr_res, 3);
  print_matr(matr_res, val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rdx
lea    0x2edf(%rip),%rdi
lea    0x2f08(%rip),%rsi
mov    $0x3,%ecx
call   1030 <mult_matr@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <print_matr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x20(%rsp)
lea    0x2f00(%rip),%rdi
lea    0x2f29(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdx
mov    $0x3,%ecx
call   1030 <mult_matr@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <print_matr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@main.matr1 = internal global [3 x [3 x i32]] [[3 x i32] [i32 4, i32 2, i32 4], [3 x i32] [i32 3, i32 8, i32 6], [3 x i32] [i32 4, i32 7, i32 9]]
@main.matr2 = internal global [3 x [3 x i32]] [[3 x i32] [i32 5, i32 1, i32 6], [3 x i32] [i32 1, i32 4, i32 3], [3 x i32] [i32 4, i32 6, i32 7]]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x [3 x i32]]
store i32 0, i32* %1
store i32 3, i32* %2
%4 = bitcast [3 x [3 x i32]]* %3 to i8*
%5 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0
%6 = bitcast [3 x i32]* %5 to i32**
%7 = call i32 @mult_matr(i32** bitcast ([3 x [3 x i32]]* @main.matr1 to i32**), i32** bitcast ([3 x [3 x i32]]* @main.matr2 to i32**), i32** %6, i32 3)
%8 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0
%9 = bitcast [3 x i32]* %8 to i32**
%10 = load i32, i32* %2
%11 = call i32 @print_matr(i32** %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@main.matr1 = internal global [3 x [3 x i32]] [[3 x i32] [i32 4, i32 2, i32 4], [3 x i32] [i32 3, i32 8, i32 6], [3 x i32] [i32 4, i32 7, i32 9]]
@main.matr2 = internal global [3 x [3 x i32]] [[3 x i32] [i32 5, i32 1, i32 6], [3 x i32] [i32 1, i32 4, i32 3], [3 x i32] [i32 4, i32 6, i32 7]]
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = bitcast [3 x [3 x i32]]* %1 to i8*
%3 = bitcast [3 x [3 x i32]]* %1 to i32**
%4 = call i32 @mult_matr(i32** bitcast ([3 x [3 x i32]]* @main.matr1 to i32**), i32** bitcast ([3 x [3 x i32]]* @main.matr2 to i32**), i32** %3, i32 3)
%5 = call i32 @print_matr(i32** %3, i32 3)
ret i32 0
}