int value(int card) {
  switch (card) {
  case 22:
    return 40;
  case 21:
    return 39;
  case 20:
    return 38;
  case 9:
    return 37;
  case 8:
    return 36;
  case 19:
    return 35;
  case 35:
    return 34;
  case 34:
    return 33;
  case 48:
    return 32;
  case 47:
    return 31;
  case 7:
    return 30;
  case 33:
    return 29;
  case 18:
    return 28;
  case 6:
    return 27;
  case 46:
    return 26;
  case 32:
    return 25;
  case 45:
    return 24;
  case 17:
    return 23;
  case 31:
    return 22;
  case 5:
    return 21;
  case 44:
    return 20;
  case 4:
    return 19;
  case 30:
    return 18;
  case 43:
    return 17;
  case 15:
    return 16;
  case 3:
    return 15;
  case 29:
    return 14;
  case 16:
    return 13;
  case 14:
    return 12;
  case 2:
    return 11;
  case 1:
    return 10;
  case 28:
    return 9;
  case 27:
    return 8;
  case 42:
    return 7;
  case 41:
    return 6;
  case 40:
    return 5;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x2f,%eax
ja     12e0 <value+0x1e0>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x28,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x27,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x26,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x25,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x24,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x23,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x22,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x21,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x20,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1f,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1e,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1d,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1c,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1b,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x1a,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x19,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x18,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x17,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x16,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x15,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x14,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x13,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x12,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x11,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x10,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xf,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xe,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xd,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xc,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xb,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xa,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x9,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x8,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x7,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x6,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0x5,-0x4(%rbp)
jmp    12e7 <value+0x1e7>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<value>:
add    $0xffffffff,%edi
mov    $0xffffffff,%eax
cmp    $0x2f,%edi
ja     111a <value+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @value(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %41 [
i32 22, label %5
i32 21, label %6
i32 20, label %7
i32 9, label %8
i32 8, label %9
i32 19, label %10
i32 35, label %11
i32 34, label %12
i32 48, label %13
i32 47, label %14
i32 7, label %15
i32 33, label %16
i32 18, label %17
i32 6, label %18
i32 46, label %19
i32 32, label %20
i32 45, label %21
i32 17, label %22
i32 31, label %23
i32 5, label %24
i32 44, label %25
i32 4, label %26
i32 30, label %27
i32 43, label %28
i32 15, label %29
i32 3, label %30
i32 29, label %31
i32 16, label %32
i32 14, label %33
i32 2, label %34
i32 1, label %35
i32 28, label %36
i32 27, label %37
i32 42, label %38
i32 41, label %39
i32 40, label %40
]
5: ; preds = %1
store i32 40, i32* %2
br label %42
6: ; preds = %1
store i32 39, i32* %2
br label %42
7: ; preds = %1
store i32 38, i32* %2
br label %42
8: ; preds = %1
store i32 37, i32* %2
br label %42
9: ; preds = %1
store i32 36, i32* %2
br label %42
10: ; preds = %1
store i32 35, i32* %2
br label %42
11: ; preds = %1
store i32 34, i32* %2
br label %42
12: ; preds = %1
store i32 33, i32* %2
br label %42
13: ; preds = %1
store i32 32, i32* %2
br label %42
14: ; preds = %1
store i32 31, i32* %2
br label %42
15: ; preds = %1
store i32 30, i32* %2
br label %42
16: ; preds = %1
store i32 29, i32* %2
br label %42
17: ; preds = %1
store i32 28, i32* %2
br label %42
18: ; preds = %1
store i32 27, i32* %2
br label %42
19: ; preds = %1
store i32 26, i32* %2
br label %42
20: ; preds = %1
store i32 25, i32* %2
br label %42
21: ; preds = %1
store i32 24, i32* %2
br label %42
22: ; preds = %1
store i32 23, i32* %2
br label %42
23: ; preds = %1
store i32 22, i32* %2
br label %42
24: ; preds = %1
store i32 21, i32* %2
br label %42
25: ; preds = %1
store i32 20, i32* %2
br label %42
26: ; preds = %1
store i32 19, i32* %2
br label %42
27: ; preds = %1
store i32 18, i32* %2
br label %42
28: ; preds = %1
store i32 17, i32* %2
br label %42
29: ; preds = %1
store i32 16, i32* %2
br label %42
30: ; preds = %1
store i32 15, i32* %2
br label %42
31: ; preds = %1
store i32 14, i32* %2
br label %42
32: ; preds = %1
store i32 13, i32* %2
br label %42
33: ; preds = %1
store i32 12, i32* %2
br label %42
34: ; preds = %1
store i32 11, i32* %2
br label %42
35: ; preds = %1
store i32 10, i32* %2
br label %42
36: ; preds = %1
store i32 9, i32* %2
br label %42
37: ; preds = %1
store i32 8, i32* %2
br label %42
38: ; preds = %1
store i32 7, i32* %2
br label %42
39: ; preds = %1
store i32 6, i32* %2
br label %42
40: ; preds = %1
store i32 5, i32* %2
br label %42
41: ; preds = %1
store i32 -1, i32* %2
br label %42
42: ; preds = %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@switch.table.value = [48 x i32] [i32 10, i32 11, i32 15, i32 19, i32 21, i32 27, i32 30, i32 36, i32 37, i32 -1, i32 -1, i32 -1, i32 -1, i32 12, i32 16, i32 13, i32 23, i32 28, i32 35, i32 38, i32 39, i32 40, i32 -1, i32 -1, i32 -1, i32 -1, i32 8, i32 9, i32 14, i32 18, i32 22, i32 25, i32 29, i32 33, i32 34, i32 -1, i32 -1, i32 -1, i32 -1, i32 5, i32 6, i32 7, i32 17, i32 20, i32 24, i32 26, i32 31, i32 32]
define i32 @value(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 48
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [48 x i32], [48 x i32]* @switch.table.value, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}