#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*/ decode_designation_descriptor(unsigned char const *, int,
                                                 int /*<<< orphan*/, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int decode_block_lb_prov_vpd(unsigned char *b, int len) {
  int dp;
  if (len < 4) {
    fprintf(stderr, "Logical block provisioning page too short=%d\n", len);
    return 97;
  }
  printf("  Unmap command supported (LBPU): %d\n", !!(0x80 & b[5]));
  printf("  Write same (16) with unmap bit supported (LBWS): %d\n",
         !!(0x40 & b[5]));
  printf("  Write same (10) with unmap bit supported (LBWS10): %d\n",
         !!(0x20 & b[5]));
  printf("  Logical block provisioning read zeros (LBPRZ): %d\n",
         !!(0x4 & b[5]));
  printf("  Anchored LBAs supported (ANC_SUP): %d\n", !!(0x2 & b[5]));
  printf("  Threshold exponent: %d\n", b[4]);
  dp = !!(b[5] & 0x1);
  printf("  Descriptor present: %d\n", dp);
  printf("  Provisioning type: %d\n", b[6] & 0x7);
  if (dp) {
    const unsigned char *ucp;
    int i_len;
    ucp = b + 8;
    i_len = ucp[3];
    if (0 == i_len) {
      fprintf(stderr,
              "Logical block provisioning page provisioning "
              "group descriptor too short=%d\n",
              i_len);
      return 0;
    }
    printf("  Provisioning group descriptor\n");
    decode_designation_descriptor(ucp, i_len, 0, 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<decode_block_lb_prov_vpd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    116d <decode_block_lb_prov_vpd+0x3d>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xea4(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x61,-0x4(%rbp)
jmp    130c <decode_block_lb_prov_vpd+0x1dc>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x4(%rax),%esi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl 0x6(%rax),%esi
and    $0x7,%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     1305 <decode_block_lb_prov_vpd+0x1d5>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
jne    12e4 <decode_block_lb_prov_vpd+0x1b4>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%edx
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    130c <decode_block_lb_prov_vpd+0x1dc>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1050 <decode_designation_descriptor@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_block_lb_prov_vpd>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x3,%esi
jg     116b <decode_block_lb_prov_vpd+0x2b>
mov    %esi,%edx
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x61,%r14d
jmp    1270 <decode_block_lb_prov_vpd+0x130>
mov    %rdi,%rbx
movzbl 0x5(%rdi),%esi
shr    $0x7,%esi
lea    0xeb2(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rbx),%esi
shr    $0x6,%esi
and    $0x1,%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rbx),%esi
shr    $0x5,%esi
and    $0x1,%esi
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rbx),%esi
shr    $0x2,%esi
and    $0x1,%esi
lea    0xefd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rbx),%esi
shr    %esi
and    $0x1,%esi
lea    0xf1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x4(%rbx),%esi
lea    0xf32(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%rbx),%ebp
mov    %ebp,%esi
and    $0x1,%esi
lea    0xf35(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x6(%rbx),%esi
and    $0x7,%esi
lea    0xf3a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
and    $0x1,%ebp
je     1270 <decode_block_lb_prov_vpd+0x130>
movzbl 0xb(%rbx),%ebp
test   %ebp,%ebp
je     1256 <decode_block_lb_prov_vpd+0x116>
add    $0x8,%rbx
lea    0xf80(%rip),%rdi
call   1030 <puts@plt>
xor    %r14d,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1060 <decode_designation_descriptor@plt>
jmp    1270 <decode_block_lb_prov_vpd+0x130>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
lea    0xf09(%rip),%rsi
xor    %r14d,%r14d
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Logical block provisioning page too short=%d\0A\00"
@.str.1 = [38 x i8] c" Unmap command supported (LBPU): %d\0A\00"
@.str.2 = [55 x i8] c" Write same (16) with unmap bit supported (LBWS): %d\0A\00"
@.str.3 = [57 x i8] c" Write same (10) with unmap bit supported (LBWS10): %d\0A\00"
@.str.4 = [53 x i8] c" Logical block provisioning read zeros (LBPRZ): %d\0A\00"
@.str.5 = [41 x i8] c" Anchored LBAs supported (ANC_SUP): %d\0A\00"
@.str.6 = [26 x i8] c" Threshold exponent: %d\0A\00"
@.str.7 = [26 x i8] c" Descriptor present: %d\0A\00"
@.str.8 = [25 x i8] c" Provisioning type: %d\0A\00"
@.str.9 = [76 x i8] c"Logical block provisioning page provisioning group descriptor too short=%d\0A\00"
@.str.10 = [33 x i8] c" Provisioning group descriptor\0A\00"
define i32 @decode_block_lb_prov_vpd(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i32, i32* %5
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 97, i32* %3
br label %109
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 5
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 128, %19
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 5
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = and i32 64, %29
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = xor i1 %32, true
%34 = zext i1 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 5
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = and i32 32, %39
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = xor i1 %42, true
%44 = zext i1 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 5
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = and i32 4, %49
%51 = icmp ne i32 %50, 0
%52 = xor i1 %51, true
%53 = xor i1 %52, true
%54 = zext i1 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i64 5
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = and i32 2, %59
%61 = icmp ne i32 %60, 0
%62 = xor i1 %61, true
%63 = xor i1 %62, true
%64 = zext i1 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = load i8*, i8** %4
%67 = getelementptr inbounds i8, i8* %66, i64 4
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %69)
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i64 5
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = and i32 %74, 1
%76 = icmp ne i32 %75, 0
%77 = xor i1 %76, true
%78 = xor i1 %77, true
%79 = zext i1 %78 to i32
store i32 %79, i32* %6
%80 = load i32, i32* %6
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %80)
%82 = load i8*, i8** %4
%83 = getelementptr inbounds i8, i8* %82, i64 6
%84 = load i8, i8* %83
%85 = zext i8 %84 to i32
%86 = and i32 %85, 7
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %86)
%88 = load i32, i32* %6
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %108
90: ; preds = %15
%91 = load i8*, i8** %4
%92 = getelementptr inbounds i8, i8* %91, i64 8
store i8* %92, i8** %7
%93 = load i8*, i8** %7
%94 = getelementptr inbounds i8, i8* %93, i64 3
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
store i32 %96, i32* %8
%97 = load i32, i32* %8
%98 = icmp eq i32 0, %97
br i1 %98, label %99, label %103
99: ; preds = %90
%100 = load i32, i32* @stderr
%101 = load i32, i32* %8
%102 = call i32 @fprintf(i32 %100, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.9, i64 0, i64 0), i32 %101)
store i32 0, i32* %3
br label %109
103: ; preds = %90
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%105 = load i8*, i8** %7
%106 = load i32, i32* %8
%107 = call i32 @decode_designation_descriptor(i8* %105, i32 %106, i32 0, i32 1)
br label %108
108: ; preds = %103, %15
store i32 0, i32* %3
br label %109
109: ; preds = %108, %99, %11
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Logical block provisioning page too short=%d\0A\00"
@.str.1 = [38 x i8] c" Unmap command supported (LBPU): %d\0A\00"
@.str.2 = [55 x i8] c" Write same (16) with unmap bit supported (LBWS): %d\0A\00"
@.str.3 = [57 x i8] c" Write same (10) with unmap bit supported (LBWS10): %d\0A\00"
@.str.4 = [53 x i8] c" Logical block provisioning read zeros (LBPRZ): %d\0A\00"
@.str.5 = [41 x i8] c" Anchored LBAs supported (ANC_SUP): %d\0A\00"
@.str.6 = [26 x i8] c" Threshold exponent: %d\0A\00"
@.str.7 = [26 x i8] c" Descriptor present: %d\0A\00"
@.str.8 = [25 x i8] c" Provisioning type: %d\0A\00"
@.str.9 = [76 x i8] c"Logical block provisioning page provisioning group descriptor too short=%d\0A\00"
@str = [32 x i8] c" Provisioning group descriptor\00"
define i32 @decode_block_lb_prov_vpd(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %59
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %0, i64 5
%9 = load i8, i8* %8
%10 = lshr i8 %9, 7
%11 = zext i8 %10 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i8, i8* %8
%14 = lshr i8 %13, 6
%15 = and i8 %14, 1
%16 = zext i8 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i8, i8* %8
%19 = lshr i8 %18, 5
%20 = and i8 %19, 1
%21 = zext i8 %20 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i8, i8* %8
%24 = lshr i8 %23, 2
%25 = and i8 %24, 1
%26 = zext i8 %25 to i32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i8, i8* %8
%29 = lshr i8 %28, 1
%30 = and i8 %29, 1
%31 = zext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds i8, i8* %0, i64 4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%37 = load i8, i8* %8
%38 = and i8 %37, 1
%39 = icmp eq i8 %38, 0
%40 = zext i8 %38 to i32
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds i8, i8* %0, i64 6
%43 = load i8, i8* %42
%44 = and i8 %43, 7
%45 = zext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %45)
br i1 %39, label %59, label %47
47: ; preds = %7
%48 = getelementptr inbounds i8, i8* %0, i64 11
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* @stderr
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.9, i64 0, i64 0), i32 0)
br label %59
54: ; preds = %47
%55 = zext i8 %49 to i32
%56 = getelementptr inbounds i8, i8* %0, i64 8
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%58 = tail call i32 @decode_designation_descriptor(i8* %56, i32 %55, i32 0, i32 1)
br label %59
59: ; preds = %51, %54, %7, %4
%60 = phi i32 [ 97, %4 ], [ 0, %7 ], [ 0, %54 ], [ 0, %51 ]
ret i32 %60
}