char *decode_selftest(int stat) {
  unsigned char *s;
  unsigned char b;
  if (stat == 0x0055)
    s = "(OK)";
  else {
    s = "(Error)";
    if ((stat & 0x00ff) == 0x0057) {
      b = ((stat & 0xff00) >> 8);
      if (b & 0x80)
        s = "(No SEL Access)";
      if (b & 0x40)
        s = "(No SDR Access)";
      if (b & 0x20)
        s = "(No FRU Access)";
      if (b & 0x10)
        s = "(IPMB Error)";
      if (b & 0x08)
        s = "(SDR Empty)";
      if (b & 0x02)
        s = "(BootCode Corrupt)";
      if (b & 0x01)
        s = "(OpCode Corrupt)";
    }
  }
  return (s);
}


x86 assembly (clang, -O0):
<decode_selftest>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x55,-0x4(%rbp)
jne    1121 <decode_selftest+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1214 <decode_selftest+0x114>
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
cmp    $0x57,%eax
jne    120f <decode_selftest+0x10f>
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1168 <decode_selftest+0x68>
lea    0xea9(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1183 <decode_selftest+0x83>
lea    0xe9e(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     119e <decode_selftest+0x9e>
lea    0xe93(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11b9 <decode_selftest+0xb9>
lea    0xe88(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11d4 <decode_selftest+0xd4>
lea    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11ef <decode_selftest+0xef>
lea    0xe6b(%rip),%rax
mov    %rax,-0x10(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     120a <decode_selftest+0x10a>
lea    0xe63(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    120f <decode_selftest+0x10f>
jmp    1214 <decode_selftest+0x114>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_selftest>:
cmp    $0x55,%edi
jne    110d <decode_selftest+0xd>
lea    0xef4(%rip),%rax
ret
cmp    $0x57,%dil
jne    1192 <decode_selftest+0x92>
test   $0x8000,%edi
lea    0xee5(%rip),%rax
lea    0xee6(%rip),%rcx
cmove  %rax,%rcx
test   $0x4000,%edi
lea    0xee5(%rip),%rax
cmove  %rcx,%rax
test   $0x2000,%edi
lea    0xee4(%rip),%rcx
cmove  %rax,%rcx
test   $0x1000,%edi
lea    0xee3(%rip),%rax
cmove  %rcx,%rax
test   $0x800,%edi
lea    0xedf(%rip),%rcx
cmove  %rax,%rcx
test   $0x200,%edi
lea    0xeda(%rip),%rdx
cmove  %rcx,%rdx
test   $0x100,%edi
lea    0xedc(%rip),%rax
cmove  %rdx,%rax
ret
lea    0xe6c(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"(OK)\00"
@.str.1 = [8 x i8] c"(Error)\00"
@.str.2 = [16 x i8] c"(No SEL Access)\00"
@.str.3 = [16 x i8] c"(No SDR Access)\00"
@.str.4 = [16 x i8] c"(No FRU Access)\00"
@.str.5 = [13 x i8] c"(IPMB Error)\00"
@.str.6 = [12 x i8] c"(SDR Empty)\00"
@.str.7 = [19 x i8] c"(BootCode Corrupt)\00"
@.str.8 = [17 x i8] c"(OpCode Corrupt)\00"
define i8* @decode_selftest(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 85
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
br label %60
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %3
%9 = load i32, i32* %2
%10 = and i32 %9, 255
%11 = icmp eq i32 %10, 87
br i1 %11, label %12, label %59
12: ; preds = %8
%13 = load i32, i32* %2
%14 = and i32 %13, 65280
%15 = ashr i32 %14, 8
%16 = trunc i32 %15 to i8
store i8 %16, i8* %4
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = and i32 %18, 128
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %12
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %22
22: ; preds = %21, %12
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = and i32 %24, 64
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %28
28: ; preds = %27, %22
%29 = load i8, i8* %4
%30 = zext i8 %29 to i32
%31 = and i32 %30, 32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %28
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %34
34: ; preds = %33, %28
%35 = load i8, i8* %4
%36 = zext i8 %35 to i32
%37 = and i32 %36, 16
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %34
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %40
40: ; preds = %39, %34
%41 = load i8, i8* %4
%42 = zext i8 %41 to i32
%43 = and i32 %42, 8
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %40
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %46
46: ; preds = %45, %40
%47 = load i8, i8* %4
%48 = zext i8 %47 to i32
%49 = and i32 %48, 2
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %46
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %52
52: ; preds = %51, %46
%53 = load i8, i8* %4
%54 = zext i8 %53 to i32
%55 = and i32 %54, 1
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %52
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %58
58: ; preds = %57, %52
br label %59
59: ; preds = %58, %8
br label %60
60: ; preds = %59, %7
%61 = load i8*, i8** %3
ret i8* %61
}

LLVM IR (-O2):
@.str = [5 x i8] c"(OK)\00"
@.str.1 = [8 x i8] c"(Error)\00"
@.str.2 = [16 x i8] c"(No SEL Access)\00"
@.str.3 = [16 x i8] c"(No SDR Access)\00"
@.str.4 = [16 x i8] c"(No FRU Access)\00"
@.str.5 = [13 x i8] c"(IPMB Error)\00"
@.str.6 = [12 x i8] c"(SDR Empty)\00"
@.str.7 = [19 x i8] c"(BootCode Corrupt)\00"
@.str.8 = [17 x i8] c"(OpCode Corrupt)\00"
define i8* @decode_selftest(i32 %0) {
%2 = icmp eq i32 %0, 85
br i1 %2, label %28, label %3
3: ; preds = %1
%4 = and i32 %0, 255
%5 = icmp eq i32 %4, 87
br i1 %5, label %6, label %28
6: ; preds = %3
%7 = and i32 %0, 32768
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0)
%10 = and i32 %0, 16384
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0)
%13 = and i32 %0, 8192
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0)
%16 = and i32 %0, 4096
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0)
%19 = and i32 %0, 2048
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0)
%22 = and i32 %0, 512
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i8* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0)
%25 = and i32 %0, 256
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i8* %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0)
br label %28
28: ; preds = %6, %1, %3
%29 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ %27, %6 ]
ret i8* %29
}