#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*/ clear(int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int /*<<< orphan*/ set(int);
scalar_t__ test(int);
int main(void) {
  int index;
  for (index = 0; index < 10000000; index++) {
    clear(index);
  }
  while (EOF != scanf("%d", &index)) {
    set(index);
  }
  for (index = 0; index < 10000000; index++) {
    if (test(index))
      printf("%d\n", index);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x989680,-0x8(%rbp)
jge    1189 <main+0x39>
mov    -0x8(%rbp),%edi
call   1050 <clear@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x16>
jmp    118e <main+0x3e>
mov    0x2e53(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
lea    0xe5d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     11c9 <main+0x79>
mov    -0x8(%rbp),%edi
call   1060 <set@plt>
jmp    118e <main+0x3e>
movl   $0x0,-0x8(%rbp)
cmpl   $0x989680,-0x8(%rbp)
jge    1211 <main+0xc1>
mov    -0x8(%rbp),%edi
call   1070 <test@plt>
cmp    $0x0,%rax
je     11fe <main+0xae>
mov    -0x8(%rbp),%esi
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
jmp    1203 <main+0xb3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d0 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <clear@plt>
add    $0x1,%ebx
cmp    $0x989680,%ebx
jne    1160 <main+0x10>
movl   $0x989680,0x4(%rsp)
mov    0x2e67(%rip),%r15
mov    (%r15),%rbx
lea    0xe75(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
je     11cc <main+0x7c>
lea    0xe5f(%rip),%r14
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
call   1060 <set@plt>
mov    (%r15),%rbx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
jne    11b0 <main+0x60>
movl   $0x0,0x4(%rsp)
xor    %edi,%edi
lea    0xe26(%rip),%rbx
jmp    11f2 <main+0xa2>
nop
mov    0x4(%rsp),%eax
lea    0x1(%rax),%edi
mov    %edi,0x4(%rsp)
cmp    $0x98967f,%eax
jge    120a <main+0xba>
call   1070 <test@plt>
test   %rax,%rax
je     11e0 <main+0x90>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    11e0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %7
3: ; preds = %7
store i32 10000000, i32* %1
%4 = load i64, i64* @EOF
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = icmp eq i64 %4, %5
br i1 %6, label %12, label %13
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %10, %7 ]
%9 = tail call i32 @clear(i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, 10000000
br i1 %11, label %3, label %7
12: ; preds = %13, %3
store i32 0, i32* %1
br label %19
13: ; preds = %3, %13
%14 = load i32, i32* %1
%15 = call i32 @set(i32 %14)
%16 = load i64, i64* @EOF
%17 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = icmp eq i64 %16, %17
br i1 %18, label %12, label %13
19: ; preds = %12, %26
%20 = phi i32 [ 0, %12 ], [ %28, %26 ]
%21 = call i64 @test(i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %19
%24 = load i32, i32* %1
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19, %23
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
%29 = icmp slt i32 %27, 9999999
br i1 %29, label %19, label %30
30: ; preds = %26
ret i32 0
}