#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*/ dStrHex(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *, unsigned char, ...);
int /*<<< orphan*/ stderr;
void decode_power_condition(unsigned char *buff, int len, int do_hex) {
  if (len < 18) {
    fprintf(stderr, "Power condition VPD page length too short=%d\n", len);
    return;
  }
  if (do_hex) {
    dStrHex((const char *)buff, len, 0);
    return;
  }
  printf("  Standby_y=%d Standby_z=%d Idle_c=%d Idle_b=%d Idle_a=%d\n",
         !!(buff[4] & 0x2), !!(buff[4] & 0x1), !!(buff[5] & 0x4),
         !!(buff[5] & 0x2), !!(buff[5] & 0x1));
  printf("  Stopped condition recovery time (ms) %d\n",
         (buff[6] << 8) + buff[7]);
  printf("  Standby_z condition recovery time (ms) %d\n",
         (buff[8] << 8) + buff[9]);
  printf("  Standby_y condition recovery time (ms) %d\n",
         (buff[10] << 8) + buff[11]);
  printf("  Idle_a condition recovery time (ms) %d\n",
         (buff[12] << 8) + buff[13]);
  printf("  Idle_b condition recovery time (ms) %d\n",
         (buff[14] << 8) + buff[15]);
  printf("  Idle_c condition recovery time (ms) %d\n",
         (buff[16] << 8) + buff[17]);
}


