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

/* Variables and functions */
int /*<<< orphan*/ impDir(void *, int);
int /*<<< orphan*/ impValor(void *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int arreglo[10];
  int arreglo_mult[2][3];
  int i, j, k = 0;
  int colum, ren, dim;
  void *puntero;
  for (i = 0; i < 10; i++) {
    arreglo[i] = -(i + 1);
  }
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 3; j++) {
      arreglo_mult[i][j] = -(k + 1);
      k = k + 1;
    }
  }
  ren = sizeof(arreglo) / sizeof(*arreglo);
  dim = ren * 1;
  printf("\n\nArreglo unidimensional\n");
  puntero = &arreglo;
  printf("Imprime valores\n");
  impValor(puntero, dim);
  printf("\nImprime direcciones\n");
  impDir(puntero, dim);
  ren = sizeof(arreglo_mult) / sizeof(*arreglo_mult);
  colum = sizeof(arreglo_mult[0]) / sizeof(arreglo_mult[0][0]);
  dim = ren * colum;
  puntero = &arreglo_mult;
  printf("\n\nArreglo multidimensional\n");
  printf("Imprime valores\n");
  impValor(puntero, dim);
  printf("Imprime direcciones\n");
  impDir(puntero, dim);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1177 <main+0x47>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
xor    %ecx,%ecx
sub    %eax,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    114d <main+0x1d>
movl   $0x0,-0x54(%rbp)
cmpl   $0x2,-0x54(%rbp)
jge    11e3 <main+0xb3>
movl   $0x0,-0x58(%rbp)
cmpl   $0x3,-0x58(%rbp)
jge    11d0 <main+0xa0>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
sub    %eax,%edx
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    118f <main+0x5f>
jmp    11d5 <main+0xa5>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    117e <main+0x4e>
movl   $0xa,-0x64(%rbp)
mov    -0x64(%rbp),%eax
shl    $0x0,%eax
mov    %eax,-0x68(%rbp)
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   1040 <impValor@plt>
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   1050 <impDir@plt>
movl   $0x2,-0x64(%rbp)
movl   $0x3,-0x60(%rbp)
mov    -0x64(%rbp),%eax
imul   -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
lea    0xdb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   1040 <impValor@plt>
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   1050 <impDir@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec6(%rip),%xmm1
movaps %xmm1,0x30(%rsp)
movabs $0xfffffff6fffffff7,%rax
ff ff ff
mov    %rax,0x40(%rsp)
movaps %xmm0,(%rsp)
movabs $0xfffffffafffffffb,%rax
ff ff ff
mov    %rax,0x10(%rsp)
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <impValor@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <impDir@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <impValor@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <impDir@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\0A\0AArreglo unidimensional\0A\00"
@.str.1 = [17 x i8] c"Imprime valores\0A\00"
@.str.2 = [22 x i8] c"\0AImprime direcciones\0A\00"
@.str.3 = [28 x i8] c"\0A\0AArreglo multidimensional\0A\00"
@.str.4 = [21 x i8] c"Imprime direcciones\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [2 x [3 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %4
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = sub nsw i32 0, %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
store i32 %17, i32* %20
br label %21
21: ; preds = %14
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %11
24: ; preds = %11
store i32 0, i32* %4
br label %25
25: ; preds = %48, %24
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %51
28: ; preds = %25
store i32 0, i32* %5
br label %29
29: ; preds = %44, %28
%30 = load i32, i32* %5
%31 = icmp slt i32 %30, 3
br i1 %31, label %32, label %47
32: ; preds = %29
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
%35 = sub nsw i32 0, %34
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %3, i64 0, i64 %37
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %38, i64 0, i64 %40
store i32 %35, i32* %41
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %44
44: ; preds = %32
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %29
47: ; preds = %29
br label %48
48: ; preds = %47
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %25
51: ; preds = %25
store i32 10, i32* %8
%52 = load i32, i32* %8
%53 = mul nsw i32 %52, 1
store i32 %53, i32* %9
%54 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%55 = bitcast [10 x i32]* %2 to i8*
store i8* %55, i8** %10
%56 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%57 = load i8*, i8** %10
%58 = load i32, i32* %9
%59 = call i32 @impValor(i8* %57, i32 %58)
%60 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%61 = load i8*, i8** %10
%62 = load i32, i32* %9
%63 = call i32 @impDir(i8* %61, i32 %62)
store i32 2, i32* %8
store i32 3, i32* %7
%64 = load i32, i32* %8
%65 = load i32, i32* %7
%66 = mul nsw i32 %64, %65
store i32 %66, i32* %9
%67 = bitcast [2 x [3 x i32]]* %3 to i8*
store i8* %67, i8** %10
%68 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%70 = load i8*, i8** %10
%71 = load i32, i32* %9
%72 = call i32 @impValor(i8* %70, i32 %71)
%73 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%74 = load i8*, i8** %10
%75 = load i32, i32* %9
%76 = call i32 @impDir(i8* %74, i32 %75)
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@str = [25 x i8] c"\0A\0AArreglo unidimensional\00"
@str.6 = [21 x i8] c"\0AImprime direcciones\00"
@str.7 = [27 x i8] c"\0A\0AArreglo multidimensional\00"
@str.8 = [16 x i8] c"Imprime valores\00"
@str.9 = [20 x i8] c"Imprime direcciones\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [2 x [3 x i32]]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast [2 x [3 x i32]]* %2 to i8*
%5 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, <4 x i32>* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 -5, i32 -6, i32 -7, i32 -8>, <4 x i32>* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 -9, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 -10, i32* %9
%10 = bitcast [2 x [3 x i32]]* %2 to <4 x i32>*
store <4 x i32> <i32 -1, i32 -2, i32 -3, i32 -4>, <4 x i32>* %10
%11 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %2, i64 0, i64 1, i64 1
store i32 -5, i32* %11
%12 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %2, i64 0, i64 1, i64 2
store i32 -6, i32* %12
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
%15 = call i32 @impValor(i8* %3, i32 10)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
%17 = call i32 @impDir(i8* %3, i32 10)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.7, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
%20 = call i32 @impValor(i8* %4, i32 6)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.9, i64 0, i64 0))
%22 = call i32 @impDir(i8* %4, i32 6)
ret i32 0
}