#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
char *kvs3105_strerror(int /*<<< orphan*/ *);
scalar_t__ scsi_usb_error_code(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void report(const char *comment, uint8_t *requestsense) {
  const char *msg = kvs3105_strerror(requestsense);
  int code = (int)scsi_usb_error_code(requestsense);
  fprintf(stderr, "%s: %x\n", comment, code);
  if (msg) {
    fprintf(stderr, "%s\n", msg);
  }
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <kvs3105_strerror@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <scsi_usb_error_code@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     119d <report+0x6d>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <kvs3105_strerror@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <scsi_usb_error_code@plt>
mov    0x2e8b(%rip),%rbx
mov    (%rbx),%edi
lea    0xea2(%rip),%rsi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14,%r14
je     1187 <report+0x57>
mov    (%rbx),%edi
lea    0xe90(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %x\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @report(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = call i8* @kvs3105_strerror(i32* %7)
store i8* %8, i8** %5
%9 = load i32*, i32** %4
%10 = call i64 @scsi_usb_error_code(i32* %9)
%11 = trunc i64 %10 to i32
store i32 %11, i32* %6
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = load i32, i32* %6
%15 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %5
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %x\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @report(i8* %0, i32* %1) {
%3 = tail call i8* @kvs3105_strerror(i32* %1)
%4 = tail call i64 @scsi_usb_error_code(i32* %1)
%5 = trunc i64 %4 to i32
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
%8 = icmp eq i8* %3, null
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %12
12: ; preds = %9, %2
ret void
}