#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 */
struct udev {
  int dummy;
};
struct sg_io_v4 {
  int /*<<< orphan*/ response_len;
  scalar_t__ response;
  int /*<<< orphan*/ driver_status;
  int /*<<< orphan*/ transport_status;
  int /*<<< orphan*/ device_status;
};

/* Variables and functions */
int sg_err_category_new(struct udev *, int /*<<< orphan*/, int /*<<< orphan*/,
                        int /*<<< orphan*/, int /*<<< orphan*/, unsigned char *,
                        int /*<<< orphan*/);
int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) {
  return sg_err_category_new(
      udev, hp->device_status, 0, hp->transport_status, hp->driver_status,
      (unsigned char *)(uintptr_t)hp->response, hp->response_len);
}


x86 assembly (clang, -O0):
<sg_err_category4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r9
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
xor    %edx,%edx
mov    %eax,(%rsp)
call   1030 <sg_err_category_new@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_err_category4>:
push   %rax
mov    0x18(%rsi),%eax
mov    0x14(%rsi),%ecx
mov    0x10(%rsi),%r8d
mov    0x8(%rsi),%r9
mov    (%rsi),%edx
mov    %edx,(%rsp)
mov    %eax,%esi
xor    %edx,%edx
call   1030 <sg_err_category_new@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.udev = type { i32 }
%struct.sg_io_v4 = type { i32, i64, i32, i32, i32 }
define i32 @sg_err_category4(%struct.udev* %0, %struct.sg_io_v4* %1) {
%3 = alloca %struct.udev*
%4 = alloca %struct.sg_io_v4*
store %struct.udev* %0, %struct.udev** %3
store %struct.sg_io_v4* %1, %struct.sg_io_v4** %4
%5 = load %struct.udev*, %struct.udev** %3
%6 = load %struct.sg_io_v4*, %struct.sg_io_v4** %4
%7 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %6, i32 0, i32 4
%8 = load i32, i32* %7
%9 = load %struct.sg_io_v4*, %struct.sg_io_v4** %4
%10 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %9, i32 0, i32 3
%11 = load i32, i32* %10
%12 = load %struct.sg_io_v4*, %struct.sg_io_v4** %4
%13 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %12, i32 0, i32 2
%14 = load i32, i32* %13
%15 = load %struct.sg_io_v4*, %struct.sg_io_v4** %4
%16 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %15, i32 0, i32 1
%17 = load i64, i64* %16
%18 = inttoptr i64 %17 to i8*
%19 = load %struct.sg_io_v4*, %struct.sg_io_v4** %4
%20 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = call i32 @sg_err_category_new(%struct.udev* %5, i32 %8, i32 0, i32 %11, i32 %14, i8* %18, i32 %21)
ret i32 %22
}

LLVM IR (-O2):
%struct.udev = type { i32 }
%struct.sg_io_v4 = type { i32, i64, i32, i32, i32 }
define i32 @sg_err_category4(%struct.udev* %0, %struct.sg_io_v4* nocapture %1) {
%3 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %1, i64 0, i32 4
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %1, i64 0, i32 3
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %1, i64 0, i32 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %1, i64 0, i32 1
%10 = load i64, i64* %9
%11 = inttoptr i64 %10 to i8*
%12 = getelementptr inbounds %struct.sg_io_v4, %struct.sg_io_v4* %1, i64 0, i32 0
%13 = load i32, i32* %12
%14 = tail call i32 @sg_err_category_new(%struct.udev* %0, i32 %4, i32 0, i32 %6, i32 %8, i8* %11, i32 %13)
ret i32 %14
}