#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 x[5] = {100, 200, 300, 400, 500};
  int *p = &x[0], i;
  for (i = 0; i < 5; i++) {
    (*(p++))++;
  }
  for (i = 0; i < 5; i++) {
    printf("The value of x[%d] is %d\n", i, x[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    117b <main+0x6b>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114d <main+0x3d>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    11b1 <main+0xa1>
mov    -0x2c(%rbp),%esi
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1182 <main+0x72>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xc9,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x12d,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x191,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1f5,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [5 x i32] [i32 100, i32 200, i32 300, i32 400, i32 500]
@.str = [26 x i8] c"The value of x[%d] is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i32]* %2 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %3
store i32 0, i32* %4
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %3
%13 = load i32, i32* %11
%14 = add nsw i32 %13, 1
store i32 %14, i32* %11
br label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %7
18: ; preds = %7
store i32 0, i32* %4
br label %19
19: ; preds = %29, %18
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 5
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32, i32* %4
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %19
32: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"The value of x[%d] is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 0, i32 101)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1, i32 201)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 2, i32 301)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 3, i32 401)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 4, i32 501)
ret i32 0
}