const char *dnssec_alg_printname(int alg) {
  switch (alg) {
  case 1:
    return "RSAMD5";
  case 2:
    return "DH";
  case 3:
    return "DSA";
  case 4:
    return "ECC";
  case 5:
    return "RSASHA1";
  case 6:
    return "DSA-NSEC3-SHA1";
  case 7:
    return "RSASHA1-NSEC3-SHA1";
  case 8:
    return "RSASHA256";
  case 10:
    return "RSASHA512";
  case 12:
    return "ECC-GOST";
  case 252:
    return "INDIRECT";
  case 253:
    return "PRIVATEDNS";
  case 254:
    return "PRIVATEOID";
  }
  return "Unknown";
}


x86 assembly (clang, -O0):
<dnssec_alg_printname>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11ed <dnssec_alg_printname+0xed>
jmp    111b <dnssec_alg_printname+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11fd <dnssec_alg_printname+0xfd>
jmp    112c <dnssec_alg_printname+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     120d <dnssec_alg_printname+0x10d>
jmp    113d <dnssec_alg_printname+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     121d <dnssec_alg_printname+0x11d>
jmp    114e <dnssec_alg_printname+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     122d <dnssec_alg_printname+0x12d>
jmp    115f <dnssec_alg_printname+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
je     123d <dnssec_alg_printname+0x13d>
jmp    1170 <dnssec_alg_printname+0x70>
mov    -0x10(%rbp),%eax
sub    $0x7,%eax
je     124d <dnssec_alg_printname+0x14d>
jmp    1181 <dnssec_alg_printname+0x81>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     125d <dnssec_alg_printname+0x15d>
jmp    1192 <dnssec_alg_printname+0x92>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     126d <dnssec_alg_printname+0x16d>
jmp    11a3 <dnssec_alg_printname+0xa3>
mov    -0x10(%rbp),%eax
sub    $0xc,%eax
je     127d <dnssec_alg_printname+0x17d>
jmp    11b4 <dnssec_alg_printname+0xb4>
mov    -0x10(%rbp),%eax
sub    $0xfc,%eax
je     128d <dnssec_alg_printname+0x18d>
jmp    11c7 <dnssec_alg_printname+0xc7>
mov    -0x10(%rbp),%eax
sub    $0xfd,%eax
je     129d <dnssec_alg_printname+0x19d>
jmp    11da <dnssec_alg_printname+0xda>
mov    -0x10(%rbp),%eax
sub    $0xfe,%eax
je     12ad <dnssec_alg_printname+0x1ad>
jmp    12bd <dnssec_alg_printname+0x1bd>
lea    0xe0c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xe03(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdf6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdea(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdde(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdd6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdd5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdd8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdd2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdcc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdc5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdbe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdb9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12c8 <dnssec_alg_printname+0x1c8>
lea    0xdb4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnssec_alg_printname>:
cmp    $0xfb,%edi
jg     1133 <dnssec_alg_printname+0x33>
add    $0xffffffff,%edi
cmp    $0xb,%edi
ja     11a3 <dnssec_alg_printname+0xa3>
lea    0xf15(%rip),%rax
lea    0xede(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf05(%rip),%rax
ret
cmp    $0xfc,%edi
je     1193 <dnssec_alg_printname+0x93>
cmp    $0xfd,%edi
je     119b <dnssec_alg_printname+0x9b>
cmp    $0xfe,%edi
jne    11a3 <dnssec_alg_printname+0xa3>
lea    0xf4b(%rip),%rax
ret
lea    0xee0(%rip),%rax
ret
lea    0xedc(%rip),%rax
ret
lea    0xed8(%rip),%rax
ret
lea    0xed8(%rip),%rax
ret
lea    0xedf(%rip),%rax
ret
lea    0xeea(%rip),%rax
ret
lea    0xeec(%rip),%rax
ret
lea    0xeee(%rip),%rax
ret
lea    0xeef(%rip),%rax
ret
lea    0xef0(%rip),%rax
ret
lea    0xefe(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"RSAMD5\00"
@.str.1 = [3 x i8] c"DH\00"
@.str.2 = [4 x i8] c"DSA\00"
@.str.3 = [4 x i8] c"ECC\00"
@.str.4 = [8 x i8] c"RSASHA1\00"
@.str.5 = [15 x i8] c"DSA-NSEC3-SHA1\00"
@.str.6 = [19 x i8] c"RSASHA1-NSEC3-SHA1\00"
@.str.7 = [10 x i8] c"RSASHA256\00"
@.str.8 = [10 x i8] c"RSASHA512\00"
@.str.9 = [9 x i8] c"ECC-GOST\00"
@.str.10 = [9 x i8] c"INDIRECT\00"
@.str.11 = [11 x i8] c"PRIVATEDNS\00"
@.str.12 = [11 x i8] c"PRIVATEOID\00"
@.str.13 = [8 x i8] c"Unknown\00"
define i8* @dnssec_alg_printname(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %18 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
i32 6, label %10
i32 7, label %11
i32 8, label %12
i32 10, label %13
i32 12, label %14
i32 252, label %15
i32 253, label %16
i32 254, label %17
]
5: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %19
14: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %19
18: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [7 x i8] c"RSAMD5\00"
@.str.1 = [3 x i8] c"DH\00"
@.str.2 = [4 x i8] c"DSA\00"
@.str.3 = [4 x i8] c"ECC\00"
@.str.4 = [8 x i8] c"RSASHA1\00"
@.str.5 = [15 x i8] c"DSA-NSEC3-SHA1\00"
@.str.6 = [19 x i8] c"RSASHA1-NSEC3-SHA1\00"
@.str.7 = [10 x i8] c"RSASHA256\00"
@.str.8 = [10 x i8] c"RSASHA512\00"
@.str.9 = [9 x i8] c"ECC-GOST\00"
@.str.10 = [9 x i8] c"INDIRECT\00"
@.str.11 = [11 x i8] c"PRIVATEDNS\00"
@.str.12 = [11 x i8] c"PRIVATEOID\00"
@.str.13 = [8 x i8] c"Unknown\00"
define i8* @dnssec_alg_printname(i32 %0) {
switch i32 %0, label %14 [
i32 1, label %15
i32 2, label %2
i32 3, label %3
i32 4, label %4
i32 5, label %5
i32 6, label %6
i32 7, label %7
i32 8, label %8
i32 10, label %9
i32 12, label %10
i32 252, label %11
i32 253, label %12
i32 254, label %13
]
2: ; preds = %1
br label %15
3: ; preds = %1
br label %15
4: ; preds = %1
br label %15
5: ; preds = %1
br label %15
6: ; preds = %1
br label %15
7: ; preds = %1
br label %15
8: ; preds = %1
br label %15
9: ; preds = %1
br label %15
10: ; preds = %1
br label %15
11: ; preds = %1
br label %15
12: ; preds = %1
br label %15
13: ; preds = %1
br label %15
14: ; preds = %1
br label %15
15: ; preds = %1, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%16 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}