#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i;
  do {
    printf("input n(n>0):");
    scanf("%d", &n);
  } while (n <= 0);
  for (i = 1; i <= n; i++) {
    if (is_even(i) == !0)
      printf("%d is even.\n", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    113f <main+0xf>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11af <main+0x7f>
mov    -0xc(%rbp),%edi
call   1040 <is_even@plt>
cmp    $0x1,%eax
jne    119c <main+0x6c>
mov    -0xc(%rbp),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a1 <main+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <main+0x3e>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%r14
lea    0xec8(%rip),%rbp
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1150 <main+0x20>
lea    0xe9e(%rip),%rbx
xor    %ebp,%ebp
jmp    1186 <main+0x56>
nopw   0x0(%rax,%rax,1)
cmp    0xc(%rsp),%ebp
jge    11a3 <main+0x73>
add    $0x1,%ebp
mov    %ebp,%edi
call   1040 <is_even@plt>
cmp    $0x1,%eax
jne    1180 <main+0x50>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"input n(n>0):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %7, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 0
br i1 %9, label %4, label %10
10: ; preds = %7
store i32 1, i32* %3
br label %11
11: ; preds = %23, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %3
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %15
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %11
26: ; preds = %11
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [14 x i8] c"input n(n>0):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %14
%9 = phi i32 [ %15, %14 ], [ 1, %3 ]
%10 = call i32 @is_even(i32 %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %14
14: ; preds = %8, %12
%15 = add nuw nsw i32 %9, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %9, %16
br i1 %17, label %8, label %18
18: ; preds = %14
ret i32 0
}