#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int n, array[10];
  extern int getint(int *);
  for (n = 0; n < 10 && getint(&array[n]) != EOF; n++)
    printf("array[%d]=%d\n", n, array[n]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x8(%rbp)
mov    %al,-0x31(%rbp)
jge    116b <main+0x4b>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getint@plt>
cltq
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    117b <main+0x5b>
jmp    11a0 <main+0x80>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rdi
call   1040 <getint@plt>
cltq
mov    0x2eb2(%rip),%rbx
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    (%rsp),%edx
lea    0xeb7(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x4(%rsp),%edx
lea    0xe90(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x8(%rsp),%edx
lea    0xe66(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0xc(%rsp),%edx
lea    0xe3c(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x10(%rsp),%edx
lea    0xe12(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0x14(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x14(%rsp),%edx
lea    0xde8(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x18(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x18(%rsp),%edx
lea    0xdbe(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x1c(%rsp),%edx
lea    0xd98(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    0x20(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x20(%rsp),%edx
lea    0xd72(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0x24(%rsp),%rdi
call   1040 <getint@plt>
cltq
cmp    %rax,(%rbx)
je     12be <main+0x19e>
mov    0x24(%rsp),%edx
lea    0xd4c(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [14 x i8] c"array[%d]=%d\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
%4 = call i32 @getint(i32* %3)
%5 = sext i32 %4 to i64
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %6, %5
br i1 %7, label %83, label %8
8: ; preds = %0
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0, i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%12 = call i32 @getint(i32* %11)
%13 = sext i32 %12 to i64
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %14, %13
br i1 %15, label %83, label %16
16: ; preds = %8
%17 = load i32, i32* %11
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1, i32 %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%20 = call i32 @getint(i32* %19)
%21 = sext i32 %20 to i64
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %22, %21
br i1 %23, label %83, label %24
24: ; preds = %16
%25 = load i32, i32* %19
%26 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2, i32 %25)
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%28 = call i32 @getint(i32* %27)
%29 = sext i32 %28 to i64
%30 = load i64, i64* @EOF
%31 = icmp eq i64 %30, %29
br i1 %31, label %83, label %32
32: ; preds = %24
%33 = load i32, i32* %27
%34 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 3, i32 %33)
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%36 = call i32 @getint(i32* %35)
%37 = sext i32 %36 to i64
%38 = load i64, i64* @EOF
%39 = icmp eq i64 %38, %37
br i1 %39, label %83, label %40
40: ; preds = %32
%41 = load i32, i32* %35
%42 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 4, i32 %41)
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%44 = call i32 @getint(i32* %43)
%45 = sext i32 %44 to i64
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %46, %45
br i1 %47, label %83, label %48
48: ; preds = %40
%49 = load i32, i32* %43
%50 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 5, i32 %49)
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%52 = call i32 @getint(i32* %51)
%53 = sext i32 %52 to i64
%54 = load i64, i64* @EOF
%55 = icmp eq i64 %54, %53
br i1 %55, label %83, label %56
56: ; preds = %48
%57 = load i32, i32* %51
%58 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 6, i32 %57)
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%60 = call i32 @getint(i32* %59)
%61 = sext i32 %60 to i64
%62 = load i64, i64* @EOF
%63 = icmp eq i64 %62, %61
br i1 %63, label %83, label %64
64: ; preds = %56
%65 = load i32, i32* %59
%66 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7, i32 %65)
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%68 = call i32 @getint(i32* %67)
%69 = sext i32 %68 to i64
%70 = load i64, i64* @EOF
%71 = icmp eq i64 %70, %69
br i1 %71, label %83, label %72
72: ; preds = %64
%73 = load i32, i32* %67
%74 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 8, i32 %73)
%75 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%76 = call i32 @getint(i32* %75)
%77 = sext i32 %76 to i64
%78 = load i64, i64* @EOF
%79 = icmp eq i64 %78, %77
br i1 %79, label %83, label %80
80: ; preds = %72
%81 = load i32, i32* %75
%82 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 9, i32 %81)
br label %83
83: ; preds = %80, %72, %64, %56, %48, %40, %32, %24, %16, %8, %0
ret i32 0
}