#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 *);
void main() {
  int num;
  int i = 1;
  while (i == 1) {
    printf("Please enter an integer: ");
    scanf("%d", &num);
    switch ((num % 2)) {
    case 0:
      printf("%d is even.\n", num);
      break;
    case 1:
      printf("%d is odd.\n", num);
      break;
    case -1:
      printf("%d is odd.\n", num);
      break;
    }
    printf("Would you like to enter another integer? (1 = yes, 0 = no): ");
    scanf("%d", &i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11fa <main+0xda>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
sub    $0xffffffff,%eax
je     11c6 <main+0xa6>
jmp    1179 <main+0x59>
mov    -0xc(%rbp),%eax
test   %eax,%eax
je     119a <main+0x7a>
jmp    1189 <main+0x69>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11b0 <main+0x90>
jmp    11d7 <main+0xb7>
mov    -0x4(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
mov    -0x4(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
mov    -0x4(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x1,(%rsp)
lea    0xec7(%rip),%r14
lea    0xeda(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xf28(%rip),%rbp
lea    0xee3(%rip),%r12
mov    %rsp,%r13
jmp    117b <main+0x5b>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,(%rsp)
jne    11bd <main+0x9d>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
and    $0xfffffffe,%eax
neg    %eax
add    %esi,%eax
add    $0x1,%eax
cmp    $0x2,%eax
ja     1160 <main+0x40>
cltq
movslq 0x0(%rbp,%rax,4),%rdi
add    %rbp,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even.\0A\00"
@.str.3 = [12 x i8] c"%d is odd.\0A\00"
@.str.4 = [61 x i8] c"Would you like to enter another integer? (1 = yes, 0 = no): \00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %2
br label %3
3: ; preds = %20, %0
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %23
6: ; preds = %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = srem i32 %9, 2
switch i32 %10, label %20 [
i32 0, label %11
i32 1, label %14
i32 -1, label %17
]
11: ; preds = %6
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %20
14: ; preds = %6
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %20
17: ; preds = %6
%18 = load i32, i32* %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %6, %17, %14, %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %3
23: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"%d is even.\0A\00"
@.str.3 = [12 x i8] c"%d is odd.\0A\00"
@.str.4 = [61 x i8] c"Would you like to enter another integer? (1 = yes, 0 = no): \00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
br label %5
5: ; preds = %0, %17
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = srem i32 %8, 2
%10 = add nsw i32 %9, 1
%11 = icmp ult i32 %10, 3
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = sext i32 %10 to i64
%14 = shl i64 %13, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %15, i32 %8)
br label %17
17: ; preds = %5, %12
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 1
br i1 %21, label %5, label %22
22: ; preds = %17
ret void
}