char format_cpu_method(int method) {
  char method_char;
  switch (method) {
  case 0:
    method_char = 'U';
    break;
  case 1:
    method_char = 'I';
    break;
  case 2:
    method_char = 'P';
    break;
  case 7:
    method_char = 'K';
    break;
  case 11:
    method_char = 'M';
    break;
  case 10:
    method_char = 'E';
    break;
  case 3:
    method_char = 'T';
    break;
  case 5:
    method_char = 'R';
    break;
  case 4:
    method_char = 'L';
    break;
  case 6:
    method_char = 'N';
    break;
  case 8:
    method_char = 'S';
    break;
  case 9:
    method_char = 'C';
    break;
  case 12:
    method_char = 'O';
    break;
  default:
    method_char = '?';
  }
  return method_char;
}


x86 assembly (clang, -O0):
<format_cpu_method>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xc,%rax
ja     11a1 <format_cpu_method+0xa1>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x55,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x49,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x50,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x4b,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x4d,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x45,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x54,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x52,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x4c,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x4e,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x53,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x43,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x4f,-0x5(%rbp)
jmp    11a5 <format_cpu_method+0xa5>
movb   $0x3f,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_cpu_method>:
mov    $0x3f,%al
cmp    $0xc,%edi
ja     1114 <format_cpu_method+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
define signext i8 @format_cpu_method(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %18 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 7, label %8
i32 11, label %9
i32 10, label %10
i32 3, label %11
i32 5, label %12
i32 4, label %13
i32 6, label %14
i32 8, label %15
i32 9, label %16
i32 12, label %17
]
5: ; preds = %1
store i8 85, i8* %3
br label %19
6: ; preds = %1
store i8 73, i8* %3
br label %19
7: ; preds = %1
store i8 80, i8* %3
br label %19
8: ; preds = %1
store i8 75, i8* %3
br label %19
9: ; preds = %1
store i8 77, i8* %3
br label %19
10: ; preds = %1
store i8 69, i8* %3
br label %19
11: ; preds = %1
store i8 84, i8* %3
br label %19
12: ; preds = %1
store i8 82, i8* %3
br label %19
13: ; preds = %1
store i8 76, i8* %3
br label %19
14: ; preds = %1
store i8 78, i8* %3
br label %19
15: ; preds = %1
store i8 83, i8* %3
br label %19
16: ; preds = %1
store i8 67, i8* %3
br label %19
17: ; preds = %1
store i8 79, i8* %3
br label %19
18: ; preds = %1
store i8 63, i8* %3
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%20 = load i8, i8* %3
ret i8 %20
}

LLVM IR (-O2):
@switch.table.format_cpu_method = [13 x i8] c"UIPTLRNKSCEMO"
define signext i8 @format_cpu_method(i32 %0) {
%2 = icmp ult i32 %0, 13
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [13 x i8], [13 x i8]* @switch.table.format_cpu_method, i64 0, i64 %4
%6 = load i8, i8* %5
br label %7
7: ; preds = %1, %3
%8 = phi i8 [ %6, %3 ], [ 63, %1 ]
ret i8 %8
}