#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 GetInteger();
int /*<<< orphan*/ printf(char *);
main() {
  int n;
  printf("Program to classify a number as even or odd.\n");
  printf("n = ? ");
  n = GetInteger();
  if (n % 2 == 0) {
    printf("That number is even.\n");
  } else {
    printf("That number is odd.\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <GetInteger@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1176 <main+0x56>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x62>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <GetInteger@plt>
test   $0x1,%al
lea    0xeef(%rip),%rax
lea    0xed4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Program to classify a number as even or odd.\0A\00"
@.str.1 = [7 x i8] c"n = ? \00"
@.str.2 = [22 x i8] c"That number is even.\0A\00"
@.str.3 = [21 x i8] c"That number is odd.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @GetInteger()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = srem i32 %6, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"n = ? \00"
@str = [45 x i8] c"Program to classify a number as even or odd.\00"
@str.4 = [20 x i8] c"That number is odd.\00"
@str.5 = [21 x i8] c"That number is even.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @GetInteger()
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
ret i32 0
}