int get_rom_size(int val) {
  switch (val) {
  case 0x00:
    return 0;
  case 0x01:
    return 4;
  case 0x02:
    return 8;
  case 0x03:
    return 16;
  case 0x04:
    return 32;
  case 0x05:
    return 64;
  case 0x06:
    return 128;
  case 0x07:
    return 256;
  case 0x52:
    return 72;
  case 0x53:
    return 80;
  case 0x54:
    return 96;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_rom_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x54,%rax
ja     11b0 <get_rom_size+0xb0>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x4,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x8,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x10,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x20,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x40,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x80,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x100,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x48,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x50,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x60,-0x4(%rbp)
jmp    11b7 <get_rom_size+0xb7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rom_size>:
xor    %eax,%eax
add    $0xffffffff,%edi
cmp    $0x53,%edi
ja     1155 <get_rom_size+0x55>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x4,%eax
ret
mov    $0x8,%eax
ret
mov    $0x10,%eax
ret
mov    $0x20,%eax
ret
mov    $0x40,%eax
ret
mov    $0x80,%eax
ret
mov    $0x100,%eax
ret
mov    $0x48,%eax
ret
mov    $0x50,%eax
ret
mov    $0x60,%eax
ret

LLVM IR (-O0):
define i32 @get_rom_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %16 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 82, label %13
i32 83, label %14
i32 84, label %15
]
5: ; preds = %1
store i32 0, i32* %2
br label %17
6: ; preds = %1
store i32 4, i32* %2
br label %17
7: ; preds = %1
store i32 8, i32* %2
br label %17
8: ; preds = %1
store i32 16, i32* %2
br label %17
9: ; preds = %1
store i32 32, i32* %2
br label %17
10: ; preds = %1
store i32 64, i32* %2
br label %17
11: ; preds = %1
store i32 128, i32* %2
br label %17
12: ; preds = %1
store i32 256, i32* %2
br label %17
13: ; preds = %1
store i32 72, i32* %2
br label %17
14: ; preds = %1
store i32 80, i32* %2
br label %17
15: ; preds = %1
store i32 96, i32* %2
br label %17
16: ; preds = %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @get_rom_size(i32 %0) {
switch i32 %0, label %12 [
i32 84, label %11
i32 1, label %2
i32 2, label %3
i32 3, label %4
i32 4, label %5
i32 5, label %6
i32 6, label %7
i32 7, label %8
i32 82, label %9
i32 83, label %10
]
2: ; preds = %1
br label %12
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%13 = phi i32 [ 96, %11 ], [ 80, %10 ], [ 72, %9 ], [ 256, %8 ], [ 128, %7 ], [ 64, %6 ], [ 32, %5 ], [ 16, %4 ], [ 8, %3 ], [ 4, %2 ], [ 0, %1 ]
ret i32 %13
}