#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 *flag_type_to_char(int type) {
  switch (type) {
  case 1:
    return ("U");
  case 2:
    return ("C");
  case 4:
    return ("D");
  case 8:
    return ("N");
  case 16:
    return ("P");
  case 32:
    return ("R");
  case 64:
    return ("E");
  }
  return NULL;
}


x86 assembly (clang, -O0):
<flag_type_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3f,%eax
ja     11a0 <flag_type_to_char+0xa0>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfc9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xfbb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xfad(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xf9f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xf91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xf83(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
lea    0xf75(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a8 <flag_type_to_char+0xa8>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_type_to_char>:
add    $0xffffffff,%edi
cmp    $0x3f,%edi
ja     1127 <flag_type_to_char+0x27>
lea    0xff1(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xfdc(%rip),%rax
ret
xor    %eax,%eax
ret
lea    0xfd3(%rip),%rax
ret
lea    0xfcd(%rip),%rax
ret
lea    0xfc9(%rip),%rax
ret
lea    0xfc3(%rip),%rax
ret
lea    0xfb7(%rip),%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"U\00"
@.str.1 = [2 x i8] c"C\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [2 x i8] c"N\00"
@.str.4 = [2 x i8] c"P\00"
@.str.5 = [2 x i8] c"R\00"
@.str.6 = [2 x i8] c"E\00"
define i8* @flag_type_to_char(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %12 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
i32 8, label %8
i32 16, label %9
i32 32, label %10
i32 64, label %11
]
5: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %13
6: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
7: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %13
8: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %13
9: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %13
10: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %13
11: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %13
12: ; preds = %1
store i8* null, i8** %2
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [2 x i8] c"U\00"
@.str.1 = [2 x i8] c"C\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [2 x i8] c"N\00"
@.str.4 = [2 x i8] c"P\00"
@.str.5 = [2 x i8] c"R\00"
@.str.6 = [2 x i8] c"E\00"
define i8* @flag_type_to_char(i32 %0) {
switch i32 %0, label %8 [
i32 1, label %9
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 16, label %5
i32 32, label %6
i32 64, label %7
]
2: ; preds = %1
br label %9
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, %2
%10 = phi i8* [ null, %8 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %10
}