#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*/ fprintf(int /*<<< orphan*/, char *, unsigned char, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
void decode_rdac_vpd_c9(unsigned char *buff, int len) {
  if (len < 3) {
    fprintf(stderr,
            "Volume Access Control VPD page length too "
            "short=%d\n",
            len);
    return;
  }
  if (buff[4] != 'v' && buff[5] != 'a' && buff[6] != 'c') {
    fprintf(stderr,
            "Invalid page identifier %c%c%c%c, decoding "
            "not possible.\n",
            buff[4], buff[5], buff[6], buff[7]);
    return;
  }
  if (buff[7] != '1') {
    fprintf(stderr, "Invalid page version '%c' (should be 1)\n", buff[7]);
  }
  printf("  AVT:");
  if (buff[8] & 0x80) {
    printf(" Enabled");
    if (buff[8] & 0x40)
      printf(" (Allow reads on sector 0)");
    printf("\n");
  } else {
    printf(" Disabled\n");
  }
  printf("  Volume Access via: ");
  if (buff[8] & 0x01)
    printf("primary controller\n");
  else
    printf("alternate controller\n");
  printf("  Path priority: %d ", buff[9] & 0xf);
  switch (buff[9] & 0xf) {
  case 0x1:
    printf("(preferred path)\n");
    break;
  case 0x2:
    printf("(secondary path)\n");
    break;
  default:
    printf("(unknown)\n");
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<decode_rdac_vpd_c9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    115b <decode_rdac_vpd_c9+0x3b>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%eax
lea    0xeb4(%rip),%rsi
movzbl %al,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1335 <decode_rdac_vpd_c9+0x215>
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%eax
cmp    $0x76,%eax
je     11ce <decode_rdac_vpd_c9+0xae>
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%eax
cmp    $0x61,%eax
je     11ce <decode_rdac_vpd_c9+0xae>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
cmp    $0x63,%eax
je     11ce <decode_rdac_vpd_c9+0xae>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%al
mov    -0x8(%rbp),%rcx
movzbl 0x5(%rcx),%ecx
mov    -0x8(%rbp),%rdx
movzbl 0x6(%rdx),%r8d
mov    -0x8(%rbp),%rdx
movzbl 0x7(%rdx),%r9d
lea    0xe75(%rip),%rsi
movzbl %al,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1335 <decode_rdac_vpd_c9+0x215>
mov    -0x8(%rbp),%rax
movzbl 0x7(%rax),%eax
cmp    $0x31,%eax
je     11fe <decode_rdac_vpd_c9+0xde>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
lea    0xe7b(%rip),%rsi
movzbl 0x7(%rax),%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1265 <decode_rdac_vpd_c9+0x145>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1252 <decode_rdac_vpd_c9+0x132>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1273 <decode_rdac_vpd_c9+0x153>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     12a8 <decode_rdac_vpd_c9+0x188>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b6 <decode_rdac_vpd_c9+0x196>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%esi
and    $0xf,%esi
lea    0xe45(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     12fc <decode_rdac_vpd_c9+0x1dc>
jmp    12eb <decode_rdac_vpd_c9+0x1cb>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     130f <decode_rdac_vpd_c9+0x1ef>
jmp    1322 <decode_rdac_vpd_c9+0x202>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1330 <decode_rdac_vpd_c9+0x210>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1330 <decode_rdac_vpd_c9+0x210>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1335 <decode_rdac_vpd_c9+0x215>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_rdac_vpd_c9>:
push   %rbx
cmp    $0x2,%esi
jg     1162 <decode_rdac_vpd_c9+0x22>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
movzbl %sil,%edx
lea    0xea6(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1060 <fprintf@plt>
mov    %rdi,%rbx
mov    0x4(%rdi),%al
cmp    $0x76,%al
je     1184 <decode_rdac_vpd_c9+0x44>
movzbl 0x5(%rbx),%ecx
cmp    $0x61,%ecx
je     1184 <decode_rdac_vpd_c9+0x44>
movzbl 0x6(%rbx),%r8d
cmp    $0x63,%r8d
jne    1269 <decode_rdac_vpd_c9+0x129>
mov    0x7(%rbx),%al
cmp    $0x31,%al
je     11a5 <decode_rdac_vpd_c9+0x65>
mov    0x2e4e(%rip),%rcx
mov    (%rcx),%edi
movzbl %al,%edx
lea    0xed0(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpb   $0x0,0x8(%rbx)
js     11c7 <decode_rdac_vpd_c9+0x87>
lea    0xf2d(%rip),%rdi
call   1040 <puts@plt>
jmp    11f3 <decode_rdac_vpd_c9+0xb3>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
testb  $0x40,0x8(%rbx)
je     11e9 <decode_rdac_vpd_c9+0xa9>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
testb  $0x1,0x8(%rbx)
lea    0xeeb(%rip),%rax
lea    0xf25(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
movzbl 0x9(%rbx),%esi
and    $0xf,%esi
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x9(%rbx),%eax
and    $0xf,%eax
cmp    $0x2,%eax
je     124f <decode_rdac_vpd_c9+0x10f>
cmp    $0x1,%eax
jne    125c <decode_rdac_vpd_c9+0x11c>
lea    0xed4(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
lea    0xeb6(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
lea    0xecb(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
mov    0x2d70(%rip),%rdx
mov    (%rdx),%edi
movzbl 0x7(%rbx),%r9d
movzbl %al,%edx
lea    0xdb3(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1060 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"Volume Access Control VPD page length too short=%d\0A\00"
@.str.1 = [58 x i8] c"Invalid page identifier %c%c%c%c, decoding not possible.\0A\00"
@.str.2 = [41 x i8] c"Invalid page version '%c' (should be 1)\0A\00"
@.str.3 = [7 x i8] c" AVT:\00"
@.str.4 = [9 x i8] c" Enabled\00"
@.str.5 = [27 x i8] c" (Allow reads on sector 0)\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [11 x i8] c" Disabled\0A\00"
@.str.8 = [22 x i8] c" Volume Access via: \00"
@.str.9 = [20 x i8] c"primary controller\0A\00"
@.str.10 = [22 x i8] c"alternate controller\0A\00"
@.str.11 = [21 x i8] c" Path priority: %d \00"
@.str.12 = [18 x i8] c"(preferred path)\0A\00"
@.str.13 = [18 x i8] c"(secondary path)\0A\00"
@.str.14 = [11 x i8] c"(unknown)\0A\00"
define void @decode_rdac_vpd_c9(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* %4
%10 = trunc i32 %9 to i8
%11 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %113
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 4
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %16, 118
br i1 %17, label %18, label %48
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 5
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = icmp ne i32 %22, 97
br i1 %23, label %24, label %48
24: ; preds = %18
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 6
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = icmp ne i32 %28, 99
br i1 %29, label %30, label %48
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 4
%34 = load i8, i8* %33
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 5
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 6
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 7
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %34, i32 %38, i32 %42, i32 %46)
br label %113
48: ; preds = %24, %18, %12
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 7
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = icmp ne i32 %52, 49
br i1 %53, label %54, label %60
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i64 7
%58 = load i8, i8* %57
%59 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %58)
br label %60
60: ; preds = %54, %48
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i64 8
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = and i32 %65, 128
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %80
68: ; preds = %60
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%70 = load i8*, i8** %3
%71 = getelementptr inbounds i8, i8* %70, i64 8
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = and i32 %73, 64
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %68
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %78
78: ; preds = %76, %68
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %82
80: ; preds = %60
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %82
82: ; preds = %80, %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%84 = load i8*, i8** %3
%85 = getelementptr inbounds i8, i8* %84, i64 8
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
%88 = and i32 %87, 1
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %82
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %94
92: ; preds = %82
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %94
94: ; preds = %92, %90
%95 = load i8*, i8** %3
%96 = getelementptr inbounds i8, i8* %95, i64 9
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
%99 = and i32 %98, 15
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %99)
%101 = load i8*, i8** %3
%102 = getelementptr inbounds i8, i8* %101, i64 9
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = and i32 %104, 15
switch i32 %105, label %110 [
i32 1, label %106
i32 2, label %108
]
106: ; preds = %94
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
br label %112
108: ; preds = %94
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
br label %112
110: ; preds = %94
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
br label %112
112: ; preds = %110, %108, %106
br label %113
113: ; preds = %112, %30, %7
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"Volume Access Control VPD page length too short=%d\0A\00"
@.str.1 = [58 x i8] c"Invalid page identifier %c%c%c%c, decoding not possible.\0A\00"
@.str.2 = [41 x i8] c"Invalid page version '%c' (should be 1)\0A\00"
@.str.3 = [7 x i8] c" AVT:\00"
@.str.4 = [9 x i8] c" Enabled\00"
@.str.5 = [27 x i8] c" (Allow reads on sector 0)\00"
@.str.8 = [22 x i8] c" Volume Access via: \00"
@.str.11 = [21 x i8] c" Path priority: %d \00"
@str = [10 x i8] c" Disabled\00"
@str.15 = [21 x i8] c"alternate controller\00"
@str.16 = [17 x i8] c"(secondary path)\00"
@str.17 = [17 x i8] c"(preferred path)\00"
@str.18 = [10 x i8] c"(unknown)\00"
@str.19 = [19 x i8] c"primary controller\00"
define void @decode_rdac_vpd_c9(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = trunc i32 %1 to i8
%7 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
br label %72
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 118
br i1 %11, label %28, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %0, i64 5
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = icmp eq i8 %14, 97
br i1 %16, label %28, label %17
17: ; preds = %12
%18 = getelementptr inbounds i8, i8* %0, i64 6
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 99
br i1 %20, label %28, label %21
21: ; preds = %17
%22 = zext i8 %19 to i32
%23 = load i32, i32* @stderr
%24 = getelementptr inbounds i8, i8* %0, i64 7
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %10, i32 %15, i32 %22, i32 %26)
br label %72
28: ; preds = %17, %12, %8
%29 = getelementptr inbounds i8, i8* %0, i64 7
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 49
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %30)
br label %35
35: ; preds = %32, %28
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%37 = getelementptr inbounds i8, i8* %0, i64 8
%38 = load i8, i8* %37
%39 = icmp sgt i8 %38, -1
br i1 %39, label %49, label %40
40: ; preds = %35
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%42 = load i8, i8* %37
%43 = and i8 %42, 64
%44 = icmp eq i8 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %40
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %40
%48 = tail call i32 @putchar(i32 10)
br label %51
49: ; preds = %35
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %51
51: ; preds = %49, %47
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%53 = load i8, i8* %37
%54 = and i8 %53, 1
%55 = icmp eq i8 %54, 0
%56 = select i1 %55, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0)
%57 = tail call i32 @puts(i8* dereferenceable(1) %56)
%58 = getelementptr inbounds i8, i8* %0, i64 9
%59 = load i8, i8* %58
%60 = and i8 %59, 15
%61 = zext i8 %60 to i32
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %61)
%63 = load i8, i8* %58
%64 = and i8 %63, 15
%65 = zext i8 %64 to i32
switch i32 %65, label %70 [
i32 1, label %66
i32 2, label %68
]
66: ; preds = %51
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
br label %72
68: ; preds = %51
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.16, i64 0, i64 0))
br label %72
70: ; preds = %51
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0))
br label %72
72: ; preds = %66, %68, %70, %21, %4
ret void
}