#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 sumaProducto(int **, int **, int, int);
void productoMatriz(int matriz1[3][3], int matriz2[3][3], int producto[3][3]) {
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      producto[i][j] = sumaProducto(matriz1, matriz2, i, j);
    }
  }
}


x86 assembly (clang, -O0):
<productoMatriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1192 <productoMatriz+0x82>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    117f <productoMatriz+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <sumaProducto@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113c <productoMatriz+0x2c>
jmp    1184 <productoMatriz+0x74>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <productoMatriz+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<productoMatriz>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    $0x1,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x4(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x8(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0xc(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x10(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x14(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x18(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x1c(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <sumaProducto@plt>
mov    %eax,0x20(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @productoMatriz([3 x i32]* %0, [3 x i32]* %1, [3 x i32]* %2) {
%4 = alloca [3 x i32]*
%5 = alloca [3 x i32]*
%6 = alloca [3 x i32]*
%7 = alloca i32
%8 = alloca i32
store [3 x i32]* %0, [3 x i32]** %4
store [3 x i32]* %1, [3 x i32]** %5
store [3 x i32]* %2, [3 x i32]** %6
store i32 0, i32* %7
br label %9
9: ; preds = %35, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %38
12: ; preds = %9
store i32 0, i32* %8
br label %13
13: ; preds = %31, %12
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %34
16: ; preds = %13
%17 = load [3 x i32]*, [3 x i32]** %4
%18 = bitcast [3 x i32]* %17 to i32**
%19 = load [3 x i32]*, [3 x i32]** %5
%20 = bitcast [3 x i32]* %19 to i32**
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = call i32 @sumaProducto(i32** %18, i32** %20, i32 %21, i32 %22)
%24 = load [3 x i32]*, [3 x i32]** %6
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %24, i64 %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %27, i64 0, i64 %29
store i32 %23, i32* %30
br label %31
31: ; preds = %16
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %13
34: ; preds = %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %9
38: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @productoMatriz([3 x i32]* %0, [3 x i32]* %1, [3 x i32]* nocapture writeonly %2) {
%4 = bitcast [3 x i32]* %0 to i32**
%5 = bitcast [3 x i32]* %1 to i32**
%6 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 0, i32 0)
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 %6, i32* %7
%8 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 0, i32 1)
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 %8, i32* %9
%10 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 0, i32 2)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 %10, i32* %11
%12 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 1, i32 0)
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 1, i64 0
store i32 %12, i32* %13
%14 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 1, i32 1)
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 1, i64 1
store i32 %14, i32* %15
%16 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 1, i32 2)
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 1, i64 2
store i32 %16, i32* %17
%18 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 2, i32 0)
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 2, i64 0
store i32 %18, i32* %19
%20 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 2, i32 1)
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 2, i64 1
store i32 %20, i32* %21
%22 = tail call i32 @sumaProducto(i32** %4, i32** %5, i32 2, i32 2)
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 2, i64 2
store i32 %22, i32* %23
ret void
}