x86 assembly (clang, -O0):
<decode_power_condition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x12,-0xc(%rbp)
jge    1169 <decode_power_condition+0x39>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xea1(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1313 <decode_power_condition+0x1e3>
cmpl   $0x0,-0x10(%rbp)
je     1186 <decode_power_condition+0x56>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <dStrHex@plt>
jmp    1313 <decode_power_condition+0x1e3>
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x4(%rcx),%ecx
and    $0x1,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%edx
mov    -0x8(%rbp),%rcx
movzbl 0x5(%rcx),%ecx
and    $0x4,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    -0x8(%rbp),%rsi
movzbl 0x5(%rsi),%esi
and    $0x2,%esi
cmp    $0x0,%esi
setne  %sil
xor    $0xff,%sil
xor    $0xff,%sil
and    $0x1,%sil
movzbl %sil,%r8d
mov    -0x8(%rbp),%rsi
movzbl 0x5(%rsi),%esi
and    $0x1,%esi
cmp    $0x0,%esi
setne  %sil
xor    $0xff,%sil
xor    $0xff,%sil
and    $0x1,%sil
movzbl %sil,%r9d
lea    0xe09(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x7(%rcx),%ecx
add    %ecx,%eax
lea    0xe1e(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x9(%rcx),%ecx
add    %ecx,%eax
lea    0xe23(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0xa(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xb(%rcx),%ecx
add    %ecx,%eax
lea    0xe2a(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0xc(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xd(%rcx),%ecx
add    %ecx,%eax
lea    0xe31(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0xe(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xf(%rcx),%ecx
add    %ecx,%eax
lea    0xe35(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x10(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x11(%rcx),%ecx
add    %ecx,%eax
lea    0xe39(%rip),%rdi
movzbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_power_condition>:
push   %rbx
mov    %esi,%eax
cmp    $0x11,%esi
jg     1150 <decode_power_condition+0x20>
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%edi
lea    0xeb8(%rip),%rsi
mov    %eax,%edx
pop    %rbx
jmp    1050 <fprintf@plt>
mov    %rdi,%rbx
test   %edx,%edx
je     1164 <decode_power_condition+0x34>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
pop    %rbx
jmp    1030 <dStrHex@plt>
movzbl 0x4(%rbx),%edx
mov    %edx,%esi
shr    %esi
and    $0x1,%esi
and    $0x1,%edx
movzbl 0x5(%rbx),%r9d
mov    %r9d,%ecx
shr    $0x2,%ecx
and    $0x1,%ecx
mov    %r9d,%r8d
shr    %r8d
and    $0x1,%r8d
and    $0x1,%r9d
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x7(%rbx),%esi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x9(%rbx),%esi
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xb(%rbx),%esi
lea    0xef6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xd(%rbx),%esi
lea    0xf11(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%rbx),%esi
lea    0xf29(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x11(%rbx),%esi
lea    0xf41(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Power condition VPD page length too short=%d\0A\00"
@.str.1 = [59 x i8] c" Standby_y=%d Standby_z=%d Idle_c=%d Idle_b=%d Idle_a=%d\0A\00"
@.str.2 = [43 x i8] c" Stopped condition recovery time (ms) %d\0A\00"
@.str.3 = [45 x i8] c" Standby_z condition recovery time (ms) %d\0A\00"
@.str.4 = [45 x i8] c" Standby_y condition recovery time (ms) %d\0A\00"
@.str.5 = [42 x i8] c" Idle_a condition recovery time (ms) %d\0A\00"
@.str.6 = [42 x i8] c" Idle_b condition recovery time (ms) %d\0A\00"
@.str.7 = [42 x i8] c" Idle_c condition recovery time (ms) %d\0A\00"
define void @decode_power_condition(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 18
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i32, i32* %5
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %140
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = call i32 @dStrHex(i8* %17, i32 %18, i32 0)
br label %140
20: ; preds = %13
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 4
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = xor i1 %27, true
%29 = zext i1 %28 to i32
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 4
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = and i32 %34, 1
%36 = icmp ne i32 %35, 0
%37 = xor i1 %36, true
%38 = xor i1 %37, true
%39 = zext i1 %38 to i32
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 5
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = and i32 %43, 4
%45 = icmp ne i32 %44, 0
%46 = xor i1 %45, true
%47 = xor i1 %46, true
%48 = zext i1 %47 to i32
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i64 5
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = and i32 %52, 2
%54 = icmp ne i32 %53, 0
%55 = xor i1 %54, true
%56 = xor i1 %55, true
%57 = zext i1 %56 to i32
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 5
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = and i32 %61, 1
%63 = icmp ne i32 %62, 0
%64 = xor i1 %63, true
%65 = xor i1 %64, true
%66 = zext i1 %65 to i32
%67 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %30, i32 %39, i32 %48, i32 %57, i32 %66)
%68 = load i8*, i8** %4
%69 = getelementptr inbounds i8, i8* %68, i64 6
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = shl i32 %71, 8
%73 = load i8*, i8** %4
%74 = getelementptr inbounds i8, i8* %73, i64 7
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = add nsw i32 %72, %76
%78 = trunc i32 %77 to i8
%79 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %78)
%80 = load i8*, i8** %4
%81 = getelementptr inbounds i8, i8* %80, i64 8
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = shl i32 %83, 8
%85 = load i8*, i8** %4
%86 = getelementptr inbounds i8, i8* %85, i64 9
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = add nsw i32 %84, %88
%90 = trunc i32 %89 to i8
%91 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %90)
%92 = load i8*, i8** %4
%93 = getelementptr inbounds i8, i8* %92, i64 10
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = shl i32 %95, 8
%97 = load i8*, i8** %4
%98 = getelementptr inbounds i8, i8* %97, i64 11
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = add nsw i32 %96, %100
%102 = trunc i32 %101 to i8
%103 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %102)
%104 = load i8*, i8** %4
%105 = getelementptr inbounds i8, i8* %104, i64 12
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = shl i32 %107, 8
%109 = load i8*, i8** %4
%110 = getelementptr inbounds i8, i8* %109, i64 13
%111 = load i8, i8* %110
%112 = zext i8 %111 to i32
%113 = add nsw i32 %108, %112
%114 = trunc i32 %113 to i8
%115 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %114)
%116 = load i8*, i8** %4
%117 = getelementptr inbounds i8, i8* %116, i64 14
%118 = load i8, i8* %117
%119 = zext i8 %118 to i32
%120 = shl i32 %119, 8
%121 = load i8*, i8** %4
%122 = getelementptr inbounds i8, i8* %121, i64 15
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = add nsw i32 %120, %124
%126 = trunc i32 %125 to i8
%127 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8 zeroext %126)
%128 = load i8*, i8** %4
%129 = getelementptr inbounds i8, i8* %128, i64 16
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = shl i32 %131, 8
%133 = load i8*, i8** %4
%134 = getelementptr inbounds i8, i8* %133, i64 17
%135 = load i8, i8* %134
%136 = zext i8 %135 to i32
%137 = add nsw i32 %132, %136
%138 = trunc i32 %137 to i8
%139 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8 zeroext %138)
br label %140
140: ; preds = %20, %16, %9
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Power condition VPD page length too short=%d\0A\00"
@.str.1 = [59 x i8] c" Standby_y=%d Standby_z=%d Idle_c=%d Idle_b=%d Idle_a=%d\0A\00"
@.str.2 = [43 x i8] c" Stopped condition recovery time (ms) %d\0A\00"
@.str.3 = [45 x i8] c" Standby_z condition recovery time (ms) %d\0A\00"
@.str.4 = [45 x i8] c" Standby_y condition recovery time (ms) %d\0A\00"
@.str.5 = [42 x i8] c" Idle_a condition recovery time (ms) %d\0A\00"
@.str.6 = [42 x i8] c" Idle_b condition recovery time (ms) %d\0A\00"
@.str.7 = [42 x i8] c" Idle_c condition recovery time (ms) %d\0A\00"
define void @decode_power_condition(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 18
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %46
8: ; preds = %3
%9 = icmp eq i32 %2, 0
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = tail call i32 @dStrHex(i8* %0, i32 %1, i32 0)
br label %46
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %0, i64 4
%14 = load i8, i8* %13
%15 = lshr i8 %14, 1
%16 = and i8 %15, 1
%17 = and i8 %14, 1
%18 = zext i8 %17 to i32
%19 = getelementptr inbounds i8, i8* %0, i64 5
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = lshr i32 %21, 2
%23 = and i32 %22, 1
%24 = lshr i32 %21, 1
%25 = and i32 %24, 1
%26 = and i32 %21, 1
%27 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %16, i32 %18, i32 %23, i32 %25, i32 %26)
%28 = getelementptr inbounds i8, i8* %0, i64 7
%29 = load i8, i8* %28
%30 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %29)
%31 = getelementptr inbounds i8, i8* %0, i64 9
%32 = load i8, i8* %31
%33 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %32)
%34 = getelementptr inbounds i8, i8* %0, i64 11
%35 = load i8, i8* %34
%36 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %35)
%37 = getelementptr inbounds i8, i8* %0, i64 13
%38 = load i8, i8* %37
%39 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %38)
%40 = getelementptr inbounds i8, i8* %0, i64 15
%41 = load i8, i8* %40
%42 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8 zeroext %41)
%43 = getelementptr inbounds i8, i8* %0, i64 17
%44 = load i8, i8* %43
%45 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8 zeroext %44)
br label %46
46: ; preds = %12, %10, %5
ret void
}