#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 *, ...);
void checkIfOddOrEven(int numberToCheck) {
  if (numberToCheck == 0) {
    printf("0 is not odd and not even\n");
    return;
  }
  if (numberToCheck % 2 == 0) {
    printf("%d is even\n", numberToCheck);
  } else {
    printf("%d is odd\n", numberToCheck);
  }
}


x86 assembly (clang, -O0):
<checkIfOddOrEven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1138 <checkIfOddOrEven+0x28>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1173 <checkIfOddOrEven+0x63>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1162 <checkIfOddOrEven+0x52>
mov    -0x4(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1173 <checkIfOddOrEven+0x63>
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfOddOrEven>:
test   %edi,%edi
je     113a <checkIfOddOrEven+0x1a>
mov    %edi,%esi
test   $0x1,%sil
jne    1146 <checkIfOddOrEven+0x26>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xed6(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"0 is not odd and not even\0A\00"
@.str.1 = [12 x i8] c"%d is even\0A\00"
@.str.2 = [11 x i8] c"%d is odd\0A\00"
define void @checkIfOddOrEven(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %17
7: ; preds = %1
%8 = load i32, i32* %2
%9 = srem i32 %8, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %17
14: ; preds = %7
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %5, %14, %11
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d is even\0A\00"
@.str.2 = [11 x i8] c"%d is odd\0A\00"
@str = [26 x i8] c"0 is not odd and not even\00"
define void @checkIfOddOrEven(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %12
5: ; preds = %1
%6 = and i32 %0, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %12
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %12
12: ; preds = %3, %10, %8
ret void
}