#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 *, int);
int /*<<< orphan*/ printf(char *, unsigned char *);
int /*<<< orphan*/ stderr;
void decode_firm_vpd_c0_sea(unsigned char *buff, int len) {
  if (len < 28) {
    fprintf(stderr,
            "Seagate firmware numbers VPD page length too "
            "short=%d\n",
            len);
    return;
  }
  if (28 == len) {
    printf("  SCSI firmware release number: %.8s\n", buff + 4);
    printf("  Servo ROM release number: %.8s\n", buff + 20);
  } else {
    printf("  SCSI firmware release number: %.8s\n", buff + 4);
    printf("  Servo ROM release number: %.8s\n", buff + 12);
    printf("  SAP block point numbers (major/minor): %.8s\n", buff + 20);
    if (len < 36)
      return;
    printf("  Servo firmware release date: %.4s\n", buff + 28);
    printf("  Servo ROM release date: %.4s\n", buff + 32);
    if (len < 44)
      return;
    printf("  SAP firmware release number: %.8s\n", buff + 36);
    if (len < 52)
      return;
    printf("  SAP firmware release date: %.4s\n", buff + 44);
    printf("  SAP firmware release year: %.4s\n", buff + 48);
    if (len < 60)
      return;
    printf("  SAP manufacturing key: %.4s\n", buff + 52);
    printf("  Servo firmware product family and product family "
           "member: %.4s\n",
           buff + 56);
  }
}


