#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 isEven(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  for (int i = 0; i < 2; i++) {
    int input;
    printf("Enter an integer: ");
    scanf("%d", &input);
    bool valueIsEven = isEven(input);
    if (valueIsEven) {
      printf("%d is even\n\n", input);
    } else {
      printf("%d is odd\n\n", input);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11bd <main+0x8d>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1050 <isEven@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1199 <main+0x69>
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11aa <main+0x7a>
mov    -0xc(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11af <main+0x7f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebe(%rip),%r12
lea    0xc(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <isEven@plt>
test   %eax,%eax
mov    0xc(%rsp),%esi
lea    0xea8(%rip),%r13
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
cmove  %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <isEven@plt>
test   %eax,%eax
mov    0xc(%rsp),%esi
cmove  %r13,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even\0A\0A\00"
@.str.3 = [12 x i8] c"%d is odd\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = call i32 @isEven(i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %21
18: ; preds = %8
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %5
25: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even\0A\0A\00"
@.str.3 = [12 x i8] c"%d is odd\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @isEven(i32 %5)
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* %1
%9 = select i1 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 %8)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = call i32 @isEven(i32 %13)
%15 = icmp eq i32 %14, 0
%16 = load i32, i32* %1
%17 = select i1 %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17, i32 %16)
ret i32 0
}