#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 v[5], i;
  printf("Endereco inicial do vetor: %p\n", v);
  for (i = 0; i < 5; i++) {
    v[i] = i * 10;
    printf("Posicao %d, Valor %d Endereco do vetor: %p \n", i, v[i], v + i);
    printf("Posicao %d, Valor %d Endereco do vetor: %p \n", i, *(v + i), &v[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11ac <main+0x9c>
imul   $0xa,-0x24(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rcx
shl    $0x2,%rax
add    %rax,%rcx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1138 <main+0x28>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,(%rsp)
lea    0xed6(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%edx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%r14
movl   $0xa,0x4(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%r14
movl   $0x14,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x14,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r14
movl   $0x1e,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1e,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%r14
movl   $0x28,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x28,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Endereco inicial do vetor: %p\0A\00"
@.str.1 = [45 x i8] c"Posicao %d, Valor %d Endereco do vetor: %p \0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %35, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 10
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %19, i32* %23)
%25 = load i32, i32* %3
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %30, i32* %33)
br label %35
35: ; preds = %9
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %6
38: ; preds = %6
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Endereco inicial do vetor: %p\0A\00"
@.str.1 = [45 x i8] c"Posicao %d, Valor %d Endereco do vetor: %p \0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32* %3)
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %6, i32* %3)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
store i32 10, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 10, i32* %8)
%10 = load i32, i32* %8
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %10, i32* %8)
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
store i32 20, i32* %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 20, i32* %12)
%14 = load i32, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %14, i32* %12)
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
store i32 30, i32* %16
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 30, i32* %16)
%18 = load i32, i32* %16
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %18, i32* %16)
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 40, i32* %20
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 40, i32* %20)
%22 = load i32, i32* %20
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %22, i32* %20)
%24 = call i32 @putchar(i32 10)
ret i32 0
}