char *FruTypeString(unsigned char frutype, unsigned char dev) {
  char *pstr;
  switch (frutype) {
  case 0x07:
  case 0x0c:
    if (dev == 0)
      pstr = "Baseboard";
    else
      pstr = "Board    ";
    break;
  case 0x0a:
    pstr = "PowerSply";
    break;
  case 0x15:
    pstr = "PowerCage";
    break;
  case 0x20:
    pstr = "DIMM     ";
    break;
  case 0x0f:
    pstr = "HotSwapCt";
    break;
  case 0x2e:
    pstr = "ME       ";
    break;
  case 0x40:
    pstr = "SysInfo  ";
    break;
  default:
    pstr = "Component";
    break;
  }
  return (pstr);
}


x86 assembly (clang, -O0):
<FruTypeString>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xfffffff9,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x39,%eax
ja     11c7 <FruTypeString+0xc7>
mov    -0x18(%rbp),%rax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movzbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1157 <FruTypeString+0x57>
lea    0xf9a(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1162 <FruTypeString+0x62>
lea    0xf94(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf8e(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf88(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf82(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf7c(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf76(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf70(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <FruTypeString+0xd2>
lea    0xf6a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FruTypeString>:
add    $0xf9,%dil
cmp    $0x39,%dil
ja     113b <FruTypeString+0x3b>
lea    0xfeb(%rip),%rax
movzbl %dil,%ecx
lea    0xee4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
test   %sil,%sil
lea    0xfb9(%rip),%rcx
lea    0xfbc(%rip),%rax
cmove  %rcx,%rax
ret
lea    0xff6(%rip),%rax
ret
lea    0xfd0(%rip),%rax
ret
lea    0xfb4(%rip),%rax
ret
lea    0xfb6(%rip),%rax
ret
lea    0xfc2(%rip),%rax
ret
lea    0xfc4(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Baseboard\00"
@.str.1 = [10 x i8] c"Board \00"
@.str.2 = [10 x i8] c"PowerSply\00"
@.str.3 = [10 x i8] c"PowerCage\00"
@.str.4 = [10 x i8] c"DIMM \00"
@.str.5 = [10 x i8] c"HotSwapCt\00"
@.str.6 = [10 x i8] c"ME \00"
@.str.7 = [10 x i8] c"SysInfo \00"
@.str.8 = [10 x i8] c"Component\00"
define i8* @FruTypeString(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
switch i32 %7, label %21 [
i32 7, label %8
i32 12, label %8
i32 10, label %15
i32 21, label %16
i32 32, label %17
i32 15, label %18
i32 46, label %19
i32 64, label %20
]
8: ; preds = %2, %2
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %5
br label %14
13: ; preds = %8
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %14
14: ; preds = %13, %12
br label %22
15: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %22
16: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %22
17: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %22
18: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %5
br label %22
19: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %22
20: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %5
br label %22
21: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %5
br label %22
22: ; preds = %21, %20, %19, %18, %17, %16, %15, %14
%23 = load i8*, i8** %5
ret i8* %23
}

LLVM IR (-O2):
@.str = [10 x i8] c"Baseboard\00"
@.str.1 = [10 x i8] c"Board \00"
@.str.2 = [10 x i8] c"PowerSply\00"
@.str.3 = [10 x i8] c"PowerCage\00"
@.str.4 = [10 x i8] c"DIMM \00"
@.str.5 = [10 x i8] c"HotSwapCt\00"
@.str.6 = [10 x i8] c"ME \00"
@.str.7 = [10 x i8] c"SysInfo \00"
@.str.8 = [10 x i8] c"Component\00"
define i8* @FruTypeString(i8 zeroext %0, i8 zeroext %1) {
switch i8 %0, label %11 [
i8 7, label %3
i8 12, label %3
i8 10, label %12
i8 21, label %6
i8 32, label %7
i8 15, label %8
i8 46, label %9
i8 64, label %10
]
3: ; preds = %2, %2
%4 = icmp eq i8 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
br label %12
6: ; preds = %2
br label %12
7: ; preds = %2
br label %12
8: ; preds = %2
br label %12
9: ; preds = %2
br label %12
10: ; preds = %2
br label %12
11: ; preds = %2
br label %12
12: ; preds = %2, %3, %11, %10, %9, %8, %7, %6
%13 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %6 ], [ %5, %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %2 ]
ret i8* %13
}