#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("Give me an int between 1 and 10: ");
  int n = GetInt();
  switch (n) {
  case 1:
  case 2:
  case 3:
    printf("You picked a small int!\n");
    break;
  case 4:
  case 5:
  case 6:
  case 7:
    printf("You picked a medium int!\n");
    break;
  case 8:
  case 9:
  case 10:
    printf("You picked a large int!\n");
    break;
  default:
    printf("You picked an invalid int!\n");
    break;
  }
}


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>
xor    %eax,%eax
call   1040 <GetInt@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1184 <main+0x64>
jmp    115c <main+0x3c>
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x4,%eax
jb     1195 <main+0x75>
jmp    1170 <main+0x50>
mov    -0xc(%rbp),%eax
add    $0xfffffff8,%eax
sub    $0x3,%eax
jb     11a6 <main+0x86>
jmp    11b7 <main+0x97>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <main+0xa3>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <main+0xa3>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <main+0xa3>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
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>
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     115e <main+0x2e>
cltq
lea    0xf33(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1165 <main+0x35>
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"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 ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @GetInt()
store i32 %4, i32* %2
%5 = load i32, i32* %2
switch i32 %5, label %12 [
i32 1, label %6
i32 2, label %6
i32 3, label %6
i32 4, label %8
i32 5, label %8
i32 6, label %8
i32 7, label %8
i32 8, label %10
i32 9, label %10
i32 10, label %10
]
6: ; preds = %0, %0, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %0, %0, %0, %0
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %14
10: ; preds = %0, %0, %0
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [34 x i8] c"Give me an int between 1 and 10: \00"
@str = [24 x i8] c"You picked a large int!\00"
@str.5 = [25 x i8] c"You picked a medium int!\00"
@str.6 = [24 x i8] c"You picked a small int!\00"
@str.7 = [27 x i8] c"You picked an invalid int!\00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @GetInt()
%3 = add i32 %2, -1
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %7)
br label %9
9: ; preds = %0, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.7, i64 0, i64 0), %0 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret i32 0
}