#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 */
typedef int /*<<< orphan*/ cdb;

/* Variables and functions */
int /*<<< orphan*/ SG_DXFER_FROM_DEV;
int /*<<< orphan*/ print_sense_data(unsigned char *, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int scsi_io(int, unsigned char *, int, int /*<<< orphan*/, unsigned char *,
            unsigned int *, unsigned char *, unsigned int *);
int scsi_persistent_reserve_in_read_keys(int fd) {
  unsigned char cdb[] = {0x5e, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  unsigned int data_size = 0x00ff;
  unsigned char data[data_size];
  unsigned int sense_len = 32;
  unsigned char sense[sense_len];
  unsigned char service_action = 0;
  int res, i;
  unsigned long prgeneration, additional_length;
  cdb[1] = service_action;
  cdb[7] = (data_size >> 8) & 0xff;
  cdb[8] = data_size & 0xff;
  printf("PERSISTENT RESERVE IN: READ KEYS\n");
  res = scsi_io(fd, cdb, sizeof(cdb), SG_DXFER_FROM_DEV, data, &data_size,
                sense, &sense_len);
  if (res) {
    printf("SCSI_IO failed\n");
    return -1;
  }
  if (sense_len) {
    print_sense_data(sense, sense_len);
    return -1;
  }
  prgeneration = data[0];
  prgeneration <<= 8;
  prgeneration |= data[1];
  prgeneration <<= 8;
  prgeneration |= data[2];
  prgeneration <<= 8;
  prgeneration |= data[3];
  printf("PRGeneration:%lu\n", prgeneration);
  additional_length = data[4];
  additional_length <<= 8;
  additional_length |= data[5];
  additional_length <<= 8;
  additional_length |= data[6];
  additional_length <<= 8;
  additional_length |= data[7];
  printf("Additional Length:%lu\n", additional_length);
  for (i = 0; i < additional_length; i += 8) {
    printf("Key:%02x%02x%02x%02x%02x%02x%02x%02x\n", data[i + 8], data[i + 9],
           data[i + 10], data[i + 11], data[i + 12], data[i + 13], data[i + 14],
           data[i + 15]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<scsi_persistent_reserve_in_read_keys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x8(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0xff,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x20,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movb   $0x0,-0x41(%rbp)
mov    -0x41(%rbp),%al
mov    %al,-0x17(%rbp)
mov    -0x1c(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x11(%rbp)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x10(%rbp)
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%r8
mov    -0x70(%rbp),%r10
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    0x2dfa(%rip),%rax
mov    (%rax),%ecx
mov    $0xa,%edx
lea    -0x1c(%rbp),%r9
lea    -0x34(%rbp),%rax
sub    $0x10,%rsp
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <scsi_io@plt>
add    $0x10,%rsp
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     1241 <scsi_persistent_reserve_in_read_keys+0x111>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    13f9 <scsi_persistent_reserve_in_read_keys+0x2c9>
cmpl   $0x0,-0x34(%rbp)
je     126a <scsi_persistent_reserve_in_read_keys+0x13a>
mov    -0x70(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <print_sense_data@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    13f9 <scsi_persistent_reserve_in_read_keys+0x2c9>
mov    -0x78(%rbp),%rax
movzbl (%rax),%ecx
mov    %rcx,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x58(%rbp)
movzbl 0x1(%rax),%ecx
or     -0x58(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x58(%rbp)
movzbl 0x2(%rax),%ecx
or     -0x58(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x58(%rbp)
movzbl 0x3(%rax),%eax
or     -0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rax
movzbl 0x4(%rax),%ecx
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x60(%rbp)
movzbl 0x5(%rax),%ecx
or     -0x60(%rbp),%rcx
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x60(%rbp)
movzbl 0x6(%rax),%ecx
or     -0x60(%rbp),%rcx
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rcx
shl    $0x8,%rcx
mov    %rcx,-0x60(%rbp)
movzbl 0x7(%rax),%eax
or     -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    13eb <scsi_persistent_reserve_in_read_keys+0x2bb>
mov    -0x78(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x4c(%rbp),%ecx
add    $0x9,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    -0x4c(%rbp),%ecx
add    $0xa,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%ecx
mov    -0x4c(%rbp),%edi
add    $0xb,%edi
movslq %edi,%rdi
movzbl (%rax,%rdi,1),%r8d
mov    -0x4c(%rbp),%edi
add    $0xc,%edi
movslq %edi,%rdi
movzbl (%rax,%rdi,1),%r9d
mov    -0x4c(%rbp),%edi
add    $0xd,%edi
movslq %edi,%rdi
movzbl (%rax,%rdi,1),%r11d
mov    -0x4c(%rbp),%edi
add    $0xe,%edi
movslq %edi,%rdi
movzbl (%rax,%rdi,1),%r10d
mov    -0x4c(%rbp),%edi
add    $0xf,%edi
movslq %edi,%rdi
movzbl (%rax,%rdi,1),%eax
lea    0xca4(%rip),%rdi
sub    $0x20,%rsp
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
mov    -0x4c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4c(%rbp)
jmp    133c <scsi_persistent_reserve_in_read_keys+0x20c>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scsi_persistent_reserve_in_read_keys>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %edi,%ebx
mov    %rsp,%r12
movzwl 0xeab(%rip),%eax
mov    %ax,0x18(%rsp)
mov    0xe97(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0xff,0x1c(%rsp)
movl   $0x20,0xc(%rsp)
movb   $0x0,0x11(%rsp)
movw   $0xff00,0x17(%rsp)
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%ecx
lea    0xc(%rsp),%rax
lea    0x20(%rsp),%r10
lea    0x10(%rsp),%rsi
lea    0x40(%rsp),%r8
lea    0x1c(%rsp),%r9
mov    %ebx,%edi
mov    $0xa,%edx
push   %rax
push   %r10
call   1050 <scsi_io@plt>
add    $0x10,%rsp
test   %eax,%eax
je     11e6 <scsi_persistent_reserve_in_read_keys+0xa6>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%r14d
jmp    129f <scsi_persistent_reserve_in_read_keys+0x15f>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1203 <scsi_persistent_reserve_in_read_keys+0xc3>
lea    0x20(%rsp),%rdi
call   1060 <print_sense_data@plt>
mov    $0xffffffff,%r14d
jmp    129f <scsi_persistent_reserve_in_read_keys+0x15f>
mov    0x40(%rsp),%esi
shl    $0x20,%rsi
bswap  %rsi
lea    0xdf5(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%r13d
shl    $0x20,%r13
bswap  %r13
lea    0xdea(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13,%r13
je     129f <scsi_persistent_reserve_in_read_keys+0x15f>
xor    %r14d,%r14d
lea    0xde8(%rip),%r15
xor    %eax,%eax
nopl   (%rax)
lea    0x8(%rax),%rbx
movzbl 0x48(%rsp,%rax,1),%esi
movzbl 0x49(%rsp,%rax,1),%edx
movzbl 0x4a(%rsp,%rax,1),%ecx
movzbl 0x4b(%rsp,%rax,1),%r8d
movzbl 0x4c(%rsp,%rax,1),%r9d
movzbl 0x4d(%rsp,%rax,1),%r10d
movzbl 0x4e(%rsp,%rax,1),%r11d
movzbl 0x4f(%rsp,%rax,1),%ebp
sub    $0x8,%rsp
mov    %r15,%rdi
xor    %eax,%eax
push   %rbp
push   %r11
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
mov    %rbx,%rax
cmp    %rbx,%r13
ja     1250 <scsi_persistent_reserve_in_read_keys+0x110>
mov    %r12,%rsp
mov    %r14d,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.scsi_persistent_reserve_in_read_keys.cdb = <{ i8, [9 x i8] }> <{ i8 94, [9 x i8] zeroinitializer }>
@.str = [34 x i8] c"PERSISTENT RESERVE IN: READ KEYS\0A\00"
@SG_DXFER_FROM_DEV = global i32 0
@.str.1 = [16 x i8] c"SCSI_IO failed\0A\00"
@.str.2 = [18 x i8] c"PRGeneration:%lu\0A\00"
@.str.3 = [23 x i8] c"Additional Length:%lu\0A\00"
@.str.4 = [38 x i8] c"Key:%02x%02x%02x%02x%02x%02x%02x%02x\0A\00"
define i32 @scsi_persistent_reserve_in_read_keys(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
store i32 %0, i32* %3
%16 = bitcast [10 x i8]* %4 to i8*
store i32 255, i32* %5
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %6
%20 = alloca i8, i64 %18
store i64 %18, i64* %7
store i32 32, i32* %8
%21 = load i32, i32* %8
%22 = zext i32 %21 to i64
%23 = alloca i8, i64 %22
store i64 %22, i64* %9
store i8 0, i8* %10
%24 = load i8, i8* %10
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
store i8 %24, i8* %25
%26 = load i32, i32* %5
%27 = lshr i32 %26, 8
%28 = and i32 %27, 255
%29 = trunc i32 %28 to i8
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 7
store i8 %29, i8* %30
%31 = load i32, i32* %5
%32 = and i32 %31, 255
%33 = trunc i32 %32 to i8
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 8
store i8 %33, i8* %34
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%36 = load i32, i32* %3
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%38 = load i32, i32* @SG_DXFER_FROM_DEV
%39 = call i32 @scsi_io(i32 %36, i8* %37, i32 10, i32 %38, i8* %20, i32* %5, i8* %23, i32* %8)
store i32 %39, i32* %11
%40 = load i32, i32* %11
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %1
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
store i32 1, i32* %15
br label %162
44: ; preds = %1
%45 = load i32, i32* %8
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %8
%49 = call i32 @print_sense_data(i8* %23, i32 %48)
store i32 -1, i32* %2
store i32 1, i32* %15
br label %162
50: ; preds = %44
%51 = getelementptr inbounds i8, i8* %20, i64 0
%52 = load i8, i8* %51
%53 = zext i8 %52 to i64
store i64 %53, i64* %13
%54 = load i64, i64* %13
%55 = shl i64 %54, 8
store i64 %55, i64* %13
%56 = getelementptr inbounds i8, i8* %20, i64 1
%57 = load i8, i8* %56
%58 = zext i8 %57 to i64
%59 = load i64, i64* %13
%60 = or i64 %59, %58
store i64 %60, i64* %13
%61 = load i64, i64* %13
%62 = shl i64 %61, 8
store i64 %62, i64* %13
%63 = getelementptr inbounds i8, i8* %20, i64 2
%64 = load i8, i8* %63
%65 = zext i8 %64 to i64
%66 = load i64, i64* %13
%67 = or i64 %66, %65
store i64 %67, i64* %13
%68 = load i64, i64* %13
%69 = shl i64 %68, 8
store i64 %69, i64* %13
%70 = getelementptr inbounds i8, i8* %20, i64 3
%71 = load i8, i8* %70
%72 = zext i8 %71 to i64
%73 = load i64, i64* %13
%74 = or i64 %73, %72
store i64 %74, i64* %13
%75 = load i64, i64* %13
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %75)
%77 = getelementptr inbounds i8, i8* %20, i64 4
%78 = load i8, i8* %77
%79 = zext i8 %78 to i64
store i64 %79, i64* %14
%80 = load i64, i64* %14
%81 = shl i64 %80, 8
store i64 %81, i64* %14
%82 = getelementptr inbounds i8, i8* %20, i64 5
%83 = load i8, i8* %82
%84 = zext i8 %83 to i64
%85 = load i64, i64* %14
%86 = or i64 %85, %84
store i64 %86, i64* %14
%87 = load i64, i64* %14
%88 = shl i64 %87, 8
store i64 %88, i64* %14
%89 = getelementptr inbounds i8, i8* %20, i64 6
%90 = load i8, i8* %89
%91 = zext i8 %90 to i64
%92 = load i64, i64* %14
%93 = or i64 %92, %91
store i64 %93, i64* %14
%94 = load i64, i64* %14
%95 = shl i64 %94, 8
store i64 %95, i64* %14
%96 = getelementptr inbounds i8, i8* %20, i64 7
%97 = load i8, i8* %96
%98 = zext i8 %97 to i64
%99 = load i64, i64* %14
%100 = or i64 %99, %98
store i64 %100, i64* %14
%101 = load i64, i64* %14
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %101)
store i32 0, i32* %12
br label %103
103: ; preds = %158, %50
%104 = load i32, i32* %12
%105 = sext i32 %104 to i64
%106 = load i64, i64* %14
%107 = icmp ult i64 %105, %106
br i1 %107, label %108, label %161
108: ; preds = %103
%109 = load i32, i32* %12
%110 = add nsw i32 %109, 8
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %20, i64 %111
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = load i32, i32* %12
%116 = add nsw i32 %115, 9
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %20, i64 %117
%119 = load i8, i8* %118
%120 = zext i8 %119 to i32
%121 = load i32, i32* %12
%122 = add nsw i32 %121, 10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8, i8* %20, i64 %123
%125 = load i8, i8* %124
%126 = zext i8 %125 to i32
%127 = load i32, i32* %12
%128 = add nsw i32 %127, 11
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %20, i64 %129
%131 = load i8, i8* %130
%132 = zext i8 %131 to i32
%133 = load i32, i32* %12
%134 = add nsw i32 %133, 12
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %20, i64 %135
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = load i32, i32* %12
%140 = add nsw i32 %139, 13
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %20, i64 %141
%143 = load i8, i8* %142
%144 = zext i8 %143 to i32
%145 = load i32, i32* %12
%146 = add nsw i32 %145, 14
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i8, i8* %20, i64 %147
%149 = load i8, i8* %148
%150 = zext i8 %149 to i32
%151 = load i32, i32* %12
%152 = add nsw i32 %151, 15
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8, i8* %20, i64 %153
%155 = load i8, i8* %154
%156 = zext i8 %155 to i32
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %114, i32 %120, i32 %126, i32 %132, i32 %138, i32 %144, i32 %150, i32 %156)
br label %158
158: ; preds = %108
%159 = load i32, i32* %12
%160 = add nsw i32 %159, 8
store i32 %160, i32* %12
br label %103
161: ; preds = %103
store i32 0, i32* %2
store i32 1, i32* %15
br label %162
162: ; preds = %161, %47, %42
%163 = load i8*, i8** %6
%164 = load i32, i32* %2
ret i32 %164
}

LLVM IR (-O2):
@__const.scsi_persistent_reserve_in_read_keys.cdb = <{ i8, [9 x i8] }> <{ i8 94, [9 x i8] zeroinitializer }>
@SG_DXFER_FROM_DEV = global i32 0
@.str.2 = [18 x i8] c"PRGeneration:%lu\0A\00"
@.str.3 = [23 x i8] c"Additional Length:%lu\0A\00"
@.str.4 = [38 x i8] c"Key:%02x%02x%02x%02x%02x%02x%02x%02x\0A\00"
@str = [33 x i8] c"PERSISTENT RESERVE IN: READ KEYS\00"
@str.5 = [15 x i8] c"SCSI_IO failed\00"
define i32 @scsi_persistent_reserve_in_read_keys(i32 %0) {
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
store i32 255, i32* %3
%7 = tail call i8* @llvm.stacksave()
%8 = alloca [255 x i8]
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
store i32 32, i32* %4
%11 = alloca [32 x i8]
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 1
store i8 0, i8* %13
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 7
store i8 0, i8* %14
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 8
store i8 -1, i8* %15
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%17 = load i32, i32* @SG_DXFER_FROM_DEV
%18 = call i32 @scsi_io(i32 %0, i8* %5, i32 10, i32 %17, i8* %9, i32* %3, i8* %12, i32* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %1
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
br label %102
22: ; preds = %1
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 @print_sense_data(i8* %12, i32 %23)
br label %102
27: ; preds = %22
%28 = load i8, i8* %9
%29 = zext i8 %28 to i64
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = shl nuw nsw i64 %29, 16
%34 = shl nuw nsw i64 %32, 8
%35 = or i64 %34, %33
%36 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 2
%37 = load i8, i8* %36
%38 = zext i8 %37 to i64
%39 = or i64 %35, %38
%40 = shl nuw nsw i64 %39, 8
%41 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 3
%42 = load i8, i8* %41
%43 = zext i8 %42 to i64
%44 = or i64 %40, %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %44)
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 4
%47 = load i8, i8* %46
%48 = zext i8 %47 to i64
%49 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 5
%50 = load i8, i8* %49
%51 = zext i8 %50 to i64
%52 = shl nuw nsw i64 %48, 16
%53 = shl nuw nsw i64 %51, 8
%54 = or i64 %53, %52
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 6
%56 = load i8, i8* %55
%57 = zext i8 %56 to i64
%58 = or i64 %54, %57
%59 = shl nuw nsw i64 %58, 8
%60 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 7
%61 = load i8, i8* %60
%62 = zext i8 %61 to i64
%63 = or i64 %59, %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %63)
%65 = icmp eq i64 %63, 0
br i1 %65, label %102, label %66
66: ; preds = %27, %66
%67 = phi i64 [ %68, %66 ], [ 0, %27 ]
%68 = add nuw nsw i64 %67, 8
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = add nuw nsw i64 %67, 9
%73 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = add nuw nsw i64 %67, 10
%77 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %76
%78 = load i8, i8* %77
%79 = zext i8 %78 to i32
%80 = add nuw nsw i64 %67, 11
%81 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = add nuw nsw i64 %67, 12
%85 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %84
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
%88 = add nuw nsw i64 %67, 13
%89 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = add nuw nsw i64 %67, 14
%93 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %92
%94 = load i8, i8* %93
%95 = zext i8 %94 to i32
%96 = add nuw nsw i64 %67, 15
%97 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %71, i32 %75, i32 %79, i32 %83, i32 %87, i32 %91, i32 %95, i32 %99)
%101 = icmp ugt i64 %63, %68
br i1 %101, label %66, label %102
102: ; preds = %66, %27, %25, %20
%103 = phi i32 [ -1, %20 ], [ -1, %25 ], [ 0, %27 ], [ 0, %66 ]
ret i32 %103
}