#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 main(void) {
  const int SIZE = 10;
  int n, p, array[SIZE], getint(int *);
  for (n = 0; n < SIZE && (p = getint(&array[n])) != EOF; n++)
    if (p != 0)
      printf("%i\n", array[n]);
    else
      printf("non-digit\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0xc(%rbp)
mov    %al,-0x41(%rbp)
jge    1179 <main+0x59>
movslq -0xc(%rbp),%rax
lea    -0x40(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getint@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1189 <main+0x69>
jmp    11cf <main+0xaf>
cmpl   $0x0,-0x10(%rbp)
je     11ae <main+0x8e>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bc <main+0x9c>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    0x2ea4(%rip),%r12
lea    0xeb9(%rip),%r14
lea    0xeae(%rip),%r15
xor    %ebx,%ebx
jmp    1172 <main+0x42>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x4,%rbx
cmp    $0x28,%rbx
je     1198 <main+0x68>
lea    (%rsp,%rbx,1),%r13
mov    %r13,%rdi
call   1050 <getint@plt>
cmp    (%r12),%eax
je     1198 <main+0x68>
test   %eax,%eax
je     1160 <main+0x30>
mov    0x0(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1168 <main+0x38>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%i\0A\00"
@str = [10 x i8] c"non-digit\00"
define i32 @main() {
%1 = alloca [10 x i32]
br label %2
2: ; preds = %0, %15
%3 = phi i64 [ 0, %0 ], [ %16, %15 ]
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %3
%5 = call i32 @getint(i32* %4)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %18, label %8
8: ; preds = %2
%9 = icmp eq i32 %5, 0
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %15
13: ; preds = %8
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %10, %13
%16 = add nuw nsw i64 %3, 1
%17 = icmp eq i64 %16, 10
br i1 %17, label %18, label %2
18: ; preds = %15, %2
ret i32 0
}