int main() {
  long *ptr;
  long i;
  printf("0x%X \n", &main);
  ptr = &main;
  printf(" --ADDRESS- : VAL- \n");
  for (i = 0; i <= 9999; i++) {
    printf(" 0x%X : 0x%08X \n", ptr, *ptr);
    ptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    0x2ebb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ead(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x270f,-0x18(%rbp)
jg     1199 <main+0x89>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1155 <main+0x45>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rdi
mov    0x2eb5(%rip),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    (%r15,%rbx,1),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rbx
cmp    $0x13880,%rbx
jne    1160 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"0x%X \0A\00"
@.str.1 = [21 x i8] c" --ADDRESS- : VAL- \0A\00"
@.str.2 = [17 x i8] c" 0x%X : 0x%08X \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64*
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*))
store i64* bitcast (i32 ()* @main to i64*), i64** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %3
br label %6
6: ; preds = %16, %0
%7 = load i64, i64* %3
%8 = icmp sle i64 %7, 9999
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i64*, i64** %2
%11 = load i64*, i64** %2
%12 = load i64, i64* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i64* %10, i64 %12)
%14 = load i64*, i64** %2
%15 = getelementptr inbounds i64, i64* %14, i32 1
store i64* %15, i64** %2
br label %16
16: ; preds = %9
%17 = load i64, i64* %3
%18 = add nsw i64 %17, 1
store i64 %18, i64* %3
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%X \0A\00"
@.str.2 = [17 x i8] c" 0x%X : 0x%08X \0A\00"
@str = [20 x i8] c" --ADDRESS- : VAL- \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %9, %3 ]
%5 = phi i64* [ bitcast (i32 ()* @main to i64*), %0 ], [ %8, %3 ]
%6 = load i64, i64* %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i64* %5, i64 %6)
%8 = getelementptr inbounds i64, i64* %5, i64 1
%9 = add nuw nsw i64 %4, 1
%10 = icmp eq i64 %9, 10000
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 0
}