int gui_color_attr_get_flag(char c) {
  if (c == '*')
    return 0x0200000;
  if (c == '!')
    return 0x0400000;
  if (c == '/')
    return 0x0800000;
  if (c == '_')
    return 0x1000000;
  if (c == '|')
    return 0x2000000;
  return 0;
}


x86 assembly (clang, -O0):
<gui_color_attr_get_flag>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
jne    1123 <gui_color_attr_get_flag+0x23>
movl   $0x200000,-0x4(%rbp)
jmp    118e <gui_color_attr_get_flag+0x8e>
movsbl -0x5(%rbp),%eax
cmp    $0x21,%eax
jne    113c <gui_color_attr_get_flag+0x3c>
movl   $0x400000,-0x4(%rbp)
jmp    118e <gui_color_attr_get_flag+0x8e>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    1155 <gui_color_attr_get_flag+0x55>
movl   $0x800000,-0x4(%rbp)
jmp    118e <gui_color_attr_get_flag+0x8e>
movsbl -0x5(%rbp),%eax
cmp    $0x5f,%eax
jne    116e <gui_color_attr_get_flag+0x6e>
movl   $0x1000000,-0x4(%rbp)
jmp    118e <gui_color_attr_get_flag+0x8e>
movsbl -0x5(%rbp),%eax
cmp    $0x7c,%eax
jne    1187 <gui_color_attr_get_flag+0x87>
movl   $0x2000000,-0x4(%rbp)
jmp    118e <gui_color_attr_get_flag+0x8e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_color_attr_get_flag>:
cmp    $0x2e,%dil
jle    111e <gui_color_attr_get_flag+0x1e>
cmp    $0x2f,%dil
je     1130 <gui_color_attr_get_flag+0x30>
cmp    $0x5f,%dil
je     1136 <gui_color_attr_get_flag+0x36>
cmp    $0x7c,%dil
jne    1142 <gui_color_attr_get_flag+0x42>
mov    $0x2000000,%eax
ret
cmp    $0x21,%dil
je     113c <gui_color_attr_get_flag+0x3c>
mov    $0x200000,%eax
cmp    $0x2a,%dil
jne    1142 <gui_color_attr_get_flag+0x42>
ret
mov    $0x800000,%eax
ret
mov    $0x1000000,%eax
ret
mov    $0x400000,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @gui_color_attr_get_flag(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 42
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 2097152, i32* %2
br label %29
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 33
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 4194304, i32* %2
br label %29
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 8388608, i32* %2
br label %29
18: ; preds = %13
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 95
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 16777216, i32* %2
br label %29
23: ; preds = %18
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 124
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 33554432, i32* %2
br label %29
28: ; preds = %23
store i32 0, i32* %2
br label %29
29: ; preds = %28, %27, %22, %17, %12, %7
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @gui_color_attr_get_flag(i8 signext %0) {
switch i8 %0, label %6 [
i8 42, label %7
i8 33, label %2
i8 47, label %3
i8 95, label %4
i8 124, label %5
]
2: ; preds = %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3, %2
%8 = phi i32 [ 4194304, %2 ], [ 8388608, %3 ], [ 16777216, %4 ], [ 33554432, %5 ], [ 0, %6 ], [ 2097152, %1 ]
ret i32 %8
}