const char *evdns_err_to_string(int err) {
  switch (err) {
  case 0:
    return "no error";
  case 1:
    return "misformatted query";
  case 2:
    return "server failed";
  case 3:
    return "name does not exist";
  case 4:
    return "query not implemented";
  case 5:
    return "refused";
  case 65:
    return "reply truncated or ill-formed";
  case 66:
    return "unknown";
  case 67:
    return "request timed out";
  case 68:
    return "dns subsystem shut down";
  default:
    return "[Unknown error code]";
  }
}


x86 assembly (clang, -O0):
<evdns_err_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x44,%rax
ja     11cc <evdns_err_to_string+0xcc>
mov    -0x18(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfe1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfda(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfdd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfdb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfdf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfe5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfdd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfeb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfe3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfe5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d7 <evdns_err_to_string+0xd7>
lea    0xfed(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<evdns_err_to_string>:
cmp    $0x44,%edi
ja     1146 <evdns_err_to_string+0x46>
lea    0x1008(%rip),%rax
mov    %edi,%ecx
lea    0xeeb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xff8(%rip),%rax
ret
lea    0x1003(%rip),%rax
ret
lea    0x1009(%rip),%rax
ret
lea    0x1015(%rip),%rax
ret
lea    0x1023(%rip),%rax
ret
lea    0x1073(%rip),%rax
ret
lea    0x101b(%rip),%rax
ret
lea    0x1031(%rip),%rax
ret
lea    0x1031(%rip),%rax
ret
lea    0x103b(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"no error\00"
@.str.1 = [19 x i8] c"misformatted query\00"
@.str.2 = [14 x i8] c"server failed\00"
@.str.3 = [20 x i8] c"name does not exist\00"
@.str.4 = [22 x i8] c"query not implemented\00"
@.str.5 = [8 x i8] c"refused\00"
@.str.6 = [30 x i8] c"reply truncated or ill-formed\00"
@.str.7 = [8 x i8] c"unknown\00"
@.str.8 = [18 x i8] c"request timed out\00"
@.str.9 = [24 x i8] c"dns subsystem shut down\00"
@.str.10 = [21 x i8] c"[Unknown error code]\00"
define i8* @evdns_err_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 65, label %11
i32 66, label %12
i32 67, label %13
i32 68, label %14
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
6: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
8: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [9 x i8] c"no error\00"
@.str.1 = [19 x i8] c"misformatted query\00"
@.str.2 = [14 x i8] c"server failed\00"
@.str.3 = [20 x i8] c"name does not exist\00"
@.str.4 = [22 x i8] c"query not implemented\00"
@.str.5 = [8 x i8] c"refused\00"
@.str.6 = [30 x i8] c"reply truncated or ill-formed\00"
@.str.7 = [8 x i8] c"unknown\00"
@.str.8 = [18 x i8] c"request timed out\00"
@.str.9 = [24 x i8] c"dns subsystem shut down\00"
@.str.10 = [21 x i8] c"[Unknown error code]\00"
define i8* @evdns_err_to_string(i32 %0) {
switch i32 %0, label %11 [
i32 0, label %12
i32 1, label %2
i32 2, label %3
i32 3, label %4
i32 4, label %5
i32 5, label %6
i32 65, label %7
i32 66, label %8
i32 67, label %9
i32 68, label %10
]
2: ; preds = %1
br label %12
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%13 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %13
}