#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int reply;
  puts("Enter a number between 1 and 5:");
  scanf("%d", &reply);
  switch (reply) {
  case 0:
    break;
  case 1:
    puts("You entered 1.");
    break;
  case 2:
    puts("You entered 2.");
    break;
  case 3:
    puts("You entered 3.");
    break;
  case 4:
    puts("You entered 4.");
    break;
  case 5:
    puts("You entered 5.");
    break;
  default:
    puts("Out of range, try again\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x5,%rax
ja     11d1 <main+0xb1>
mov    -0x20(%rbp),%rax
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    11dd <main+0xbd>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
jmp    11dd <main+0xbd>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
jmp    11dd <main+0xbd>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
jmp    11dd <main+0xbd>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
jmp    11dd <main+0xbd>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
jmp    11dd <main+0xbd>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x5,%rax
ja     1168 <main+0x48>
lea    0xeec(%rip),%rdi
lea    0xeaa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xee4(%rip),%rdi
jmp    118a <main+0x6a>
lea    0xf17(%rip),%rdi
jmp    118a <main+0x6a>
lea    0xee1(%rip),%rdi
jmp    118a <main+0x6a>
lea    0xee7(%rip),%rdi
jmp    118a <main+0x6a>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Enter a number between 1 and 5:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"You entered 1.\00"
@.str.3 = [15 x i8] c"You entered 2.\00"
@.str.4 = [15 x i8] c"You entered 3.\00"
@.str.5 = [15 x i8] c"You entered 4.\00"
@.str.6 = [15 x i8] c"You entered 5.\00"
@.str.7 = [25 x i8] c"Out of range, try again\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 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* %6)
%9 = load i32, i32* %6
switch i32 %9, label %21 [
i32 0, label %10
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
i32 5, label %19
]
10: ; preds = %2
br label %23
11: ; preds = %2
%12 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %23
13: ; preds = %2
%14 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %23
15: ; preds = %2
%16 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %23
17: ; preds = %2
%18 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %23
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %23
21: ; preds = %2
%22 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %23
23: ; preds = %21, %19, %17, %15, %13, %11, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter a number between 1 and 5:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"You entered 1.\00"
@.str.3 = [15 x i8] c"You entered 2.\00"
@.str.4 = [15 x i8] c"You entered 3.\00"
@.str.5 = [15 x i8] c"You entered 4.\00"
@.str.6 = [15 x i8] c"You entered 5.\00"
@.str.7 = [25 x i8] c"Out of range, try again\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
switch i32 %7, label %12 [
i32 0, label %16
i32 1, label %13
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
]
8: ; preds = %2
br label %13
9: ; preds = %2
br label %13
10: ; preds = %2
br label %13
11: ; preds = %2
br label %13
12: ; preds = %2
br label %13
13: ; preds = %2, %8, %9, %10, %11, %12
%14 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), %12 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %11 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %2 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %2
ret i32 0
}