#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main() {
  int c = 0;
  while (1) {
    puts("Please enter a character:");
    c = getchar();
    printf("Entered: %c\n", c);
    if (c != EOF && c > '0' && c < '6') {
      puts("Character from 1 to 5");
    } else if (c == EOF) {
      break;
    } else {
      puts("Not interesting");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
je     11a2 <main+0x72>
cmpl   $0x30,-0x8(%rbp)
jle    11a2 <main+0x72>
cmpl   $0x36,-0x8(%rbp)
jge    11a2 <main+0x72>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
jmp    11ca <main+0x9a>
mov    -0x8(%rbp),%eax
mov    0x2e3c(%rip),%rcx
cmp    (%rcx),%eax
jne    11b9 <main+0x89>
jmp    11cf <main+0x9f>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
jmp    11ca <main+0x9a>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
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
lea    0xebe(%rip),%r14
lea    0xed1(%rip),%r15
mov    0x2e98(%rip),%r12
lea    0xed0(%rip),%r13
lea    0xedf(%rip),%rbp
jmp    116c <main+0x3c>
mov    %rbp,%rdi
cmp    %eax,%ebx
je     119c <main+0x6c>
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    (%r12),%eax
lea    -0x31(%rbx),%ecx
cmp    $0x4,%ecx
ja     1160 <main+0x30>
mov    %r13,%rdi
cmp    %eax,%ebx
jne    1167 <main+0x37>
jmp    1160 <main+0x30>
xor    %eax,%eax
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 a character:\00"
@.str.1 = [13 x i8] c"Entered: %c\0A\00"
@EOF = global i32 0
@.str.2 = [22 x i8] c"Character from 1 to 5\00"
@.str.3 = [16 x i8] c"Not interesting\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %27
%4 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 48
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 54
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %27
19: ; preds = %14, %11, %3
%20 = load i32, i32* %2
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
br label %28
24: ; preds = %19
%25 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24
br label %27
27: ; preds = %26, %17
br label %3
28: ; preds = %23
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter a character:\00"
@.str.1 = [13 x i8] c"Entered: %c\0A\00"
@EOF = global i32 0
@.str.2 = [22 x i8] c"Character from 1 to 5\00"
@.str.3 = [16 x i8] c"Not interesting\00"
define i32 @main() {
br label %1
1: ; preds = %12, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @getchar()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %3, %5
%7 = add i32 %3, -49
%8 = icmp ult i32 %7, 5
%9 = and i1 %8, %6
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = icmp eq i32 %3, %5
br i1 %11, label %15, label %12
12: ; preds = %10, %1
%13 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %10 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
br label %1
15: ; preds = %10
ret i32 0
}