#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int check_statword(unsigned char stat[]) {
  int ret = 0;
  if (stat[0] == 0x82) {
    ret = 16;
    return ret;
  } else if ((stat[0] & 0x04) == 0x04) {
    printf("Configuration Change error\n");
    ret = 10;
    return ret;
  } else if ((stat[0] & 0x40) == 0x40) {
    ret = 14;
    return ret;
  } else if ((stat[0] & 0x80) == 0x80) {
    ret = 15;
    return ret;
  } else if ((stat[0] & 0x20) == 0x20) {
    ret = 13;
    return ret;
  } else if ((stat[0] & 0x10) == 0x10) {
    ret = 12;
    return ret;
  } else if ((stat[0] & 0x08) == 0x08) {
    ret = 11;
    return ret;
  }
  return ret;
}


x86 assembly (clang, -O0):
<check_statword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x82,%eax
jne    1147 <check_statword+0x37>
movl   $0x10,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x4,%eax
cmp    $0x4,%eax
jne    1178 <check_statword+0x68>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x40,%eax
cmp    $0x40,%eax
jne    119d <check_statword+0x8d>
movl   $0xe,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x80,%eax
cmp    $0x80,%eax
jne    11c6 <check_statword+0xb6>
movl   $0xf,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x20,%eax
cmp    $0x20,%eax
jne    11eb <check_statword+0xdb>
movl   $0xd,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x10,%eax
cmp    $0x10,%eax
jne    1210 <check_statword+0x100>
movl   $0xc,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x8,%eax
cmp    $0x8,%eax
jne    1235 <check_statword+0x125>
movl   $0xb,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1259 <check_statword+0x149>
jmp    123a <check_statword+0x12a>
jmp    123f <check_statword+0x12f>
jmp    1244 <check_statword+0x134>
jmp    1249 <check_statword+0x139>
jmp    124e <check_statword+0x13e>
jmp    1253 <check_statword+0x143>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_statword>:
push   %rax
movzbl (%rdi),%ecx
mov    $0x10,%eax
cmp    $0x82,%ecx
jne    1123 <check_statword+0x13>
pop    %rcx
ret
test   $0x4,%cl
jne    115d <check_statword+0x4d>
mov    $0xe,%eax
test   $0x40,%cl
jne    1121 <check_statword+0x11>
mov    $0xf,%eax
test   $0x80,%cl
jne    1121 <check_statword+0x11>
mov    $0xd,%eax
test   $0x20,%cl
jne    1121 <check_statword+0x11>
mov    $0xc,%eax
test   $0x10,%cl
jne    1121 <check_statword+0x11>
shl    $0x1c,%ecx
sar    $0x1f,%ecx
and    $0xb,%ecx
mov    %ecx,%eax
pop    %rcx
ret
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Configuration Change error\0A\00"
define i32 @check_statword(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 130
br i1 %9, label %10, label %12
10: ; preds = %1
store i32 16, i32* %4
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %75
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = and i32 %16, 4
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %4
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %75
22: ; preds = %12
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = and i32 %26, 64
%28 = icmp eq i32 %27, 64
br i1 %28, label %29, label %31
29: ; preds = %22
store i32 14, i32* %4
%30 = load i32, i32* %4
store i32 %30, i32* %2
br label %75
31: ; preds = %22
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = and i32 %35, 128
%37 = icmp eq i32 %36, 128
br i1 %37, label %38, label %40
38: ; preds = %31
store i32 15, i32* %4
%39 = load i32, i32* %4
store i32 %39, i32* %2
br label %75
40: ; preds = %31
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = and i32 %44, 32
%46 = icmp eq i32 %45, 32
br i1 %46, label %47, label %49
47: ; preds = %40
store i32 13, i32* %4
%48 = load i32, i32* %4
store i32 %48, i32* %2
br label %75
49: ; preds = %40
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i64 0
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = and i32 %53, 16
%55 = icmp eq i32 %54, 16
br i1 %55, label %56, label %58
56: ; preds = %49
store i32 12, i32* %4
%57 = load i32, i32* %4
store i32 %57, i32* %2
br label %75
58: ; preds = %49
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i64 0
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = and i32 %62, 8
%64 = icmp eq i32 %63, 8
br i1 %64, label %65, label %67
65: ; preds = %58
store i32 11, i32* %4
%66 = load i32, i32* %4
store i32 %66, i32* %2
br label %75
67: ; preds = %58
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
br label %73
73: ; preds = %72
%74 = load i32, i32* %4
store i32 %74, i32* %2
br label %75
75: ; preds = %73, %65, %56, %47, %38, %29, %19, %10
%76 = load i32, i32* %2
ret i32 %76
}

LLVM IR (-O2):
@str = [27 x i8] c"Configuration Change error\00"
define i32 @check_statword(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = icmp eq i8 %2, -126
br i1 %4, label %26, label %5
5: ; preds = %1
%6 = and i32 %3, 4
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %26
10: ; preds = %5
%11 = and i32 %3, 64
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = and i32 %3, 128
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = and i32 %3, 32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = and i32 %3, 16
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = and i32 %3, 8
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i32 0, i32 11
br label %26
26: ; preds = %22, %19, %16, %13, %10, %1, %8
%27 = phi i32 [ 10, %8 ], [ 16, %1 ], [ 14, %10 ], [ 15, %13 ], [ 13, %16 ], [ 12, %19 ], [ %25, %22 ]
ret i32 %27
}