#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 */
unsigned char *sg_scsi_sense_desc_find(unsigned char *, int, int);
int has_blk_ili(unsigned char *sensep, int sb_len) {
  int resp_code;
  const unsigned char *cup;
  if (sb_len < 8)
    return 0;
  resp_code = (0x7f & sensep[0]);
  if (resp_code >= 0x72) {
    if ((cup = sg_scsi_sense_desc_find(sensep, sb_len, 0x5)))
      return ((cup[3] & 0x20) ? 1 : 0);
  } else
    return ((sensep[2] & 0x20) ? 1 : 0);
  return 0;
}


x86 assembly (clang, -O0):
<has_blk_ili>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1135 <has_blk_ili+0x25>
movl   $0x0,-0x4(%rbp)
jmp    11b7 <has_blk_ili+0xa7>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x7f,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x72,-0x18(%rbp)
jl     1190 <has_blk_ili+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x5,%edx
call   1030 <sg_scsi_sense_desc_find@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     118b <has_blk_ili+0x7b>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%edx
and    $0x20,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <has_blk_ili+0xa7>
jmp    11b0 <has_blk_ili+0xa0>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%edx
and    $0x20,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11b7 <has_blk_ili+0xa7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_blk_ili>:
push   %rbx
xor    %ebx,%ebx
cmp    $0x8,%esi
jl     1145 <has_blk_ili+0x35>
mov    (%rdi),%al
and    $0x7e,%al
cmp    $0x72,%al
jb     1138 <has_blk_ili+0x28>
mov    $0x5,%edx
call   1030 <sg_scsi_sense_desc_find@plt>
test   %rax,%rax
je     1145 <has_blk_ili+0x35>
mov    %rax,%rdi
add    $0x3,%rdi
jmp    113c <has_blk_ili+0x2c>
add    $0x2,%rdi
movzbl (%rdi),%ebx
shr    $0x5,%ebx
and    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @has_blk_ili(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %44
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 127, %15
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp sge i32 %17, 114
br i1 %18, label %19, label %34
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = call i8* @sg_scsi_sense_desc_find(i8* %20, i32 %21, i32 5)
store i8* %22, i8** %7
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %33
24: ; preds = %19
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i64 3
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = and i32 %28, 32
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 1, i32 0
store i32 %32, i32* %3
br label %44
33: ; preds = %19
br label %43
34: ; preds = %11
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 2
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = and i32 %38, 32
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 1, i32 0
store i32 %42, i32* %3
br label %44
43: ; preds = %33
store i32 0, i32* %3
br label %44
44: ; preds = %43, %34, %24, %10
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
define i32 @has_blk_ili(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 8
br i1 %3, label %21, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = and i8 %5, 126
%7 = icmp ugt i8 %6, 113
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = tail call i8* @sg_scsi_sense_desc_find(i8* %0, i32 %1, i32 5)
%10 = icmp eq i8* %9, null
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 3
br label %15
13: ; preds = %4
%14 = getelementptr inbounds i8, i8* %0, i64 2
br label %15
15: ; preds = %11, %13
%16 = phi i8* [ %14, %13 ], [ %12, %11 ]
%17 = load i8, i8* %16
%18 = lshr i8 %17, 5
%19 = and i8 %18, 1
%20 = zext i8 %19 to i32
br label %21
21: ; preds = %15, %8, %2
%22 = phi i32 [ 0, %2 ], [ 0, %8 ], [ %20, %15 ]
ret i32 %22
}