char *debug_mask_txt(int mask) {
  switch (mask) {
  case 0x0040:
    return "EMM: ";
  case 0x0010:
    return "IFD: ";
  case 0x0001:
    return "TRACE: ";
  case 0x0020:
    return "IO: ";
  default:
    return "";
  }
}


x86 assembly (clang, -O0):
<debug_mask_txt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     116e <debug_mask_txt+0x6e>
jmp    111b <debug_mask_txt+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     115e <debug_mask_txt+0x5e>
jmp    112c <debug_mask_txt+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     117e <debug_mask_txt+0x7e>
jmp    113d <debug_mask_txt+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
jne    118e <debug_mask_txt+0x8e>
jmp    114e <debug_mask_txt+0x4e>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <debug_mask_txt+0x99>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <debug_mask_txt+0x99>
lea    0xe97(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <debug_mask_txt+0x99>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <debug_mask_txt+0x99>
lea    0xe76(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_mask_txt>:
cmp    $0x1f,%edi
jg     1117 <debug_mask_txt+0x17>
cmp    $0x1,%edi
je     1131 <debug_mask_txt+0x31>
cmp    $0x10,%edi
jne    1129 <debug_mask_txt+0x29>
lea    0xef0(%rip),%rax
ret
cmp    $0x20,%edi
je     1139 <debug_mask_txt+0x39>
cmp    $0x40,%edi
jne    1129 <debug_mask_txt+0x29>
lea    0xed8(%rip),%rax
ret
lea    0xedb(%rip),%rax
ret
lea    0xed4(%rip),%rax
ret
lea    0xed4(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"EMM: \00"
@.str.1 = [6 x i8] c"IFD: \00"
@.str.2 = [8 x i8] c"TRACE: \00"
@.str.3 = [5 x i8] c"IO: \00"
@.str.4 = [1 x i8] zeroinitializer
define i8* @debug_mask_txt(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 64, label %5
i32 16, label %6
i32 1, label %7
i32 32, label %8
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [6 x i8] c"EMM: \00"
@.str.1 = [6 x i8] c"IFD: \00"
@.str.2 = [8 x i8] c"TRACE: \00"
@.str.3 = [5 x i8] c"IO: \00"
@.str.4 = [1 x i8] zeroinitializer
define i8* @debug_mask_txt(i32 %0) {
switch i32 %0, label %5 [
i32 64, label %6
i32 16, label %2
i32 1, label %3
i32 32, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}