#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);
int key_sizes(int type) {
  switch (type) {
  case 265:
    return 4;
  case 266:
    return 4;
  case 267:
    return 8;
  case 264:
    return sizeof(double);
  case 268:
    return sizeof(float);
  case 271:
    return sizeof(char);
  case 272:
    return sizeof(unsigned char);
  default:
    printf("key_sizes error, bad type %d\n", type);
    return 0;
  }
}


x86 assembly (clang, -O0):
<key_sizes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffef8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x8,%eax
ja     119a <key_sizes+0x8a>
mov    -0x10(%rbp),%rax
lea    0xec3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x4,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x8,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x8,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x4,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <key_sizes+0xa0>
mov    -0x8(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_sizes>:
push   %rax
mov    %edi,%esi
lea    -0x108(%rsi),%eax
cmp    $0x9,%eax
jae    1128 <key_sizes+0x18>
mov    $0x19f,%ecx
bt     %eax,%ecx
jb     1138 <key_sizes+0x28>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
cltq
lea    0xedf(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"key_sizes error, bad type %d\0A\00"
define i32 @key_sizes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %12 [
i32 265, label %5
i32 266, label %6
i32 267, label %7
i32 264, label %8
i32 268, label %9
i32 271, label %10
i32 272, label %11
]
5: ; preds = %1
store i32 4, i32* %2
br label %15
6: ; preds = %1
store i32 4, i32* %2
br label %15
7: ; preds = %1
store i32 8, i32* %2
br label %15
8: ; preds = %1
store i32 8, i32* %2
br label %15
9: ; preds = %1
store i32 4, i32* %2
br label %15
10: ; preds = %1
store i32 1, i32* %2
br label %15
11: ; preds = %1
store i32 1, i32* %2
br label %15
12: ; preds = %1
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 0, i32* %2
br label %15
15: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [30 x i8] c"key_sizes error, bad type %d\0A\00"
@switch.table.key_sizes = [9 x i32] [i32 8, i32 4, i32 4, i32 8, i32 4, i32 4, i32 4, i32 1, i32 1]
define i32 @key_sizes(i32 %0) {
%2 = add i32 %0, -264
%3 = icmp ult i32 %2, 9
br i1 %3, label %6, label %4
4: ; preds = %6, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %15
6: ; preds = %1
%7 = trunc i32 %2 to i16
%8 = lshr i16 415, %7
%9 = and i16 %8, 1
%10 = icmp eq i16 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %6
%12 = sext i32 %2 to i64
%13 = getelementptr inbounds [9 x i32], [9 x i32]* @switch.table.key_sizes, i64 0, i64 %12
%14 = load i32, i32* %13
br label %15
15: ; preds = %11, %4
%16 = phi i32 [ 0, %4 ], [ %14, %11 ]
ret i32 %16
}