x86 assembly (clang, -O0):
<decode_firm_vpd_c0_sea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1c,-0xc(%rbp)
jge    1156 <decode_firm_vpd_c0_sea+0x36>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xeb4(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    $0x1c,%eax
cmp    -0xc(%rbp),%eax
jne    1191 <decode_firm_vpd_c0_sea+0x71>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x14,%rsi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0xc,%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x14,%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x24,-0xc(%rbp)
jge    11dc <decode_firm_vpd_c0_sea+0xbc>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    -0x8(%rbp),%rsi
add    $0x1c,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x20,%rsi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2c,-0xc(%rbp)
jge    1213 <decode_firm_vpd_c0_sea+0xf3>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    -0x8(%rbp),%rsi
add    $0x24,%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x34,-0xc(%rbp)
jge    1236 <decode_firm_vpd_c0_sea+0x116>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    -0x8(%rbp),%rsi
add    $0x2c,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x30,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3c,-0xc(%rbp)
jge    126d <decode_firm_vpd_c0_sea+0x14d>
jmp    1295 <decode_firm_vpd_c0_sea+0x175>
mov    -0x8(%rbp),%rsi
add    $0x34,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x38,%rsi
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_firm_vpd_c0_sea>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
cmp    $0x1b,%esi
jg     1147 <decode_firm_vpd_c0_sea+0x27>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>
mov    %rdi,%rbx
lea    0x4(%rdi),%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x1c,%ebp
jne    1178 <decode_firm_vpd_c0_sea+0x58>
add    $0x14,%rbx
lea    0xef3(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>
lea    0xc(%rbx),%rsi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0x14(%rbx),%rsi
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x24,%ebp
jb     11fc <decode_firm_vpd_c0_sea+0xdc>
lea    0x1c(%rbx),%rsi
lea    0xf06(%rip),%rdi
call   1030 <printf@plt>
lea    0x20(%rbx),%rsi
lea    0xf1b(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x2c,%ebp
jb     11fc <decode_firm_vpd_c0_sea+0xdc>
lea    0x24(%rbx),%rsi
lea    0xf26(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x34,%ebp
jb     11fc <decode_firm_vpd_c0_sea+0xdc>
lea    0x2c(%rbx),%rsi
lea    0xf36(%rip),%rdi
call   1030 <printf@plt>
lea    0x30(%rbx),%rsi
lea    0xf49(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x3c,%ebp
jae    1203 <decode_firm_vpd_c0_sea+0xe3>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0x34(%rbx),%rsi
lea    0xf50(%rip),%rdi
call   1030 <printf@plt>
add    $0x38,%rbx
lea    0xf5f(%rip),%rdi
jmp    116a <decode_firm_vpd_c0_sea+0x4a>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [55 x i8] c"Seagate firmware numbers VPD page length too short=%d\0A\00"
@.str.1 = [38 x i8] c" SCSI firmware release number: %.8s\0A\00"
@.str.2 = [34 x i8] c" Servo ROM release number: %.8s\0A\00"
@.str.3 = [47 x i8] c" SAP block point numbers (major/minor): %.8s\0A\00"
@.str.4 = [37 x i8] c" Servo firmware release date: %.4s\0A\00"
@.str.5 = [32 x i8] c" Servo ROM release date: %.4s\0A\00"
@.str.6 = [37 x i8] c" SAP firmware release number: %.8s\0A\00"
@.str.7 = [35 x i8] c" SAP firmware release date: %.4s\0A\00"
@.str.8 = [35 x i8] c" SAP firmware release year: %.4s\0A\00"
@.str.9 = [31 x i8] c" SAP manufacturing key: %.4s\0A\00"
@.str.10 = [65 x i8] c" Servo firmware product family and product family member: %.4s\0A\00"
define void @decode_firm_vpd_c0_sea(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, 28
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* %4
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %68
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 28, %12
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 4
%17 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 20
%20 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %68
21: ; preds = %11
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 4
%24 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 12
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 20
%30 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 36
br i1 %32, label %33, label %34
33: ; preds = %21
br label %68
34: ; preds = %21
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 28
%37 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 32
%40 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %39)
%41 = load i32, i32* %4
%42 = icmp slt i32 %41, 44
br i1 %42, label %43, label %44
43: ; preds = %34
br label %68
44: ; preds = %34
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 36
%47 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%48 = load i32, i32* %4
%49 = icmp slt i32 %48, 52
br i1 %49, label %50, label %51
50: ; preds = %44
br label %68
51: ; preds = %44
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 44
%54 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %53)
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 48
%57 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i8* %56)
%58 = load i32, i32* %4
%59 = icmp slt i32 %58, 60
br i1 %59, label %60, label %61
60: ; preds = %51
br label %68
61: ; preds = %51
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i64 52
%64 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %63)
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i64 56
%67 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %7, %33, %43, %50, %60, %61, %14
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [55 x i8] c"Seagate firmware numbers VPD page length too short=%d\0A\00"
@.str.1 = [38 x i8] c" SCSI firmware release number: %.8s\0A\00"
@.str.2 = [34 x i8] c" Servo ROM release number: %.8s\0A\00"
@.str.3 = [47 x i8] c" SAP block point numbers (major/minor): %.8s\0A\00"
@.str.4 = [37 x i8] c" Servo firmware release date: %.4s\0A\00"
@.str.5 = [32 x i8] c" Servo ROM release date: %.4s\0A\00"
@.str.6 = [37 x i8] c" SAP firmware release number: %.8s\0A\00"
@.str.7 = [35 x i8] c" SAP firmware release date: %.4s\0A\00"
@.str.8 = [35 x i8] c" SAP firmware release year: %.4s\0A\00"
@.str.9 = [31 x i8] c" SAP manufacturing key: %.4s\0A\00"
@.str.10 = [65 x i8] c" Servo firmware product family and product family member: %.4s\0A\00"
define void @decode_firm_vpd_c0_sea(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 28
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 ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %41
7: ; preds = %2
%8 = icmp eq i32 %1, 28
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br i1 %8, label %11, label %14
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %0, i64 20
%13 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %41
14: ; preds = %7
%15 = getelementptr inbounds i8, i8* %0, i64 12
%16 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds i8, i8* %0, i64 20
%18 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = icmp ult i32 %1, 36
br i1 %19, label %41, label %20
20: ; preds = %14
%21 = getelementptr inbounds i8, i8* %0, i64 28
%22 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds i8, i8* %0, i64 32
%24 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = icmp ult i32 %1, 44
br i1 %25, label %41, label %26
26: ; preds = %20
%27 = getelementptr inbounds i8, i8* %0, i64 36
%28 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* %27)
%29 = icmp ult i32 %1, 52
br i1 %29, label %41, label %30
30: ; preds = %26
%31 = getelementptr inbounds i8, i8* %0, i64 44
%32 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds i8, i8* %0, i64 48
%34 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i8* %33)
%35 = icmp ult i32 %1, 60
br i1 %35, label %41, label %36
36: ; preds = %30
%37 = getelementptr inbounds i8, i8* %0, i64 52
%38 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds i8, i8* %0, i64 56
%40 = tail call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %30, %26, %20, %14, %4, %36, %11
ret void
}