#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 isEvenNumber(int);
int /*<<< orphan*/ printf(char *, ...);
void test(int num) {
  int is_even = isEvenNumber(num);
  if (is_even) {
    printf("The number %d is EVEN \n", num);
  } else {
    printf("The number %d is ODD \n", num);
  }
  switch (num) {
  case 0:
    printf(" Zero \n");
    break;
  case 1:
    printf(" One \n");
    break;
  case 2:
    printf(" Two \n");
    break;
  default:
    printf(" %d is not Zero, One or Two \n", num);
    break;
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isEvenNumber@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1156 <test+0x36>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1167 <test+0x47>
mov    -0x4(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     119c <test+0x7c>
jmp    117a <test+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11af <test+0x8f>
jmp    118b <test+0x6b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11c2 <test+0xa2>
jmp    11d5 <test+0xb5>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <test+0xc6>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <test+0xc6>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <test+0xc6>
mov    -0x4(%rbp),%esi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %edi,%ebx
call   1050 <isEvenNumber@plt>
test   %eax,%eax
lea    0xed7(%rip),%rax
lea    0xeb8(%rip),%rdi
cmove  %rax,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebx
je     1170 <test+0x40>
cmp    $0x1,%ebx
je     117d <test+0x4d>
test   %ebx,%ebx
jne    118a <test+0x5a>
lea    0xeef(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xed6(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xecf(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xe9e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"The number %d is EVEN \0A\00"
@.str.1 = [23 x i8] c"The number %d is ODD \0A\00"
@.str.2 = [8 x i8] c" Zero \0A\00"
@.str.3 = [7 x i8] c" One \0A\00"
@.str.4 = [7 x i8] c" Two \0A\00"
@.str.5 = [30 x i8] c" %d is not Zero, One or Two \0A\00"
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @isEvenNumber(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %14
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
switch i32 %15, label %22 [
i32 0, label %16
i32 1, label %18
i32 2, label %20
]
16: ; preds = %14
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %25
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %25
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %25
22: ; preds = %14
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %20, %18, %16
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"The number %d is EVEN \0A\00"
@.str.1 = [23 x i8] c"The number %d is ODD \0A\00"
@.str.5 = [30 x i8] c" %d is not Zero, One or Two \0A\00"
@str = [6 x i8] c" Two \00"
@str.6 = [6 x i8] c" One \00"
@str.7 = [7 x i8] c" Zero \00"
define void @test(i32 %0) {
%2 = tail call i32 @isEvenNumber(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %4, i32 %0)
switch i32 %0, label %12 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
]
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.7, i64 0, i64 0))
br label %14
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %0)
br label %14
14: ; preds = %12, %10, %8, %6
ret void
}