#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 *);
void jump_table_a() {
  int input;
  scanf("%d", &input);
  switch (input) {
  case 0:
    puts("0");
    break;
  case 1:
    puts("1");
    break;
  case 2:
    puts("2");
    break;
  case 3:
    puts("3");
    break;
  case 4:
    puts("4");
    break;
  case 5:
    puts("5");
    break;
  case 6:
    puts("6");
    break;
  case 7:
    puts("7");
    break;
  case 8:
    puts("8");
    break;
  case 9:
    puts("9");
    break;
  case 10:
    puts("10");
    break;
  default:
    puts("other values");
    break;
  }
}


x86 assembly (clang, -O0):
<jump_table_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xefd(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xa,%rax
ja     1218 <jump_table_a+0xf8>
mov    -0x10(%rbp),%rax
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe51(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <jump_table_a+0x104>
lea    0xe25(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jump_table_a>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
cmp    $0xa,%rax
ja     114d <jump_table_a+0x2d>
lea    0xee4(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1154 <jump_table_a+0x34>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"5\00"
@.str.7 = [2 x i8] c"6\00"
@.str.8 = [2 x i8] c"7\00"
@.str.9 = [2 x i8] c"8\00"
@.str.10 = [2 x i8] c"9\00"
@.str.11 = [3 x i8] c"10\00"
@.str.12 = [13 x i8] c"other values\00"
define void @jump_table_a() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
switch i32 %3, label %26 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
i32 10, label %24
]
4: ; preds = %0
%5 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %28
6: ; preds = %0
%7 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %28
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %28
10: ; preds = %0
%11 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %28
12: ; preds = %0
%13 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %28
14: ; preds = %0
%15 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %28
16: ; preds = %0
%17 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %28
18: ; preds = %0
%19 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %28
20: ; preds = %0
%21 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %28
22: ; preds = %0
%23 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %28
24: ; preds = %0
%25 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %28
26: ; preds = %0
%27 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0))
br label %28
28: ; preds = %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"5\00"
@.str.7 = [2 x i8] c"6\00"
@.str.8 = [2 x i8] c"7\00"
@.str.9 = [2 x i8] c"8\00"
@.str.10 = [2 x i8] c"9\00"
@.str.11 = [3 x i8] c"10\00"
@.str.12 = [13 x i8] c"other values\00"
@reltable.jump_table_a = [11 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.7 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.8 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.10 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([11 x i32]* @reltable.jump_table_a to i64)) to i32)]
define void @jump_table_a() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp ult i32 %4, 11
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([11 x i32]* @reltable.jump_table_a to i8*), i64 %8)
br label %10
10: ; preds = %0, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), %0 ]
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret void
}