#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter A Number: ");
  scanf("%d", &n);
  printf("USING IF...ELSE \n");
  if (n % 2 == 0)
    printf("%d is Even \n", n);
  else
    printf("%d is Odd \n", n);
  printf("USING ONLY IF \n");
  if (n % 2 == 0)
    printf("%d is Even \n", n);
  if (n % 2 != 0)
    printf("%d is Odd \n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1185 <main+0x65>
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c9 <main+0xa9>
mov    -0x8(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11ee <main+0xce>
mov    -0x8(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
test   $0x1,%sil
lea    0xea9(%rip),%rax
lea    0xeaf(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
test   $0x1,%sil
jne    11ab <main+0x7b>
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
test   $0x1,%sil
je     11b9 <main+0x89>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter A Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"USING IF...ELSE \0A\00"
@.str.3 = [13 x i8] c"%d is Even \0A\00"
@.str.4 = [12 x i8] c"%d is Odd \0A\00"
@.str.5 = [16 x i8] c"USING ONLY IF \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %2)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = srem i32 %6, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %10)
br label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = srem i32 %17, 2
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %15
%24 = load i32, i32* %2
%25 = srem i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %23
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter A Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [13 x i8] c"%d is Even \0A\00"
@.str.4 = [12 x i8] c"%d is Odd \0A\00"
@str = [17 x i8] c"USING IF...ELSE \00"
@str.6 = [15 x i8] c"USING ONLY IF \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 %6)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%17 = load i32, i32* %1
%18 = and i32 %17, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %0, %15
%21 = phi i32 [ %17, %15 ], [ %12, %0 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %15
ret i32 0
}