#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 */
typedef int /*<<< orphan*/ matrix;
typedef int /*<<< orphan*/ arreglo;

/* Variables and functions */
int /*<<< orphan*/ PrintArrayMemoryAddress(void *, int, int);
int /*<<< orphan*/ PrintArrayValues(void *, int, int);
int /*<<< orphan*/ PrintTitles(char *);
int /*<<< orphan*/ printf(char *);
main() {
  PrintTitles(" Tarea 3 ");
  printf("El programa utiliza una variable llamada arreglo que tiene una "
         "dimensión de 10x1 y una variable llamada matrix de 2x3:\n\n");
  printf(" arreglo[10] = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10}\n");
  printf(" matrix[2][3]={{-1,-2,-3},{-4,-5,-6}}\n");
  printf("\nA continuación se muestran los valores y las posiciones en memoria "
         "de los elementos de cada variable, \nque correspondan a las "
         "posiciones impares\n");
  int arreglo[10] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
  int matrix[2][3] = {{-1, -2, -3}, {-4, -5, -6}};
  void *apuntador;
  apuntador = &arreglo;
  PrintArrayValues(apuntador, (sizeof(arreglo) / sizeof(arreglo[0])), 1);
  PrintArrayMemoryAddress(apuntador, (sizeof(arreglo) / sizeof(arreglo[0])), 1);
  apuntador = &matrix;
  PrintArrayValues(apuntador, (sizeof(matrix) / sizeof(matrix[0])),
                   (sizeof(matrix[0]) / sizeof(matrix[0][0])));
  PrintArrayMemoryAddress(apuntador, (sizeof(matrix) / sizeof(matrix[0])),
                          (sizeof(matrix[0]) / sizeof(matrix[0][0])));
  PrintTitles("By: Gabriela Flores Bracamontes");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1070 <PrintTitles@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xf06(%rip),%rdi
call   1040 <printf@plt>
lea    0xf2b(%rip),%rdi
call   1040 <printf@plt>
lea    0xf46(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    0xfea(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
mov    0x1009(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x1006(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x1003(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1030 <PrintArrayValues@plt>
mov    -0x58(%rbp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1050 <PrintArrayMemoryAddress@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <PrintArrayValues@plt>
mov    -0x58(%rbp),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <PrintArrayMemoryAddress@plt>
lea    0xf3c(%rip),%rdi
call   1070 <PrintTitles@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
call   1060 <PrintTitles@plt>
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
lea    0xf3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xf63(%rip),%rdi
call   1040 <puts@plt>
lea    0xf7d(%rip),%rdi
call   1040 <puts@plt>
mov    0x1028(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0x100c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xff0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0x1024(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x1008(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1030 <PrintArrayValues@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   1050 <PrintArrayMemoryAddress@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <PrintArrayValues@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <PrintArrayMemoryAddress@plt>
lea    0xdf7(%rip),%rdi
call   1060 <PrintTitles@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c" Tarea 3 \00"
@.str.1 = [122 x i8] c"El programa utiliza una variable llamada arreglo que tiene una dimensi\C3\B3n de 10x1 y una variable llamada matrix de 2x3:\0A\0A\00"
@.str.2 = [49 x i8] c" arreglo[10] = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10}\0A\00"
@.str.3 = [39 x i8] c" matrix[2][3]={{-1,-2,-3},{-4,-5,-6}}\0A\00"
@.str.4 = [148 x i8] c"\0AA continuaci\C3\B3n se muestran los valores y las posiciones en memoria de los elementos de cada variable, \0Aque correspondan a las posiciones impares\0A\00"
@__const.main.arreglo = [10 x i32] [i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8, i32 -9, i32 -10]
@__const.main.matrix = [2 x [3 x i32]] [[3 x i32] [i32 -1, i32 -2, i32 -3], [3 x i32] [i32 -4, i32 -5, i32 -6]]
@.str.5 = [32 x i8] c"By: Gabriela Flores Bracamontes\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [2 x [3 x i32]]
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i32 @PrintTitles(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.4, i64 0, i64 0))
%10 = bitcast [10 x i32]* %2 to i8*
%11 = bitcast [2 x [3 x i32]]* %3 to i8*
%12 = bitcast [10 x i32]* %2 to i8*
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = call i32 @PrintArrayValues(i8* %13, i32 10, i32 1)
%15 = load i8*, i8** %4
%16 = call i32 @PrintArrayMemoryAddress(i8* %15, i32 10, i32 1)
%17 = bitcast [2 x [3 x i32]]* %3 to i8*
store i8* %17, i8** %4
%18 = load i8*, i8** %4
%19 = call i32 @PrintArrayValues(i8* %18, i32 2, i32 3)
%20 = load i8*, i8** %4
%21 = call i32 @PrintArrayMemoryAddress(i8* %20, i32 2, i32 3)
%22 = call i32 @PrintTitles(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c" Tarea 3 \00"
@__const.main.arreglo = [10 x i32] [i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8, i32 -9, i32 -10]
@__const.main.matrix = [2 x [3 x i32]] [[3 x i32] [i32 -1, i32 -2, i32 -3], [3 x i32] [i32 -4, i32 -5, i32 -6]]
@.str.5 = [32 x i8] c"By: Gabriela Flores Bracamontes\00"
@str = [121 x i8] c"El programa utiliza una variable llamada arreglo que tiene una dimensi\C3\B3n de 10x1 y una variable llamada matrix de 2x3:\0A\00"
@str.6 = [48 x i8] c" arreglo[10] = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10}\00"
@str.7 = [38 x i8] c" matrix[2][3]={{-1,-2,-3},{-4,-5,-6}}\00"
@str.8 = [147 x i8] c"\0AA continuaci\C3\B3n se muestran los valores y las posiciones en memoria de los elementos de cada variable, \0Aque correspondan a las posiciones impares\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [2 x [3 x i32]]
%3 = tail call i32 @PrintTitles(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([121 x i8], [121 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([147 x i8], [147 x i8]* @str.8, i64 0, i64 0))
%8 = bitcast [10 x i32]* %1 to i8*
%9 = bitcast [2 x [3 x i32]]* %2 to i8*
%10 = call i32 @PrintArrayValues(i8* %8, i32 10, i32 1)
%11 = call i32 @PrintArrayMemoryAddress(i8* %8, i32 10, i32 1)
%12 = call i32 @PrintArrayValues(i8* %9, i32 2, i32 3)
%13 = call i32 @PrintArrayMemoryAddress(i8* %9, i32 2, i32 3)
%14 = call i32 @PrintTitles(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}