char *redund_str(unsigned char b) {
  char *pstr;
  if (b == 0x00)
    pstr = "Disabled";
  else if (b == 0x01)
    pstr = "Fully Redundant";
  else if (b == 0x02)
    pstr = "Redundancy Lost";
  else if (b == 0x0b)
    pstr = "AC Lost";
  else
    pstr = "Redundancy Degraded";
  return (pstr);
}


x86 assembly (clang, -O0):
<redund_str>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1127 <redund_str+0x27>
lea    0xee2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1198 <redund_str+0x98>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1144 <redund_str+0x44>
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1193 <redund_str+0x93>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    1161 <redund_str+0x61>
lea    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    118e <redund_str+0x8e>
movzbl -0x1(%rbp),%eax
cmp    $0xb,%eax
jne    117e <redund_str+0x7e>
lea    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1189 <redund_str+0x89>
lea    0xeac(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    118e <redund_str+0x8e>
jmp    1193 <redund_str+0x93>
jmp    1198 <redund_str+0x98>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<redund_str>:
cmp    $0xb,%dil
ja     112f <redund_str+0x2f>
lea    0xf23(%rip),%rax
mov    %edi,%ecx
lea    0xeea(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf13(%rip),%rax
ret
lea    0xf1b(%rip),%rax
ret
lea    0xf2b(%rip),%rax
ret
lea    0xf1b(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Disabled\00"
@.str.1 = [16 x i8] c"Fully Redundant\00"
@.str.2 = [16 x i8] c"Redundancy Lost\00"
@.str.3 = [8 x i8] c"AC Lost\00"
@.str.4 = [20 x i8] c"Redundancy Degraded\00"
define i8* @redund_str(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
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
br label %27
8: ; preds = %1
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %26
13: ; preds = %8
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %25
18: ; preds = %13
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 11
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %24
23: ; preds = %18
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %24
24: ; preds = %23, %22
br label %25
25: ; preds = %24, %17
br label %26
26: ; preds = %25, %12
br label %27
27: ; preds = %26, %7
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
@.str = [9 x i8] c"Disabled\00"
@.str.1 = [16 x i8] c"Fully Redundant\00"
@.str.2 = [16 x i8] c"Redundancy Lost\00"
@.str.3 = [8 x i8] c"AC Lost\00"
@.str.4 = [20 x i8] c"Redundancy Degraded\00"
define i8* @redund_str(i8 zeroext %0) {
switch i8 %0, label %5 [
i8 0, label %6
i8 1, label %2
i8 2, label %3
i8 11, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %2, %4, %5, %3
%7 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}