#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*/ printf(char *, ...);
double traza(double *, int);
void main() {
  double matriz1[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
  int auxY, auxX;
  for (auxY = 0; auxY < 3; auxY++) {
    for (auxX = 0; auxX < 3; auxX++) {
      printf("%f\t", matriz1[auxY][auxX]);
    }
    printf("\n");
  }
  printf("Traza Matriz=%f\n", traza(&matriz1[0][0], 3));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    11bf <main+0x8f>
movl   $0x0,-0x58(%rbp)
cmpl   $0x3,-0x58(%rbp)
jge    11a3 <main+0x73>
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1165 <main+0x35>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1154 <main+0x24>
lea    -0x50(%rbp),%rdi
mov    $0x3,%esi
call   1050 <traza@plt>
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0xf54(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xf38(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xf1c(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xf21(%rip),%rbx
movsd  0xe81(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe77(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe6d(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0xe59(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe4f(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe45(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0xe31(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe27(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe1d(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
mov    $0x3,%esi
call   1050 <traza@plt>
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.matriz1 = [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00], [3 x double] [double 4.000000e+00, double 5.000000e+00, double 6.000000e+00], [3 x double] [double 7.000000e+00, double 8.000000e+00, double 9.000000e+00]]
@.str = [4 x i8] c"%f\09\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [17 x i8] c"Traza Matriz=%f\0A\00"
define void @main() {
%1 = alloca [3 x [3 x double]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [3 x [3 x double]]* %1 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %26, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %29
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %21, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 %14
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %17
%19 = load double, double* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %19)
br label %21
21: ; preds = %12
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %5
29: ; preds = %5
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 0
%32 = call double @traza(double* %31, i32 3)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %32)
ret void
}

LLVM IR (-O2):
@__const.main.matriz1 = [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00], [3 x double] [double 4.000000e+00, double 5.000000e+00, double 6.000000e+00], [3 x double] [double 7.000000e+00, double 8.000000e+00, double 9.000000e+00]]
@.str = [4 x i8] c"%f\09\00"
@.str.2 = [17 x i8] c"Traza Matriz=%f\0A\00"
define void @main() {
%1 = alloca [3 x [3 x double]]
%2 = bitcast [3 x [3 x double]]* %1 to i8*
%3 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.000000e+00)
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 4.000000e+00)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 5.000000e+00)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 6.000000e+00)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 7.000000e+00)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 8.000000e+00)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 9.000000e+00)
%15 = tail call i32 @putchar(i32 10)
%16 = call double @traza(double* %3, i32 3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %16)
ret void
}