void main() {
  int V[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, *ptr, i;
  ptr = V;
  for (i = 0; i < 10; i++) {
    printf("Posicao: %d\tValor armazenado: %d\tEndereco da posicao: %d\n", i,
           *ptr, ptr);
    ptr++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    118b <main+0x6b>
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%rcx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    114c <main+0x2c>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xf00(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xedb(%rip),%rbx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rcx
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rcx
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rcx
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rcx
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rcx
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rcx
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x24(%rsp),%rcx
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.V = [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str = [58 x i8] c"Posicao: %d\09Valor armazenado: %d\09Endereco da posicao: %d\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i32
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32* %5, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = load i32*, i32** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12, i32* %13)
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %2
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@__const.main.V = [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str = [58 x i8] c"Posicao: %d\09Valor armazenado: %d\09Endereco da posicao: %d\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 0, i32 10, i32* %3)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 1, i32 %6, i32* %5)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 2, i32 %9, i32* %8)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 3, i32 %12, i32* %11)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 4, i32 %15, i32* %14)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 5, i32 %18, i32* %17)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 6, i32 %21, i32* %20)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 7, i32 %24, i32* %23)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 8, i32 %27, i32* %26)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 9, i32 %30, i32* %29)
ret void
}