#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 */
char const *type_to_string(char type) {
  switch (type) {
  default:
    return "custom";
  case 'b':
    return "boolean";
  case 'B':
    return "boolean";
  case 'c':
    return "char";
  case 'd':
    return "int";
  case 'f':
    return "float";
  case 's':
    return "string";
  }
  return NULL;
}


x86 assembly (clang, -O0):
<type_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x31,%eax
ja     1134 <type_to_string+0x34>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf8d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf84(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf74(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf61(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf55(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <type_to_string+0x9f>
lea    0xf4b(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_to_string>:
lea    0xfc1(%rip),%rax
add    $0xffffffbe,%edi
cmp    $0x31,%edi
ja     1146 <type_to_string+0x46>
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xfa9(%rip),%rax
ret
lea    0xfa9(%rip),%rax
ret
lea    0xfa6(%rip),%rax
ret
lea    0xfa2(%rip),%rax
ret
lea    0xfa0(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"custom\00"
@.str.1 = [8 x i8] c"boolean\00"
@.str.2 = [5 x i8] c"char\00"
@.str.3 = [4 x i8] c"int\00"
@.str.4 = [6 x i8] c"float\00"
@.str.5 = [7 x i8] c"string\00"
define i8* @type_to_string(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %6 [
i32 98, label %7
i32 66, label %8
i32 99, label %9
i32 100, label %10
i32 102, label %11
i32 115, label %12
]
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %13
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
9: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %13
10: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %13
11: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %13
12: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"custom\00"
@.str.1 = [8 x i8] c"boolean\00"
@.str.2 = [5 x i8] c"char\00"
@.str.3 = [4 x i8] c"int\00"
@.str.4 = [6 x i8] c"float\00"
@.str.5 = [7 x i8] c"string\00"
define i8* @type_to_string(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %9 [
i32 98, label %3
i32 66, label %4
i32 99, label %5
i32 100, label %6
i32 102, label %7
i32 115, label %8
]
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %4, %3
%10 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %10
}