#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*/ print_matrix(char *, int **);
int /*<<< orphan*/ scalar_product(int **, int);
int /*<<< orphan*/ vector_product(int **, int **, int **);
int main(void) {
  int A[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
  int B[3][3] = {{11, 12, 13}, {14, 15, 16}, {17, 18, 19}};
  int C[3][3];
  print_matrix("A inicialmente", A);
  print_matrix("B inicialmente", B);
  scalar_product(A, 2);
  scalar_product(B, 2);
  print_matrix("A = A * 2", A);
  print_matrix("B = B * 2", B);
  vector_product(A, B, C);
  print_matrix("A x B", C);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xebe(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1060 <print_matrix@plt>
lea    -0x60(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1060 <print_matrix@plt>
lea    -0x30(%rbp),%rdi
mov    $0x2,%esi
call   1050 <scalar_product@plt>
lea    -0x60(%rbp),%rdi
mov    $0x2,%esi
call   1050 <scalar_product@plt>
lea    -0x30(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1060 <print_matrix@plt>
lea    -0x60(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1060 <print_matrix@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1030 <vector_product@plt>
lea    -0x90(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1060 <print_matrix@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xeec(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xece(%rip),%rdi
lea    0x30(%rsp),%r14
mov    %r14,%rsi
call   1050 <print_matrix@plt>
lea    0xec9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <print_matrix@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <scalar_product@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <scalar_product@plt>
lea    0xeac(%rip),%rdi
mov    %r14,%rsi
call   1050 <print_matrix@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1050 <print_matrix@plt>
lea    0x60(%rsp),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <vector_product@plt>
lea    0xe8f(%rip),%rdi
mov    %r15,%rsi
call   1050 <print_matrix@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.A = [3 x [3 x i32]] [[3 x i32] [i32 1, i32 2, i32 3], [3 x i32] [i32 4, i32 5, i32 6], [3 x i32] [i32 7, i32 8, i32 9]]
@__const.main.B = [3 x [3 x i32]] [[3 x i32] [i32 11, i32 12, i32 13], [3 x i32] [i32 14, i32 15, i32 16], [3 x i32] [i32 17, i32 18, i32 19]]
@.str = [15 x i8] c"A inicialmente\00"
@.str.1 = [15 x i8] c"B inicialmente\00"
@.str.2 = [10 x i8] c"A = A * 2\00"
@.str.3 = [10 x i8] c"B = B * 2\00"
@.str.4 = [6 x i8] c"A x B\00"
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 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0
%8 = bitcast [3 x i32]* %7 to i32**
%9 = call i32 @print_matrix(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32** %8)
%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 = call i32 @print_matrix(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32** %11)
%13 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0
%14 = bitcast [3 x i32]* %13 to i32**
%15 = call i32 @scalar_product(i32** %14, i32 2)
%16 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0
%17 = bitcast [3 x i32]* %16 to i32**
%18 = call i32 @scalar_product(i32** %17, i32 2)
%19 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0
%20 = bitcast [3 x i32]* %19 to i32**
%21 = call i32 @print_matrix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32** %20)
%22 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0
%23 = bitcast [3 x i32]* %22 to i32**
%24 = call i32 @print_matrix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32** %23)
%25 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0
%26 = bitcast [3 x i32]* %25 to i32**
%27 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 0
%28 = bitcast [3 x i32]* %27 to i32**
%29 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0
%30 = bitcast [3 x i32]* %29 to i32**
%31 = call i32 @vector_product(i32** %26, i32** %28, i32** %30)
%32 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0
%33 = bitcast [3 x i32]* %32 to i32**
%34 = call i32 @print_matrix(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32** %33)
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [3 x [3 x i32]] [[3 x i32] [i32 1, i32 2, i32 3], [3 x i32] [i32 4, i32 5, i32 6], [3 x i32] [i32 7, i32 8, i32 9]]
@__const.main.B = [3 x [3 x i32]] [[3 x i32] [i32 11, i32 12, i32 13], [3 x i32] [i32 14, i32 15, i32 16], [3 x i32] [i32 17, i32 18, i32 19]]
@.str = [15 x i8] c"A inicialmente\00"
@.str.1 = [15 x i8] c"B inicialmente\00"
@.str.2 = [10 x i8] c"A = A * 2\00"
@.str.3 = [10 x i8] c"B = B * 2\00"
@.str.4 = [6 x i8] c"A x B\00"
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 = call i32 @print_matrix(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32** %7)
%9 = bitcast [3 x [3 x i32]]* %2 to i32**
%10 = call i32 @print_matrix(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32** %9)
%11 = call i32 @scalar_product(i32** %7, i32 2)
%12 = call i32 @scalar_product(i32** %9, i32 2)
%13 = call i32 @print_matrix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32** %7)
%14 = call i32 @print_matrix(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32** %9)
%15 = bitcast [3 x [3 x i32]]* %3 to i32**
%16 = call i32 @vector_product(i32** %7, i32** %9, i32** %15)
%17 = call i32 @print_matrix(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32** %15)
ret i32 0
}