void main() {
  char V[10] = "ABCDEFGHIJ", *ptr;
  int i;
  ptr = V;
  for (i = 0; i < 10; i++) {
    printf("Posicao: %d\tValor armazenado: %c\tEndereco da posicao: %d\n", i,
           *ptr, ptr);
    ptr++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xede(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    117d <main+0x6d>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
mov    -0x18(%rbp),%rcx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <main+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x4847464544434241,%rax
46 47 48
mov    %rax,0x8(%rsp)
movw   $0x4a49,0x10(%rsp)
lea    0x10(%rsp),%r14
lea    0xed1(%rip),%rbx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x41,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x9(%rsp),%rcx
movsbl 0x9(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xa(%rsp),%rcx
movsbl 0xa(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xb(%rsp),%rcx
movsbl 0xb(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rcx
movsbl 0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd(%rsp),%rcx
movsbl 0xd(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe(%rsp),%rcx
movsbl 0xe(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf(%rsp),%rcx
movsbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x11(%rsp),%rcx
movsbl 0x11(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.V = [10 x i8] c"ABCDEFGHIJ"
@.str = [58 x i8] c"Posicao: %d\09Valor armazenado: %c\09Endereco da posicao: %d\0A\00"
define void @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 0, i32 65, i8* %2)
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%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, i8* %4)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 2, i32 %10, i8* %8)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 3, i32 %14, i8* %12)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 4, i32 %18, i8* %16)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 5, i32 %22, i8* %20)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 6, i32 %26, i8* %24)
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 7, i32 %30, i8* %28)
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 8, i32 %34, i8* %32)
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 9, i32 %38, i8* %36)
ret void
}