char *pgf_to_string(unsigned int _fec) {
  switch (_fec) {
  case 1:
    return "No FEC";
    break;
  case 2:
    return "Hamming code (7, 4)";
    break;
  case 3:
    return "Cyclic code (8, 5)";
    break;
  case 4:
    return "BCH code (15, 5, 7)";
    break;
  case 5:
    return "BCH code (15, 7, 5)";
    break;
  default:
    __pgp_switch_default(__func__,
                         "/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/pfactum/"
                         "pegasus/refs/heads/master/pegasus_fec.c",
                         211);
    return "Unknown";
    break;
  }
}


x86 assembly (clang, -O0):
<pgf_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1194 <pgf_to_string+0x84>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <pgf_to_string+0xa9>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <pgf_to_string+0xa9>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <pgf_to_string+0xa9>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <pgf_to_string+0xa9>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b9 <pgf_to_string+0xa9>
lea    0xecf(%rip),%rdi
lea    0xed6(%rip),%rsi
mov    $0xd3,%edx
mov    $0x0,%al
call   1030 <__pgp_switch_default@plt>
lea    0xf4d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgf_to_string>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x5,%edi
jae    112c <pgf_to_string+0x1c>
movslq %edi,%rax
lea    0xfd5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
lea    0xf23(%rip),%rdi
lea    0xf2a(%rip),%rsi
mov    $0xd3,%edx
xor    %eax,%eax
call   1030 <__pgp_switch_default@plt>
lea    0xfa1(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"No FEC\00"
@.str.1 = [20 x i8] c"Hamming code (7, 4)\00"
@.str.2 = [19 x i8] c"Cyclic code (8, 5)\00"
@.str.3 = [20 x i8] c"BCH code (15, 5, 7)\00"
@.str.4 = [20 x i8] c"BCH code (15, 7, 5)\00"
@__func__.pgf_to_string = [14 x i8] c"pgf_to_string\00"
@.str.5 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pfactum/pegasus/refs/heads/master/pegasus_fec.c\00"
@.str.6 = [8 x i8] c"Unknown\00"
define i8* @pgf_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
]
5: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
6: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
7: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
%11 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @__pgp_switch_default to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.pgf_to_string, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.5, i64 0, i64 0), i32 211)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %10, %9, %8, %7, %6, %5
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"No FEC\00"
@.str.1 = [20 x i8] c"Hamming code (7, 4)\00"
@.str.2 = [19 x i8] c"Cyclic code (8, 5)\00"
@.str.3 = [20 x i8] c"BCH code (15, 5, 7)\00"
@.str.4 = [20 x i8] c"BCH code (15, 7, 5)\00"
@__func__.pgf_to_string = [14 x i8] c"pgf_to_string\00"
@.str.5 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pfactum/pegasus/refs/heads/master/pegasus_fec.c\00"
@.str.6 = [8 x i8] c"Unknown\00"
@reltable.pgf_to_string = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([5 x i32]* @reltable.pgf_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.1 to i64), i64 ptrtoint ([5 x i32]* @reltable.pgf_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.2 to i64), i64 ptrtoint ([5 x i32]* @reltable.pgf_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.pgf_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.4 to i64), i64 ptrtoint ([5 x i32]* @reltable.pgf_to_string to i64)) to i32)]
define i8* @pgf_to_string(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 5
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @__pgp_switch_default to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.pgf_to_string, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.5, i64 0, i64 0), i32 211)
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.pgf_to_string to i8*), i64 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %4 ], [ %9, %6 ]
ret i8* %11
}