char *oem_supermicro_lan_port_string(unsigned char val) {
  char *p;
  switch (val) {
  case 0:
    p = "Dedicated";
    break;
  case 1:
    p = "Onboard_LAN1";
    break;
  case 2:
    p = "Failover";
    break;
  default:
    p = "unknown";
    break;
  }
  return (p);
}


x86 assembly (clang, -O0):
<oem_supermicro_lan_port_string>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1140 <oem_supermicro_lan_port_string+0x40>
jmp    111e <oem_supermicro_lan_port_string+0x1e>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1150 <oem_supermicro_lan_port_string+0x50>
jmp    112f <oem_supermicro_lan_port_string+0x2f>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1160 <oem_supermicro_lan_port_string+0x60>
jmp    1170 <oem_supermicro_lan_port_string+0x70>
lea    0xeb9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    117b <oem_supermicro_lan_port_string+0x7b>
lea    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    117b <oem_supermicro_lan_port_string+0x7b>
lea    0xeb0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    117b <oem_supermicro_lan_port_string+0x7b>
lea    0xea9(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oem_supermicro_lan_port_string>:
cmp    $0x2,%dil
ja     1119 <oem_supermicro_lan_port_string+0x19>
movsbq %dil,%rax
lea    0xf17(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xf00(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Dedicated\00"
@.str.1 = [13 x i8] c"Onboard_LAN1\00"
@.str.2 = [9 x i8] c"Failover\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @oem_supermicro_lan_port_string(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %9 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
]
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [10 x i8] c"Dedicated\00"
@.str.1 = [13 x i8] c"Onboard_LAN1\00"
@.str.2 = [9 x i8] c"Failover\00"
@.str.3 = [8 x i8] c"unknown\00"
@reltable.oem_supermicro_lan_port_string = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.oem_supermicro_lan_port_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.oem_supermicro_lan_port_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.oem_supermicro_lan_port_string to i64)) to i32)]
define i8* @oem_supermicro_lan_port_string(i8 zeroext %0) {
%2 = icmp ult i8 %0, 3
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i8 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.oem_supermicro_lan_port_string to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %8
}