#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 getint(int *);
int /*<<< orphan*/ printf(char *, int, int, char *);
int main() {
  int i, ns[10], v;
  for (i = 0; i < 10 && (v = getint(&ns[i])) != EOF; i++) {
    printf("%d-th entry is: %d, returned value is %s\n", i + 1, ns[i],
           v != 0 ? "a number" : "not a number");
  }
}


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,-0x35(%rbp)
jge    116b <main+0x4b>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getint@plt>
mov    %eax,-0x34(%rbp)
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    117b <main+0x5b>
jmp    11bb <main+0x9b>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
mov    -0x34(%rbp),%edi
lea    0xe97(%rip),%rcx
lea    0xe94(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rdi
call   1040 <getint@plt>
mov    0x2eb0(%rip),%rbx
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    (%rsp),%edx
test   %eax,%eax
lea    0xede(%rip),%r15
lea    0xedb(%rip),%r14
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xe9f(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x4(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xe6f(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x8(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xe3f(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0xc(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xe0f(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x10(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xddf(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x14(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x14(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xdaf(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0x18(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x18(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xd7f(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x1c(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xd53(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0x20(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x20(%rsp),%edx
test   %eax,%eax
mov    %r14,%rcx
cmove  %r15,%rcx
lea    0xd27(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0x24(%rsp),%rdi
call   1040 <getint@plt>
cmp    (%rbx),%eax
je     130f <main+0x1ef>
mov    0x24(%rsp),%edx
test   %eax,%eax
cmove  %r15,%r14
lea    0xcfe(%rip),%rdi
mov    $0xa,%esi
mov    %r14,%rcx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [42 x i8] c"%d-th entry is: %d, returned value is %s\0A\00"
@.str.1 = [9 x i8] c"a number\00"
@.str.2 = [13 x i8] c"not a number\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %29, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %10
%12 = call i32 @getint(i32* %11)
store i32 %12, i32* %4
%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 %32
17: ; preds = %15
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
%28 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %23, i8* %27)
br label %29
29: ; preds = %17
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %5
32: ; preds = %15
%33 = load i32, i32* %1
ret i32 %33
}

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