#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, int *);
int main() {
  int v[10], i;
  int *ptr = v;
  for (i = 0; i < 10; i++) {
    *ptr = i;
    ptr++;
    printf("%d %ld\n", v[i], ptr);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1173 <main+0x63>
mov    -0x34(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
mov    -0x40(%rbp),%rdx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    112e <main+0x1e>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rdx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movl   $0x1,0x4(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0x2,0x8(%rsp)
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
movl   $0x3,0xc(%rsp)
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
movl   $0x4,0x10(%rsp)
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movl   $0x5,0x14(%rsp)
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
movl   $0x6,0x18(%rsp)
lea    0x1c(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movl   $0x7,0x1c(%rsp)
lea    0x20(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
movl   $0x8,0x20(%rsp)
lea    0x24(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
movl   $0x9,0x24(%rsp)
lea    0x28(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d %ld\0A\00"
define i32 @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
store i32 0, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0, i32* %4)
store i32 1, i32* %4
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1, i32* %6)
store i32 2, i32* %6
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2, i32* %8)
store i32 3, i32* %8
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 3, i32* %10)
store i32 4, i32* %10
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4, i32* %12)
store i32 5, i32* %12
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 5, i32* %14)
store i32 6, i32* %14
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 6, i32* %16)
store i32 7, i32* %16
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7, i32* %18)
store i32 8, i32* %18
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 8, i32* %20)
store i32 9, i32* %20
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
%23 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 9, i32* %22)
ret i32 0
}