#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 uint8_t;
typedef char int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
char *uscsi_decode_sense(int *, int);
void uscsi_print_sense_data(uint8_t *s, int slen, int verbosity) {
  int32_t info;
  int i, j, k;
  char *sbs;
  printf("    SENSE KEY: %s", uscsi_decode_sense(s, 0));
  if (s[2] & 0xe0) {
    char pad;
    printf("\n              ");
    pad = ' ';
    if (s[2] & 0x80) {
      printf("%c Filemark Detected", pad);
      pad = ',';
    }
    if (s[2] & 0x40) {
      printf("%c EOM Detected", pad);
      pad = ',';
    }
    if (s[2] & 0x20)
      printf("%c Incorrect Length Indicator Set", pad);
  }
  info = (s[3] << 24) | (s[4] << 16) | (s[5] << 8) | s[6];
  if (info)
    printf("\n   INFO FIELD: %d", info);
  if (((unsigned int)s[7]) < 4) {
    printf("\n");
    return;
  }
  info = (s[8] << 24) | (s[9] << 16) | (s[10] << 8) | s[11];
  if (info)
    printf("\n COMMAND INFO: %d (0x%x)", info, info);
  sbs = uscsi_decode_sense(s, 1);
  if (sbs)
    printf("\n     ASC/ASCQ: %s", sbs);
  if (s[14] != 0)
    printf("\n     FRU CODE: 0x%x", s[14] & 0xff);
  sbs = uscsi_decode_sense(s, 3);
  if (sbs)
    printf("\n         SKSV: %s", sbs);
  printf("\n");
  if (verbosity == 0) {
    printf("\n");
    return;
  }
  if (sbs)
    i = 18;
  else
    i = 15;
  for (j = i; j < slen; j++)
    if (s[j])
      break;
  if (j == slen)
    return;
  printf("\n Additional Sense Information (byte %d out...):\n", i);
  if (i == 15) {
    printf("\n\t%2d:", i);
    k = 7;
  } else {
    printf("\n\t%2d:", i);
    k = 2;
    j -= 2;
  }
  while (j > 0) {
    if (i >= slen)
      break;
    if (k == 8) {
      k = 0;
      printf("\n\t%2d:", i);
    }
    printf(" 0x%02x", s[i] & 0xff);
    k++;
    j--;
    i++;
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<uscsi_print_sense_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <uscsi_decode_sense@plt>
mov    %rax,%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
and    $0xe0,%eax
cmp    $0x0,%eax
je     11f3 <uscsi_print_sense_data+0xd3>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x20,-0x29(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11a0 <uscsi_print_sense_data+0x80>
movsbl -0x29(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x2c,-0x29(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     11c9 <uscsi_print_sense_data+0xa9>
movsbl -0x29(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x2c,-0x29(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11ee <uscsi_print_sense_data+0xce>
movsbl -0x29(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f3 <uscsi_print_sense_data+0xd3>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x14(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     0x18(%rcx),%eax
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     123b <uscsi_print_sense_data+0x11b>
movsbl -0x11(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x4,0x1c(%rax)
jae    125c <uscsi_print_sense_data+0x13c>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14ad <uscsi_print_sense_data+0x38d>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x24(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x28(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     0x2c(%rcx),%eax
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     12a8 <uscsi_print_sense_data+0x188>
movsbl -0x11(%rbp),%esi
movsbl -0x11(%rbp),%edx
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <uscsi_decode_sense@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12d7 <uscsi_print_sense_data+0x1b7>
mov    -0x28(%rbp),%rsi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x38(%rax)
je     1300 <uscsi_print_sense_data+0x1e0>
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%esi
and    $0xff,%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <uscsi_decode_sense@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     132f <uscsi_print_sense_data+0x20f>
mov    -0x28(%rbp),%rsi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    135a <uscsi_print_sense_data+0x23a>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14ad <uscsi_print_sense_data+0x38d>
cmpq   $0x0,-0x28(%rbp)
je     1371 <uscsi_print_sense_data+0x251>
movl   $0x12,-0x18(%rbp)
jmp    1378 <uscsi_print_sense_data+0x258>
movl   $0xf,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13b4 <uscsi_print_sense_data+0x294>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     13a1 <uscsi_print_sense_data+0x281>
jmp    13b4 <uscsi_print_sense_data+0x294>
jmp    13a6 <uscsi_print_sense_data+0x286>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    137e <uscsi_print_sense_data+0x25e>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    13c5 <uscsi_print_sense_data+0x2a5>
jmp    14ad <uscsi_print_sense_data+0x38d>
mov    -0x18(%rbp),%esi
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xf,-0x18(%rbp)
jne    13fd <uscsi_print_sense_data+0x2dd>
mov    -0x18(%rbp),%esi
lea    0xd19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x7,-0x20(%rbp)
jmp    141e <uscsi_print_sense_data+0x2fe>
mov    -0x18(%rbp),%esi
lea    0xcfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1423 <uscsi_print_sense_data+0x303>
cmpl   $0x0,-0x1c(%rbp)
jle    149f <uscsi_print_sense_data+0x37f>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     143e <uscsi_print_sense_data+0x31e>
jmp    149f <uscsi_print_sense_data+0x37f>
cmpl   $0x8,-0x20(%rbp)
jne    1460 <uscsi_print_sense_data+0x340>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%esi
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
and    $0xff,%esi
lea    0xc92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1423 <uscsi_print_sense_data+0x303>
lea    0xc6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uscsi_print_sense_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
xor    %esi,%esi
call   1030 <uscsi_decode_sense@plt>
lea    0xe9e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
testb  $0xe0,0x8(%r12)
je     11b1 <uscsi_print_sense_data+0x71>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%ecx
mov    $0x20,%al
test   $0x80,%cl
jne    12ba <uscsi_print_sense_data+0x17a>
test   $0x40,%cl
jne    12dd <uscsi_print_sense_data+0x19d>
test   $0x20,%cl
je     11b1 <uscsi_print_sense_data+0x71>
movzbl %al,%esi
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%r12),%eax
test   %al,%al
je     11cb <uscsi_print_sense_data+0x8b>
movsbl %al,%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x3,0x1c(%r12)
jbe    12a2 <uscsi_print_sense_data+0x162>
mov    0x2c(%r12),%eax
test   %al,%al
je     11f3 <uscsi_print_sense_data+0xb3>
movsbl %al,%edx
lea    0xe92(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   1030 <uscsi_decode_sense@plt>
test   %rax,%rax
je     1216 <uscsi_print_sense_data+0xd6>
lea    0xe8a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x38(%r12),%eax
test   %eax,%eax
je     1230 <uscsi_print_sense_data+0xf0>
movzbl %al,%esi
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
call   1030 <uscsi_decode_sense@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1256 <uscsi_print_sense_data+0x116>
lea    0xe72(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
test   %r15d,%r15d
je     12a2 <uscsi_print_sense_data+0x162>
xor    %eax,%eax
test   %rbp,%rbp
setne  %al
lea    (%rax,%rax,2),%r15d
add    $0xf,%r15d
mov    %r15d,%ebx
cmp    %r14d,%r15d
jge    1303 <uscsi_print_sense_data+0x1c3>
mov    %r15d,%ebx
mov    %r14d,%eax
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,(%r12,%rbx,4)
jne    1303 <uscsi_print_sense_data+0x1c3>
add    $0x1,%rbx
cmp    %rbx,%rax
jne    1290 <uscsi_print_sense_data+0x150>
jmp    1308 <uscsi_print_sense_data+0x1c8>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putchar@plt>
lea    0xd61(%rip),%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%ecx
mov    $0x2c,%al
test   $0x40,%cl
je     119b <uscsi_print_sense_data+0x5b>
movzbl %al,%esi
lea    0xd50(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%ecx
mov    $0x2c,%al
test   $0x20,%cl
jne    11a0 <uscsi_print_sense_data+0x60>
jmp    11b1 <uscsi_print_sense_data+0x71>
cmp    %r14d,%ebx
jne    1317 <uscsi_print_sense_data+0x1d7>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdb3(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdd4(%rip),%rdi
test   %rbp,%rbp
je     134d <uscsi_print_sense_data+0x20d>
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xfffffffe,%ebx
mov    $0x2,%r13d
test   %ebx,%ebx
jg     1363 <uscsi_print_sense_data+0x223>
jmp    13bd <uscsi_print_sense_data+0x27d>
mov    $0xf,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x7,%r13d
test   %ebx,%ebx
jle    13bd <uscsi_print_sense_data+0x27d>
cmp    %r14d,%r15d
jge    13bd <uscsi_print_sense_data+0x27d>
mov    %r15d,%ebp
movslq %r14d,%r14
lea    0xd95(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x8,%r13d
jne    1399 <uscsi_print_sense_data+0x259>
xor    %r13d,%r13d
lea    0xd73(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl (%r12,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x2,%ebx
jl     13bd <uscsi_print_sense_data+0x27d>
add    $0x1,%r13d
add    $0xffffffff,%ebx
add    $0x1,%rbp
cmp    %r14,%rbp
jl     1380 <uscsi_print_sense_data+0x240>
lea    0xd3d(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c" SENSE KEY: %s\00"
@.str.1 = [16 x i8] c"\0A \00"
@.str.2 = [21 x i8] c"%c Filemark Detected\00"
@.str.3 = [16 x i8] c"%c EOM Detected\00"
@.str.4 = [34 x i8] c"%c Incorrect Length Indicator Set\00"
@.str.5 = [19 x i8] c"\0A INFO FIELD: %d\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [26 x i8] c"\0A COMMAND INFO: %d (0x%x)\00"
@.str.8 = [19 x i8] c"\0A ASC/ASCQ: %s\00"
@.str.9 = [21 x i8] c"\0A FRU CODE: 0x%x\00"
@.str.10 = [19 x i8] c"\0A SKSV: %s\00"
@.str.11 = [50 x i8] c"\0A Additional Sense Information (byte %d out...):\0A\00"
@.str.12 = [7 x i8] c"\0A\09%2d:\00"
@.str.13 = [8 x i8] c" 0x%02x\00"
@.str.14 = [3 x i8] c"\0A\0A\00"
define void @uscsi_print_sense_data(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = load i32*, i32** %4
%14 = call i8* @uscsi_decode_sense(i32* %13, i32 0)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = load i32, i32* %17
%19 = and i32 %18, 224
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %53
21: ; preds = %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i8 32, i8* %12
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 2
%25 = load i32, i32* %24
%26 = and i32 %25, 128
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load i8, i8* %12
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %30)
store i8 44, i8* %12
br label %32
32: ; preds = %28, %21
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 2
%35 = load i32, i32* %34
%36 = and i32 %35, 64
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i8, i8* %12
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %40)
store i8 44, i8* %12
br label %42
42: ; preds = %38, %32
%43 = load i32*, i32** %4
%44 = getelementptr inbounds i32, i32* %43, i64 2
%45 = load i32, i32* %44
%46 = and i32 %45, 32
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %42
%49 = load i8, i8* %12
%50 = sext i8 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %48, %42
br label %53
53: ; preds = %52, %3
%54 = load i32*, i32** %4
%55 = getelementptr inbounds i32, i32* %54, i64 3
%56 = load i32, i32* %55
%57 = shl i32 %56, 24
%58 = load i32*, i32** %4
%59 = getelementptr inbounds i32, i32* %58, i64 4
%60 = load i32, i32* %59
%61 = shl i32 %60, 16
%62 = or i32 %57, %61
%63 = load i32*, i32** %4
%64 = getelementptr inbounds i32, i32* %63, i64 5
%65 = load i32, i32* %64
%66 = shl i32 %65, 8
%67 = or i32 %62, %66
%68 = load i32*, i32** %4
%69 = getelementptr inbounds i32, i32* %68, i64 6
%70 = load i32, i32* %69
%71 = or i32 %67, %70
%72 = trunc i32 %71 to i8
store i8 %72, i8* %7
%73 = load i8, i8* %7
%74 = icmp ne i8 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %53
%76 = load i8, i8* %7
%77 = sext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %75, %53
%80 = load i32*, i32** %4
%81 = getelementptr inbounds i32, i32* %80, i64 7
%82 = load i32, i32* %81
%83 = icmp ult i32 %82, 4
br i1 %83, label %84, label %86
84: ; preds = %79
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %219
86: ; preds = %79
%87 = load i32*, i32** %4
%88 = getelementptr inbounds i32, i32* %87, i64 8
%89 = load i32, i32* %88
%90 = shl i32 %89, 24
%91 = load i32*, i32** %4
%92 = getelementptr inbounds i32, i32* %91, i64 9
%93 = load i32, i32* %92
%94 = shl i32 %93, 16
%95 = or i32 %90, %94
%96 = load i32*, i32** %4
%97 = getelementptr inbounds i32, i32* %96, i64 10
%98 = load i32, i32* %97
%99 = shl i32 %98, 8
%100 = or i32 %95, %99
%101 = load i32*, i32** %4
%102 = getelementptr inbounds i32, i32* %101, i64 11
%103 = load i32, i32* %102
%104 = or i32 %100, %103
%105 = trunc i32 %104 to i8
store i8 %105, i8* %7
%106 = load i8, i8* %7
%107 = icmp ne i8 %106, 0
br i1 %107, label %108, label %114
108: ; preds = %86
%109 = load i8, i8* %7
%110 = sext i8 %109 to i32
%111 = load i8, i8* %7
%112 = sext i8 %111 to i32
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %110, i32 %112)
br label %114
114: ; preds = %108, %86
%115 = load i32*, i32** %4
%116 = call i8* @uscsi_decode_sense(i32* %115, i32 1)
store i8* %116, i8** %11
%117 = load i8*, i8** %11
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %122
119: ; preds = %114
%120 = load i8*, i8** %11
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %120)
br label %122
122: ; preds = %119, %114
%123 = load i32*, i32** %4
%124 = getelementptr inbounds i32, i32* %123, i64 14
%125 = load i32, i32* %124
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %133
127: ; preds = %122
%128 = load i32*, i32** %4
%129 = getelementptr inbounds i32, i32* %128, i64 14
%130 = load i32, i32* %129
%131 = and i32 %130, 255
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %131)
br label %133
133: ; preds = %127, %122
%134 = load i32*, i32** %4
%135 = call i8* @uscsi_decode_sense(i32* %134, i32 3)
store i8* %135, i8** %11
%136 = load i8*, i8** %11
%137 = icmp ne i8* %136, null
br i1 %137, label %138, label %141
138: ; preds = %133
%139 = load i8*, i8** %11
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %139)
br label %141
141: ; preds = %138, %133
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%143 = load i32, i32* %6
%144 = icmp eq i32 %143, 0
br i1 %144, label %145, label %147
145: ; preds = %141
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %219
147: ; preds = %141
%148 = load i8*, i8** %11
%149 = icmp ne i8* %148, null
br i1 %149, label %150, label %151
150: ; preds = %147
store i32 18, i32* %8
br label %152
151: ; preds = %147
store i32 15, i32* %8
br label %152
152: ; preds = %151, %150
%153 = load i32, i32* %8
store i32 %153, i32* %9
br label %154
154: ; preds = %167, %152
%155 = load i32, i32* %9
%156 = load i32, i32* %5
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %170
158: ; preds = %154
%159 = load i32*, i32** %4
%160 = load i32, i32* %9
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i32, i32* %159, i64 %161
%163 = load i32, i32* %162
%164 = icmp ne i32 %163, 0
br i1 %164, label %165, label %166
165: ; preds = %158
br label %170
166: ; preds = %158
br label %167
167: ; preds = %166
%168 = load i32, i32* %9
%169 = add nsw i32 %168, 1
store i32 %169, i32* %9
br label %154
170: ; preds = %165, %154
%171 = load i32, i32* %9
%172 = load i32, i32* %5
%173 = icmp eq i32 %171, %172
br i1 %173, label %174, label %175
174: ; preds = %170
br label %219
175: ; preds = %170
%176 = load i32, i32* %8
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i32 %176)
%178 = load i32, i32* %8
%179 = icmp eq i32 %178, 15
br i1 %179, label %180, label %183
180: ; preds = %175
%181 = load i32, i32* %8
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %181)
store i32 7, i32* %10
br label %188
183: ; preds = %175
%184 = load i32, i32* %8
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %184)
store i32 2, i32* %10
%186 = load i32, i32* %9
%187 = sub nsw i32 %186, 2
store i32 %187, i32* %9
br label %188
188: ; preds = %183, %180
br label %189
189: ; preds = %203, %188
%190 = load i32, i32* %9
%191 = icmp sgt i32 %190, 0
br i1 %191, label %192, label %217
192: ; preds = %189
%193 = load i32, i32* %8
%194 = load i32, i32* %5
%195 = icmp sge i32 %193, %194
br i1 %195, label %196, label %197
196: ; preds = %192
br label %217
197: ; preds = %192
%198 = load i32, i32* %10
%199 = icmp eq i32 %198, 8
br i1 %199, label %200, label %203
200: ; preds = %197
store i32 0, i32* %10
%201 = load i32, i32* %8
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %201)
br label %203
203: ; preds = %200, %197
%204 = load i32*, i32** %4
%205 = load i32, i32* %8
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i32, i32* %204, i64 %206
%208 = load i32, i32* %207
%209 = and i32 %208, 255
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 %209)
%211 = load i32, i32* %10
%212 = add nsw i32 %211, 1
store i32 %212, i32* %10
%213 = load i32, i32* %9
%214 = add nsw i32 %213, -1
store i32 %214, i32* %9
%215 = load i32, i32* %8
%216 = add nsw i32 %215, 1
store i32 %216, i32* %8
br label %189
217: ; preds = %196, %189
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
br label %219
219: ; preds = %217, %174, %145, %84
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c" SENSE KEY: %s\00"
@.str.1 = [16 x i8] c"\0A \00"
@.str.2 = [21 x i8] c"%c Filemark Detected\00"
@.str.3 = [16 x i8] c"%c EOM Detected\00"
@.str.4 = [34 x i8] c"%c Incorrect Length Indicator Set\00"
@.str.5 = [19 x i8] c"\0A INFO FIELD: %d\00"
@.str.7 = [26 x i8] c"\0A COMMAND INFO: %d (0x%x)\00"
@.str.8 = [19 x i8] c"\0A ASC/ASCQ: %s\00"
@.str.9 = [21 x i8] c"\0A FRU CODE: 0x%x\00"
@.str.10 = [19 x i8] c"\0A SKSV: %s\00"
@.str.11 = [50 x i8] c"\0A Additional Sense Information (byte %d out...):\0A\00"
@.str.12 = [7 x i8] c"\0A\09%2d:\00"
@.str.13 = [8 x i8] c" 0x%02x\00"
@str = [2 x i8] c"\0A\00"
define void @uscsi_print_sense_data(i32* %0, i32 %1, i32 %2) {
%4 = tail call i8* @uscsi_decode_sense(i32* %0, i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = and i32 %7, 224
%9 = icmp eq i32 %8, 0
br i1 %9, label %35, label %10
10: ; preds = %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %6
%13 = and i32 %12, 128
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 32)
%17 = load i32, i32* %6
br label %18
18: ; preds = %15, %10
%19 = phi i32 [ %17, %15 ], [ %12, %10 ]
%20 = phi i8 [ 44, %15 ], [ 32, %10 ]
%21 = and i32 %19, 64
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %18
%24 = zext i8 %20 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %6
br label %27
27: ; preds = %23, %18
%28 = phi i32 [ %26, %23 ], [ %19, %18 ]
%29 = phi i8 [ 44, %23 ], [ %20, %18 ]
%30 = and i32 %28, 32
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = zext i8 %29 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %27, %32, %3
%36 = getelementptr inbounds i32, i32* %0, i64 6
%37 = load i32, i32* %36
%38 = trunc i32 %37 to i8
%39 = icmp eq i8 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %35
%41 = shl i32 %37, 24
%42 = ashr exact i32 %41, 24
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %40, %35
%45 = getelementptr inbounds i32, i32* %0, i64 7
%46 = load i32, i32* %45
%47 = icmp ult i32 %46, 4
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = tail call i32 @putchar(i32 10)
br label %137
50: ; preds = %44
%51 = getelementptr inbounds i32, i32* %0, i64 11
%52 = load i32, i32* %51
%53 = trunc i32 %52 to i8
%54 = icmp eq i8 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %50
%56 = shl i32 %52, 24
%57 = ashr exact i32 %56, 24
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %57, i32 %57)
br label %59
59: ; preds = %55, %50
%60 = tail call i8* @uscsi_decode_sense(i32* %0, i32 1)
%61 = icmp eq i8* %60, null
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %60)
br label %64
64: ; preds = %62, %59
%65 = getelementptr inbounds i32, i32* %0, i64 14
%66 = load i32, i32* %65
%67 = icmp eq i32 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %64
%69 = and i32 %66, 255
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %69)
br label %71
71: ; preds = %68, %64
%72 = tail call i8* @uscsi_decode_sense(i32* %0, i32 3)
%73 = icmp eq i8* %72, null
br i1 %73, label %76, label %74
74: ; preds = %71
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %72)
br label %76
76: ; preds = %74, %71
%77 = tail call i32 @putchar(i32 10)
%78 = icmp eq i32 %2, 0
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = tail call i32 @putchar(i32 10)
br label %137
81: ; preds = %76
%82 = select i1 %73, i32 15, i32 18
%83 = icmp slt i32 %82, %1
br i1 %83, label %84, label %97
84: ; preds = %81
%85 = zext i32 %82 to i64
%86 = zext i32 %1 to i64
br label %87
87: ; preds = %84, %92
%88 = phi i64 [ %85, %84 ], [ %93, %92 ]
%89 = getelementptr inbounds i32, i32* %0, i64 %88
%90 = load i32, i32* %89
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %87
%93 = add nuw nsw i64 %88, 1
%94 = icmp eq i64 %93, %86
br i1 %94, label %137, label %87
95: ; preds = %87
%96 = trunc i64 %88 to i32
br label %97
97: ; preds = %95, %81
%98 = phi i32 [ %82, %81 ], [ %96, %95 ]
%99 = icmp eq i32 %98, %1
br i1 %99, label %137, label %100
100: ; preds = %97
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i32 %82)
br i1 %73, label %102, label %104
102: ; preds = %100
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 15)
br label %107
104: ; preds = %100
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %82)
%106 = add nsw i32 %98, -2
br label %107
107: ; preds = %104, %102
%108 = phi i32 [ %98, %102 ], [ %106, %104 ]
%109 = phi i32 [ 7, %102 ], [ 2, %104 ]
%110 = icmp sgt i32 %108, 0
%111 = select i1 %110, i1 %83, i1 false
br i1 %111, label %112, label %135
112: ; preds = %107
%113 = zext i32 %82 to i64
%114 = sext i32 %1 to i64
br label %115
115: ; preds = %112, %123
%116 = phi i64 [ %113, %112 ], [ %131, %123 ]
%117 = phi i32 [ %109, %112 ], [ %129, %123 ]
%118 = phi i32 [ %108, %112 ], [ %130, %123 ]
%119 = icmp eq i32 %117, 8
br i1 %119, label %120, label %123
120: ; preds = %115
%121 = trunc i64 %116 to i32
%122 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %121)
br label %123
123: ; preds = %120, %115
%124 = phi i32 [ 0, %120 ], [ %117, %115 ]
%125 = getelementptr inbounds i32, i32* %0, i64 %116
%126 = load i32, i32* %125
%127 = and i32 %126, 255
%128 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 %127)
%129 = add nsw i32 %124, 1
%130 = add nsw i32 %118, -1
%131 = add nuw nsw i64 %116, 1
%132 = icmp sgt i32 %118, 1
%133 = icmp slt i64 %131, %114
%134 = select i1 %132, i1 %133, i1 false
br i1 %134, label %115, label %135
135: ; preds = %123, %107
%136 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %137
137: ; preds = %92, %97, %135, %79, %48
ret void
}