#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(void) {
  int increment = 0;
  while (1) {
    int num = 0;
    printf("Enter number (1 - 6)!!!\n");
    scanf("%d", &num);
    switch (num) {
    case 1:
      increment += 5;
      break;
    case 2:
      increment += 9;
      break;
    case 3:
      increment += 18;
      break;
    case 4:
      increment += 34;
      break;
    case 5:
      increment += 59;
      break;
    case 6:
      increment += 95;
      break;
    default:
      printf("!!!Invalid number!!!\n");
      continue;
      break;
    }
    printf("Incremented number: %d\n", increment);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     11d8 <main+0xb8>
mov    -0x18(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x12,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x22,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x3b,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x5f,%eax
mov    %eax,-0x8(%rbp)
jmp    11eb <main+0xcb>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed9(%rip),%r14
lea    0xeb7(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xeae(%rip),%r12
lea    0xed7(%rip),%r13
xor    %ebp,%ebp
jmp    1168 <main+0x38>
mov    %r13,%rdi
call   1030 <puts@plt>
movl   $0x0,0x4(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
jae    1160 <main+0x30>
cltq
lea    0xeb0(%rip),%rcx
add    (%rcx,%rax,4),%ebp
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1168 <main+0x38>

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [24 x i8] c"Incremented number: %d\0A\00"
@str = [24 x i8] c"Enter number (1 - 6)!!!\00"
@str.4 = [21 x i8] c"!!!Invalid number!!!\00"
@switch.table.main = [6 x i32] [i32 5, i32 9, i32 18, i32 34, i32 59, i32 95]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %18, %0
%4 = phi i32 [ 0, %0 ], [ %19, %18 ]
store i32 0, i32* %1
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 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 ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
br label %18
12: ; preds = %3
%13 = sext i32 %8 to i64
%14 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.main, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %4, %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12, %10
%19 = phi i32 [ %4, %10 ], [ %16, %12 ]
br label %3
}