const char *filter_name(unsigned int filt_id) {
  if (filt_id == 0x01)
    return ("Black & White");
  else if (filt_id == 0x02)
    return ("TV Scanlines");
  else if (filt_id == 0x04)
    return ("Horizontal Blur");
  else if (filt_id == 0x08)
    return ("Vertical Blur");
  else if (filt_id == 0x10)
    return ("Misaligned Green");
  else if (filt_id == 0x20)
    return ("Slow Fade");
  else if (filt_id == 0x40)
    return ("PAL Chroma Distortion");
  else if (!filt_id)
    return ("Unfiltered");
  else
    return ("Error");
}


x86 assembly (clang, -O0):
<filter_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1121 <filter_name+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x2,-0xc(%rbp)
jne    113b <filter_name+0x3b>
lea    0xedc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x4,-0xc(%rbp)
jne    1155 <filter_name+0x55>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x8,-0xc(%rbp)
jne    116f <filter_name+0x6f>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x10,-0xc(%rbp)
jne    1189 <filter_name+0x89>
lea    0xeb9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x20,-0xc(%rbp)
jne    11a3 <filter_name+0xa3>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x40,-0xc(%rbp)
jne    11bd <filter_name+0xbd>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
cmpl   $0x0,-0xc(%rbp)
jne    11d7 <filter_name+0xd7>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e2 <filter_name+0xe2>
lea    0xe97(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_name>:
cmp    $0x40,%edi
ja     112e <filter_name+0x2e>
lea    0xff8(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x1049(%rip),%rax
ret
lea    0xfe5(%rip),%rax
ret
lea    0x1044(%rip),%rax
ret
lea    0xfe2(%rip),%rax
ret
lea    0xfea(%rip),%rax
ret
lea    0xff0(%rip),%rax
ret
lea    0xff9(%rip),%rax
ret
lea    0xffb(%rip),%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Black & White\00"
@.str.1 = [13 x i8] c"TV Scanlines\00"
@.str.2 = [16 x i8] c"Horizontal Blur\00"
@.str.3 = [14 x i8] c"Vertical Blur\00"
@.str.4 = [17 x i8] c"Misaligned Green\00"
@.str.5 = [10 x i8] c"Slow Fade\00"
@.str.6 = [22 x i8] c"PAL Chroma Distortion\00"
@.str.7 = [11 x i8] c"Unfiltered\00"
@.str.8 = [6 x i8] c"Error\00"
define i8* @filter_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %36
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %36
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %36
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 8
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %36
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 16
br i1 %21, label %22, label %23
22: ; preds = %19
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %36
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %27
26: ; preds = %23
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %36
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 64
br i1 %29, label %30, label %31
30: ; preds = %27
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %36
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp ne i32 %32, 0
br i1 %33, label %35, label %34
34: ; preds = %31
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %36
35: ; preds = %31
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %36
36: ; preds = %35, %34, %30, %26, %22, %18, %14, %10, %6
%37 = load i8*, i8** %2
ret i8* %37
}

LLVM IR (-O2):
@.str = [14 x i8] c"Black & White\00"
@.str.1 = [13 x i8] c"TV Scanlines\00"
@.str.2 = [16 x i8] c"Horizontal Blur\00"
@.str.3 = [14 x i8] c"Vertical Blur\00"
@.str.4 = [17 x i8] c"Misaligned Green\00"
@.str.5 = [10 x i8] c"Slow Fade\00"
@.str.6 = [22 x i8] c"PAL Chroma Distortion\00"
@.str.7 = [11 x i8] c"Unfiltered\00"
@.str.8 = [6 x i8] c"Error\00"
define i8* @filter_name(i32 %0) {
switch i32 %0, label %9 [
i32 1, label %10
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 16, label %5
i32 32, label %6
i32 64, label %7
i32 0, label %8
]
2: ; preds = %1
br label %10
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}