#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 *, ...);
int main() {
  int x[8] = {10, 20, 30, 40, 50, 70, 80};
  printf("\nx → (%p) es el comienzo en memoria del vector\n", x);
  printf("x+2 → (%p) es el comienzo en memoria del vector + 2\n", x + 2);
  printf("Accede a la primera posición del vector → %d\n", *x);
  printf("A la primera posición del vector le suma 2 → %d\n", (*x + 2));
  printf("Accede a la posicion de comienzo + 2, es decir a la 3 → %d\n",
         *(x + 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
add    $0x8,%rsi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
add    $0x2,%esi
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xf4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeee(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
lea    0xf0a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
lea    0xf30(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
add    $0x2,%esi
lea    0xf4d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xf6f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 70, i32 80, i32 0]
@.str = [50 x i8] c"\0Ax \E2\86\92 (%p) es el comienzo en memoria del vector\0A\00"
@.str.1 = [55 x i8] c"x+2 \E2\86\92 (%p) es el comienzo en memoria del vector + 2\0A\00"
@.str.2 = [49 x i8] c"Accede a la primera posici\C3\B3n del vector \E2\86\92 %d\0A\00"
@.str.3 = [52 x i8] c"A la primera posici\C3\B3n del vector le suma 2 \E2\86\92 %d\0A\00"
@.str.4 = [62 x i8] c"Accede a la posicion de comienzo + 2, es decir a la 3 \E2\86\92 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
store i32 0, i32* %1
%3 = bitcast [8 x i32]* %2 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds i32, i32* %6, i64 2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 70, i32 80, i32 0]
@.str = [50 x i8] c"\0Ax \E2\86\92 (%p) es el comienzo en memoria del vector\0A\00"
@.str.1 = [55 x i8] c"x+2 \E2\86\92 (%p) es el comienzo en memoria del vector + 2\0A\00"
@.str.2 = [49 x i8] c"Accede a la primera posici\C3\B3n del vector \E2\86\92 %d\0A\00"
@.str.3 = [52 x i8] c"A la primera posici\C3\B3n del vector le suma 2 \E2\86\92 %d\0A\00"
@.str.4 = [62 x i8] c"Accede a la posicion de comienzo + 2, es decir a la 3 \E2\86\92 %d\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 2
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %12)
ret i32 0
}