#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 u_char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ uscsi_print_sense_data(int *, int, int);
void uscsi_print_sense(const char *name, u_char *req_cmd, int req_cmdlen,
                       u_char *req_sense, int req_senselen_used,
                       int verbosity) {
  int i;
  printf("%s: Check Condition on CDB:", name);
  for (i = 0; i < req_cmdlen; i++)
    printf(" %02x", req_cmd[i]);
  printf("\n");
  uscsi_print_sense_data(req_sense, req_senselen_used, verbosity);
}


x86 assembly (clang, -O0):
<uscsi_print_sense>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118b <uscsi_print_sense+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1158 <uscsi_print_sense+0x38>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1040 <uscsi_print_sense_data@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uscsi_print_sense>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %edx,%ebx
mov    %rsi,%rbp
mov    %rdi,%rsi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1188 <uscsi_print_sense+0x58>
mov    %ebx,%ebx
lea    0xeb3(%rip),%r13
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    0x0(%rbp,%r14,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1170 <uscsi_print_sense+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    0x4(%rsp),%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <uscsi_print_sense_data@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"%s: Check Condition on CDB:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @uscsi_print_sense(i8* %0, i32* %1, i32 %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i8*, i8** %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 0, i32* %13
br label %16
16: ; preds = %27, %6
%17 = load i32, i32* %13
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32*, i32** %8
%22 = load i32, i32* %13
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %13
%29 = add nsw i32 %28, 1
store i32 %29, i32* %13
br label %16
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = load i32*, i32** %10
%33 = load i32, i32* %11
%34 = load i32, i32* %12
%35 = call i32 @uscsi_print_sense_data(i32* %32, i32 %33, i32 %34)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"%s: Check Condition on CDB:\00"
@.str.1 = [6 x i8] c" %02x\00"
define void @uscsi_print_sense(i8* %0, i32* nocapture %1, i32 %2, i32* %3, i32 %4, i32 %5) {
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i32, i32* %1, i64 %12
%14 = load i32, i32* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %6
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @uscsi_print_sense_data(i32* %3, i32 %4, i32 %5)
ret void
}