#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 *);
int main() {
  int userInput = 0;
  unsigned long number = 0;
  while (1) {
    printf("Please enter a number between 1 and 6:");
    scanf("%d", &userInput);
    unsigned long incrementor = 0;
    switch (userInput) {
    case 1:
      incrementor += 5;
      break;
    case 2:
      incrementor += 9;
      break;
    case 3:
      incrementor += 18;
      break;
    case 4:
      incrementor += 34;
      break;
    case 5:
      incrementor += 59;
      break;
    case 6:
      incrementor += 95;
      break;
    default:
      printf("You have inputed incorrect number!\n");
    }
    number += incrementor;
    printf("Current number : %d \n", number);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     11f3 <main+0xd3>
mov    -0x20(%rbp),%rax
lea    0xe7c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%rax
add    $0x9,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%rax
add    $0x12,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%rax
add    $0x22,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%rax
add    $0x3b,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%rax
add    $0x5f,%rax
mov    %rax,-0x18(%rbp)
jmp    1201 <main+0xe1>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113e <main+0x1e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeb6(%rip),%r14
lea    0xed6(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xecd(%rip),%rbx
lea    0xedc(%rip),%r13
xor    %ebp,%ebp
jmp    118d <main+0x5d>
nopl   0x0(%rax,%rax,1)
cltq
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,8),%rax
add    %rax,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
jb     1170 <main+0x40>
mov    %r13,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    117d <main+0x4d>

LLVM IR (-O0):
@.str = [39 x i8] c"Please enter a number between 1 and 6:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"You have inputed incorrect number!\0A\00"
@.str.3 = [22 x i8] c"Current number : %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %2
store i64 0, i64* %3
br label %5
5: ; preds = %0, %29
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 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* %2)
store i64 0, i64* %4
%8 = load i32, i32* %2
switch i32 %8, label %27 [
i32 1, label %9
i32 2, label %12
i32 3, label %15
i32 4, label %18
i32 5, label %21
i32 6, label %24
]
9: ; preds = %5
%10 = load i64, i64* %4
%11 = add i64 %10, 5
store i64 %11, i64* %4
br label %29
12: ; preds = %5
%13 = load i64, i64* %4
%14 = add i64 %13, 9
store i64 %14, i64* %4
br label %29
15: ; preds = %5
%16 = load i64, i64* %4
%17 = add i64 %16, 18
store i64 %17, i64* %4
br label %29
18: ; preds = %5
%19 = load i64, i64* %4
%20 = add i64 %19, 34
store i64 %20, i64* %4
br label %29
21: ; preds = %5
%22 = load i64, i64* %4
%23 = add i64 %22, 59
store i64 %23, i64* %4
br label %29
24: ; preds = %5
%25 = load i64, i64* %4
%26 = add i64 %25, 95
store i64 %26, i64* %4
br label %29
27: ; preds = %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24, %21, %18, %15, %12, %9
%30 = load i64, i64* %4
%31 = load i64, i64* %3
%32 = add i64 %31, %30
store i64 %32, i64* %3
%33 = load i64, i64* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 %33)
br label %5
}

LLVM IR (-O2):
@.str = [39 x i8] c"Please enter a number between 1 and 6:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"Current number : %d \0A\00"
@str = [35 x i8] c"You have inputed incorrect number!\00"
@switch.table.main = [6 x i64] [i64 5, i64 9, i64 18, i64 34, i64 59, i64 95]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %16, %0
%4 = phi i64 [ 0, %0 ], [ %18, %16 ]
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 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* %1)
%7 = load i32, i32* %1
%8 = add i32 %7, -1
%9 = icmp ult i32 %8, 6
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %16
12: ; preds = %3
%13 = sext i32 %8 to i64
%14 = getelementptr inbounds [6 x i64], [6 x i64]* @switch.table.main, i64 0, i64 %13
%15 = load i64, i64* %14
br label %16
16: ; preds = %12, %10
%17 = phi i64 [ 0, %10 ], [ %15, %12 ]
%18 = add i64 %17, %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 %18)
br label %3
}