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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void scsi_request_sense_dump(void *irequestsense) {
  const uint8_t *requestsense = (uint8_t *)irequestsense;
  fprintf(stderr, "Request failed: ");
  for (int i = 0; i < 20; ++i) {
    fprintf(stderr, "%02x ", requestsense[i]);
  }
  fprintf(stderr, "\n");
  fprintf(stderr, "ASC/ASCQ: %02x %02x\n", requestsense[12], requestsense[13]);
}


x86 assembly (clang, -O0):
<scsi_request_sense_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    117c <scsi_request_sense_dump+0x6c>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <scsi_request_sense_dump+0x32>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x34(%rax),%ecx
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scsi_request_sense_dump>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ec1(%rip),%r15
mov    (%r15),%edi
lea    0xed7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    (%rbx),%edx
lea    0xed5(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x4(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x8(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0xc(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x10(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x14(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x18(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x1c(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x20(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x24(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x28(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x2c(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x30(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x34(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x38(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x3c(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x40(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x44(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x48(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x4c(%rbx),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
lea    0xdaa(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r15),%edi
mov    0x30(%rbx),%edx
mov    0x34(%rbx),%ecx
lea    0xd80(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Request failed: \00"
@.str.1 = [6 x i8] c"%02x \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [21 x i8] c"ASC/ASCQ: %02x %02x\0A\00"
define void @scsi_request_sense_dump(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i32, i32* %2
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stderr
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds i8, i8* %0, i64 8
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stderr
%19 = getelementptr inbounds i8, i8* %0, i64 12
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %20
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stderr
%24 = getelementptr inbounds i8, i8* %0, i64 16
%25 = bitcast i8* %24 to i32*
%26 = load i32, i32* %25
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @stderr
%29 = getelementptr inbounds i8, i8* %0, i64 20
%30 = bitcast i8* %29 to i32*
%31 = load i32, i32* %30
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @stderr
%34 = getelementptr inbounds i8, i8* %0, i64 24
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %35
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @stderr
%39 = getelementptr inbounds i8, i8* %0, i64 28
%40 = bitcast i8* %39 to i32*
%41 = load i32, i32* %40
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32, i32* @stderr
%44 = getelementptr inbounds i8, i8* %0, i64 32
%45 = bitcast i8* %44 to i32*
%46 = load i32, i32* %45
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @stderr
%49 = getelementptr inbounds i8, i8* %0, i64 36
%50 = bitcast i8* %49 to i32*
%51 = load i32, i32* %50
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = load i32, i32* @stderr
%54 = getelementptr inbounds i8, i8* %0, i64 40
%55 = bitcast i8* %54 to i32*
%56 = load i32, i32* %55
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32, i32* @stderr
%59 = getelementptr inbounds i8, i8* %0, i64 44
%60 = bitcast i8* %59 to i32*
%61 = load i32, i32* %60
%62 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = load i32, i32* @stderr
%64 = getelementptr inbounds i8, i8* %0, i64 48
%65 = bitcast i8* %64 to i32*
%66 = load i32, i32* %65
%67 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%68 = load i32, i32* @stderr
%69 = getelementptr inbounds i8, i8* %0, i64 52
%70 = bitcast i8* %69 to i32*
%71 = load i32, i32* %70
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = load i32, i32* @stderr
%74 = getelementptr inbounds i8, i8* %0, i64 56
%75 = bitcast i8* %74 to i32*
%76 = load i32, i32* %75
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %76)
%78 = load i32, i32* @stderr
%79 = getelementptr inbounds i8, i8* %0, i64 60
%80 = bitcast i8* %79 to i32*
%81 = load i32, i32* %80
%82 = tail call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %81)
%83 = load i32, i32* @stderr
%84 = getelementptr inbounds i8, i8* %0, i64 64
%85 = bitcast i8* %84 to i32*
%86 = load i32, i32* %85
%87 = tail call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %86)
%88 = load i32, i32* @stderr
%89 = getelementptr inbounds i8, i8* %0, i64 68
%90 = bitcast i8* %89 to i32*
%91 = load i32, i32* %90
%92 = tail call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %91)
%93 = load i32, i32* @stderr
%94 = getelementptr inbounds i8, i8* %0, i64 72
%95 = bitcast i8* %94 to i32*
%96 = load i32, i32* %95
%97 = tail call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %96)
%98 = load i32, i32* @stderr
%99 = getelementptr inbounds i8, i8* %0, i64 76
%100 = bitcast i8* %99 to i32*
%101 = load i32, i32* %100
%102 = tail call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %101)
%103 = load i32, i32* @stderr
%104 = tail call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%105 = load i32, i32* @stderr
%106 = getelementptr inbounds i8, i8* %0, i64 48
%107 = bitcast i8* %106 to i32*
%108 = load i32, i32* %107
%109 = getelementptr inbounds i8, i8* %0, i64 52
%110 = bitcast i8* %109 to i32*
%111 = load i32, i32* %110
%112 = tail call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %108, i32 %111)
ret void
}