#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_c3(unsigned char *buff, int len) {
  if (len < 0x2c) {
    fprintf(stderr,
            "Feature parameters VPD page length too "
            "short=%d\n",
            len);
    return;
  }
  if (buff[4] != 'p' && buff[5] != 'r' && buff[6] != 'm') {
    fprintf(stderr,
            "Invalid page identifier %c%c%c%c, decoding "
            "not possible.\n",
            buff[4], buff[5], buff[6], buff[7]);
    return;
  }
  printf("  Maximum number of drives per LUN: %d\n", buff[8]);
  printf("  Maximum number of hot spare drives: %d\n", buff[9]);
  printf("  UTM: %s\n", buff[11] & 0x80 ? "enabled" : "disabled");
  if ((buff[11] & 0x80))
    printf("    UTM LUN: %02x\n", buff[11] & 0x7f);
  return;
}


x86 assembly (clang, -O0):
<decode_rdac_vpd_c3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2c,-0xc(%rbp)
jge    115b <decode_rdac_vpd_c3+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    125f <decode_rdac_vpd_c3+0x13f>
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%eax
cmp    $0x70,%eax
je     11ce <decode_rdac_vpd_c3+0xae>
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%eax
cmp    $0x72,%eax
je     11ce <decode_rdac_vpd_c3+0xae>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%eax
cmp    $0x6d,%eax
je     11ce <decode_rdac_vpd_c3+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    0xe72(%rip),%rsi
movzbl %al,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    125f <decode_rdac_vpd_c3+0x13f>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0xb(%rax),%ecx
and    $0x80,%ecx
lea    0xec1(%rip),%rsi
lea    0xeb2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0xb(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     125a <decode_rdac_vpd_c3+0x13a>
mov    -0x8(%rbp),%rax
movzbl 0xb(%rax),%esi
and    $0x7f,%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125f <decode_rdac_vpd_c3+0x13f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_rdac_vpd_c3>:
push   %rbx
cmp    $0x2b,%esi
jg     1142 <decode_rdac_vpd_c3+0x22>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
movzbl %sil,%edx
lea    0xec6(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <fprintf@plt>
mov    %rdi,%rbx
mov    0x4(%rdi),%al
cmp    $0x70,%al
je     1160 <decode_rdac_vpd_c3+0x40>
movzbl 0x5(%rbx),%ecx
cmp    $0x72,%ecx
je     1160 <decode_rdac_vpd_c3+0x40>
movzbl 0x6(%rbx),%r8d
cmp    $0x6d,%r8d
jne    11c6 <decode_rdac_vpd_c3+0xa6>
movzbl 0x8(%rbx),%esi
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl 0x9(%rbx),%esi
lea    0xf16(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpb   $0x0,0xb(%rbx)
lea    0xf41(%rip),%rax
lea    0xf32(%rip),%rsi
cmovns %rax,%rsi
lea    0xf1c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl 0xb(%rbx),%esi
test   $0x80,%sil
jne    11b4 <decode_rdac_vpd_c3+0x94>
pop    %rbx
ret
and    $0x7f,%esi
lea    0xf1b(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
mov    0x2e13(%rip),%rdx
mov    (%rdx),%edi
movzbl 0x7(%rbx),%r9d
movzbl %al,%edx
lea    0xe53(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"Feature parameters 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 = [40 x i8] c" Maximum number of drives per LUN: %d\0A\00"
@.str.3 = [42 x i8] c" Maximum number of hot spare drives: %d\0A\00"
@.str.4 = [11 x i8] c" UTM: %s\0A\00"
@.str.5 = [8 x i8] c"enabled\00"
@.str.6 = [9 x i8] c"disabled\00"
@.str.7 = [19 x i8] c" UTM LUN: %02x\0A\00"
define void @decode_rdac_vpd_c3(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, 44
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 ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %82
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, 112
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, 114
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, 109
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 %82
48: ; preds = %24, %18, %12
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 8
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i64 9
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i64 11
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = and i32 %62, 128
%64 = icmp ne i32 %63, 0
%65 = zext i1 %64 to i64
%66 = select i1 %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %66)
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i64 11
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = and i32 %71, 128
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %81
74: ; preds = %48
%75 = load i8*, i8** %3
%76 = getelementptr inbounds i8, i8* %75, i64 11
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = and i32 %78, 127
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %74, %48
br label %82
82: ; preds = %81, %30, %7
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"Feature parameters 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 = [40 x i8] c" Maximum number of drives per LUN: %d\0A\00"
@.str.3 = [42 x i8] c" Maximum number of hot spare drives: %d\0A\00"
@.str.4 = [11 x i8] c" UTM: %s\0A\00"
@.str.5 = [8 x i8] c"enabled\00"
@.str.6 = [9 x i8] c"disabled\00"
@.str.7 = [19 x i8] c" UTM LUN: %02x\0A\00"
define void @decode_rdac_vpd_c3(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 44
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 ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
br label %49
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 112
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, 114
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, 109
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 %49
28: ; preds = %17, %12, %8
%29 = getelementptr inbounds i8, i8* %0, i64 8
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds i8, i8* %0, i64 9
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds i8, i8* %0, i64 11
%38 = load i8, i8* %37
%39 = icmp sgt i8 %38, -1
%40 = select i1 %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %40)
%42 = load i8, i8* %37
%43 = zext i8 %42 to i32
%44 = and i32 %43, 128
%45 = icmp eq i32 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %28
%47 = and i32 %43, 127
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %28, %46, %21, %4
ret void
}