#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 is_even(int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int arange(void) {
  int count = 0;
  int even = 0;
  int number;
  while (scanf("%i", &number) == 1) {
    count++;
    if (count > 10) {
      printf("Too much elements!\n");
      break;
    }
    if (is_even(number) == 1)
      even += 1;
  }
  if (count == 0) {
    return -1;
  }
  return even;
}


x86 assembly (clang, -O0):
<arange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11a2 <arange+0x72>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    1183 <arange+0x53>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <arange+0x72>
mov    -0x10(%rbp),%edi
call   1040 <is_even@plt>
cmp    $0x1,%eax
jne    119d <arange+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <arange+0x16>
cmpl   $0x0,-0x8(%rbp)
jne    11b8 <arange+0x88>
movl   $0xffffffff,-0x4(%rbp)
jmp    11be <arange+0x8e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arange>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%ebx
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
lea    0xe94(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xe67(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xe3a(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xe0d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xde0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xdb3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xd86(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xd59(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xd30(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
mov    0xc(%rsp),%edi
call   1040 <is_even@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebx
lea    0xd07(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1314 <arange+0x1e4>
lea    0xcf4(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [20 x i8] c"Too much elements!\0A\00"
define i32 @arange() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %22, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 10
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %23
15: ; preds = %8
%16 = load i32, i32* %4
%17 = call i32 @is_even(i32 %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %19, %15
br label %5
23: ; preds = %13, %5
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 -1, i32* %1
br label %29
27: ; preds = %23
%28 = load i32, i32* %3
store i32 %28, i32* %1
br label %29
29: ; preds = %27, %26
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@str = [19 x i8] c"Too much elements!\00"
define i32 @arange() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %86
5: ; preds = %0
%6 = load i32, i32* %1
%7 = call i32 @is_even(i32 %6)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %86
12: ; preds = %78
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %86
14: ; preds = %5
%15 = load i32, i32* %1
%16 = call i32 @is_even(i32 %15)
%17 = icmp eq i32 %16, 1
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %9, %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %86
22: ; preds = %14
%23 = load i32, i32* %1
%24 = call i32 @is_even(i32 %23)
%25 = icmp eq i32 %24, 1
%26 = zext i1 %25 to i32
%27 = add nuw nsw i32 %19, %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %86
30: ; preds = %22
%31 = load i32, i32* %1
%32 = call i32 @is_even(i32 %31)
%33 = icmp eq i32 %32, 1
%34 = zext i1 %33 to i32
%35 = add nuw nsw i32 %27, %34
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %86
38: ; preds = %30
%39 = load i32, i32* %1
%40 = call i32 @is_even(i32 %39)
%41 = icmp eq i32 %40, 1
%42 = zext i1 %41 to i32
%43 = add nuw nsw i32 %35, %42
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %86
46: ; preds = %38
%47 = load i32, i32* %1
%48 = call i32 @is_even(i32 %47)
%49 = icmp eq i32 %48, 1
%50 = zext i1 %49 to i32
%51 = add nuw nsw i32 %43, %50
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %86
54: ; preds = %46
%55 = load i32, i32* %1
%56 = call i32 @is_even(i32 %55)
%57 = icmp eq i32 %56, 1
%58 = zext i1 %57 to i32
%59 = add nuw nsw i32 %51, %58
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%61 = icmp eq i32 %60, 1
br i1 %61, label %62, label %86
62: ; preds = %54
%63 = load i32, i32* %1
%64 = call i32 @is_even(i32 %63)
%65 = icmp eq i32 %64, 1
%66 = zext i1 %65 to i32
%67 = add nuw nsw i32 %59, %66
%68 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %86
70: ; preds = %62
%71 = load i32, i32* %1
%72 = call i32 @is_even(i32 %71)
%73 = icmp eq i32 %72, 1
%74 = zext i1 %73 to i32
%75 = add nuw nsw i32 %67, %74
%76 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%77 = icmp eq i32 %76, 1
br i1 %77, label %78, label %86
78: ; preds = %70
%79 = load i32, i32* %1
%80 = call i32 @is_even(i32 %79)
%81 = icmp eq i32 %80, 1
%82 = zext i1 %81 to i32
%83 = add nuw nsw i32 %75, %82
%84 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%85 = icmp eq i32 %84, 1
br i1 %85, label %12, label %86
86: ; preds = %0, %78, %70, %62, %54, %46, %38, %30, %22, %14, %5, %12
%87 = phi i32 [ %83, %12 ], [ -1, %0 ], [ %9, %5 ], [ %19, %14 ], [ %27, %22 ], [ %35, %30 ], [ %43, %38 ], [ %51, %46 ], [ %59, %54 ], [ %67, %62 ], [ %75, %70 ], [ %83, %78 ]
ret i32 %87
}