#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 */
size_t element_length(char type) {
  switch (type) {
  case 'C':
    return (sizeof(char));
  case 'U':
    return (sizeof(unsigned char));
  case 'H':
    return (sizeof(unsigned short));
  case 'S':
    return (sizeof(short));
  case 'I':
    return (sizeof(int));
  case 'L':
    return (sizeof(long));
  case 'F':
    return (sizeof(float));
  case 'D':
    return (sizeof(double));
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<element_length>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x12,%eax
ja     119c <element_length+0x9c>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x1,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x1,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x2,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x2,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x4,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x8,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x4,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x8,-0x8(%rbp)
jmp    11a4 <element_length+0xa4>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_length>:
add    $0xffffffbd,%edi
cmp    $0x12,%edi
ja     1117 <element_length+0x17>
movslq %edi,%rax
lea    0xeee(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @element_length(i8 signext %0) {
%2 = alloca i64
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 67, label %6
i32 85, label %7
i32 72, label %8
i32 83, label %9
i32 73, label %10
i32 76, label %11
i32 70, label %12
i32 68, label %13
]
6: ; preds = %1
store i64 1, i64* %2
br label %15
7: ; preds = %1
store i64 1, i64* %2
br label %15
8: ; preds = %1
store i64 2, i64* %2
br label %15
9: ; preds = %1
store i64 2, i64* %2
br label %15
10: ; preds = %1
store i64 4, i64* %2
br label %15
11: ; preds = %1
store i64 8, i64* %2
br label %15
12: ; preds = %1
store i64 4, i64* %2
br label %15
13: ; preds = %1
store i64 8, i64* %2
br label %15
14: ; preds = %1
store i64 0, i64* %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
@switch.table.element_length = [19 x i64] [i64 1, i64 8, i64 0, i64 4, i64 0, i64 2, i64 4, i64 0, i64 0, i64 8, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 2, i64 0, i64 1]
define i64 @element_length(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -67
%4 = icmp ult i32 %3, 19
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [19 x i64], [19 x i64]* @switch.table.element_length, i64 0, i64 %6
%8 = load i64, i64* %7
br label %9
9: ; preds = %1, %5
%10 = phi i64 [ %8, %5 ], [ 0, %1 ]
ret i64 %10
}