#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int vec[] = {100, 200, 300, 400, 500, 600, 700, 800, 900};
  int *ptr;
  for (ptr = vec; ptr <= vec + 8; ptr++)
    printf("%d, ", *ptr);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x20,%rcx
cmp    %rcx,%rax
ja     1184 <main+0x64>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    114c <main+0x2c>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xf01(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%r14
lea    0xede(%rip),%r15
mov    %r15,%rdi
mov    $0x64,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x4,%rbx
cmp    %r14,%rbx
jbe    1160 <main+0x50>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.vec = [9 x i32] [i32 100, i32 200, i32 300, i32 400, i32 500, i32 600, i32 700, i32 800, i32 900]
@.str = [5 x i8] c"%d, \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [9 x i32]* %2 to i8*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
br label %6
6: ; preds = %15, %0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds i32, i32* %8, i64 8
%10 = icmp ule i32* %7, %9
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %3
br label %6
18: ; preds = %6
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@__const.main.vec = [9 x i32] [i32 100, i32 200, i32 300, i32 400, i32 500, i32 600, i32 700, i32 800, i32 900]
@.str = [5 x i8] c"%d, \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 8
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 100)
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 1
br label %6
6: ; preds = %0, %6
%7 = phi i32* [ %5, %0 ], [ %10, %6 ]
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i32, i32* %7, i64 1
%11 = icmp ugt i32* %10, %3
br i1 %11, label %12, label %6
12: ; preds = %6
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}