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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x1a5(%rbp)
jge    1174 <main+0x54>
movslq -0x8(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getint@plt>
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x1a5(%rbp)
mov    -0x1a5(%rbp),%al
test   $0x1,%al
jne    1187 <main+0x67>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edx
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1a4(%rbp)
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    0x2dfc(%rip),%rcx
cmp    (%rcx),%eax
je     1224 <main+0x104>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11d7 <main+0xb7>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    0x2eb3(%rip),%r15
lea    0xec4(%rip),%r14
xor    %r12d,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%r12,1),%rdi
call   1040 <getint@plt>
cmp    (%r15),%eax
je     1180 <main+0x60>
mov    (%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0x4,%r12
cmp    $0x64,%rbx
jne    1150 <main+0x30>
mov    $0x64,%ebx
mov    %ebx,%eax
mov    (%rsp,%rax,4),%edx
lea    0xe74(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
cmp    (%r15),%esi
je     11c5 <main+0xa5>
lea    0x4(%rsp),%rbx
lea    0xe71(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%esi
add    $0x4,%rbx
cmp    (%r15),%esi
jne    11b0 <main+0x90>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [30 x i8] c"Storing in n = %d, getint %d\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %24, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %10
%12 = call i32 @getint(i32* %11)
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br label %15
15: ; preds = %8, %5
%16 = phi i1 [ false, %5 ], [ %14, %8 ]
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 [100 x i32], [100 x i32]* %3, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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 %5
27: ; preds = %15
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %32)
store i32 0, i32* %4
br label %34
34: ; preds = %47, %27
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* @EOF
%40 = icmp ne i32 %38, %39
br i1 %40, label %41, label %50
41: ; preds = %34
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %34
50: ; preds = %34
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [30 x i8] c"Storing in n = %d, getint %d\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %10
%4 = phi i64 [ 0, %0 ], [ %13, %10 ]
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %4
%6 = call i32 @getint(i32* %5)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
%9 = trunc i64 %4 to i32
br i1 %8, label %15, label %10
10: ; preds = %3
%11 = load i32, i32* %5
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = add nuw nsw i64 %4, 1
%14 = icmp eq i64 %13, 100
br i1 %14, label %17, label %3
15: ; preds = %3
%16 = trunc i64 %4 to i32
br label %17
17: ; preds = %10, %15
%18 = phi i32 [ %16, %15 ], [ 100, %10 ]
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %21)
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%24 = load i32, i32* %23
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %28, %17
ret i32 0
28: ; preds = %17, %28
%29 = phi i64 [ %32, %28 ], [ 0, %17 ]
%30 = phi i32 [ %34, %28 ], [ %24, %17 ]
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = add nuw i64 %29, 1
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* @EOF
%36 = icmp eq i32 %34, %35
br i1 %36, label %27, label %28
}