#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 GetInt();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Please give me an int between 1 and 10: ");
  int n = GetInt();
  if (n >= 1 && n <= 3) {
    printf("You picked a small int!\n");
  } else if (n >= 4 && n <= 7) {
    printf("You picked a medium int!\n");
  } else if (n >= 8 && n <= 10) {
    printf("You picked a large int!\n");
  } else {
    printf("You picked an invalid int!\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>
mov    $0x0,%al
call   1040 <GetInt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     116a <main+0x4a>
cmpl   $0x3,-0x8(%rbp)
jg     116a <main+0x4a>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
cmpl   $0x4,-0x8(%rbp)
jl     118f <main+0x6f>
cmpl   $0x7,-0x8(%rbp)
jg     118f <main+0x6f>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
cmpl   $0x8,-0x8(%rbp)
jl     11b4 <main+0x94>
cmpl   $0xa,-0x8(%rbp)
jg     11b4 <main+0x94>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    11c0 <main+0xa0>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
jmp    11ca <main+0xaa>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <GetInt@plt>
lea    -0x1(%rax),%ecx
cmp    $0x3,%ecx
jae    1155 <main+0x25>
lea    0xf22(%rip),%rdi
jmp    1180 <main+0x50>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
cmp    $0x4,%ecx
jne    1168 <main+0x38>
lea    0xef6(%rip),%rdi
jmp    1180 <main+0x50>
add    $0xfffffff8,%eax
cmp    $0x3,%eax
lea    0xecf(%rip),%rax
lea    0xead(%rip),%rdi
cmovb  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Please give me an int between 1 and 10: \00"
@.str.1 = [25 x i8] c"You picked a small int!\0A\00"
@.str.2 = [26 x i8] c"You picked a medium int!\0A\00"
@.str.3 = [25 x i8] c"You picked a large int!\0A\00"
@.str.4 = [28 x i8] c"You picked an invalid int!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @GetInt()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %32
12: ; preds = %7, %0
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 4
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 7
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %31
20: ; preds = %15, %12
%21 = load i32, i32* %2
%22 = icmp sge i32 %21, 8
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp sle i32 %24, 10
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %30
28: ; preds = %23, %20
%29 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %18
br label %32
32: ; preds = %31, %10
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [41 x i8] c"Please give me an int between 1 and 10: \00"
@str = [27 x i8] c"You picked an invalid int!\00"
@str.5 = [24 x i8] c"You picked a large int!\00"
@str.6 = [25 x i8] c"You picked a medium int!\00"
@str.7 = [24 x i8] c"You picked a small int!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @GetInt()
%3 = add i32 %2, -1
%4 = icmp ult i32 %3, 3
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = and i32 %2, -4
%7 = icmp eq i32 %6, 4
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = add i32 %2, -8
%10 = icmp ult i32 %9, 3
%11 = select i1 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0)
br label %12
12: ; preds = %8, %5, %0
%13 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0), %0 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0), %5 ], [ %11, %8 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
ret i32 0
}