char *ft_formattyp(c)
char c;
{
  switch (c) {
  case 'L':
    return "c";
  case 'X':
    return "x";
  case 'B':
    return "ud";
  case 'I':
    return "d";
  case 'J':
    return "d";
  case 'K':
    return "lld";
  case 'U':
    return "ud";
  case 'V':
    return "ud";
  case 'F':
    return "f";
  case 'E':
    return "f";
  case 'D':
    return "f";
  case 'A':
    return "s";
  case 'C':
    return "f";
  case 'M':
    return "f";
  case 'P':
    return "x";
  case 'G':
    return "f";
  }
  return "";
}


x86 assembly (clang, -O0):
<ft_formattyp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     1234 <ft_formattyp+0x134>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf25(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xf17(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xf09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xeee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xedc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xeb9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe82(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe70(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe47(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe40(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <ft_formattyp+0x13f>
lea    0xe26(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_formattyp>:
movsbl %dil,%eax
add    $0xffffffbf,%eax
cmp    $0x17,%eax
ja     111d <ft_formattyp+0x1d>
cltq
lea    0xefb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xedd(%rip),%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"c\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [3 x i8] c"ud\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [4 x i8] c"lld\00"
@.str.5 = [2 x i8] c"f\00"
@.str.6 = [2 x i8] c"s\00"
@.str.7 = [1 x i8] zeroinitializer
define i8* @ft_formattyp(i32 %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %23 [
i32 76, label %7
i32 88, label %8
i32 66, label %9
i32 73, label %10
i32 74, label %11
i32 75, label %12
i32 85, label %13
i32 86, label %14
i32 70, label %15
i32 69, label %16
i32 68, label %17
i32 65, label %18
i32 67, label %19
i32 77, label %20
i32 80, label %21
i32 71, label %22
]
7: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %24
8: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %24
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
10: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %24
11: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %24
12: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %24
13: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
14: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
15: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
16: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
17: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
18: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %24
19: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
20: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
21: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %24
22: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %24
23: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %24
24: ; preds = %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
@.str = [2 x i8] c"c\00"
@.str.1 = [2 x i8] c"x\00"
@.str.2 = [3 x i8] c"ud\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [4 x i8] c"lld\00"
@.str.5 = [2 x i8] c"f\00"
@.str.6 = [2 x i8] c"s\00"
@.str.7 = [1 x i8] zeroinitializer
@reltable.ft_formattyp = [24 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([24 x i32]* @reltable.ft_formattyp to i64)) to i32)]
define i8* @ft_formattyp(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = add nsw i32 %3, -65
%5 = icmp ult i32 %4, 24
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([24 x i32]* @reltable.ft_formattyp to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), %1 ]
ret i8* %11
}