#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 blk_io_trace_remap {
  unsigned long long sector_from;
  void *device_to;
  void *device_from;
};

/* Variables and functions */
void *be32_to_cpu(void *);
unsigned long long be64_to_cpu(unsigned long long);
void get_pdu_remap(void *pdu_data, struct blk_io_trace_remap *r) {
  const struct blk_io_trace_remap *__r = pdu_data;
  unsigned long long sector_from = __r->sector_from;
  r->device_from = be32_to_cpu(__r->device_from);
  r->device_to = be32_to_cpu(__r->device_to);
  r->sector_from = be64_to_cpu(sector_from);
}


x86 assembly (clang, -O0):
<get_pdu_remap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <be32_to_cpu@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <be32_to_cpu@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rdi
call   1040 <be64_to_cpu@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pdu_remap>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%r15
mov    0x10(%rdi),%rdi
call   1030 <be32_to_cpu@plt>
mov    %rax,0x10(%r14)
mov    0x8(%rbx),%rdi
call   1030 <be32_to_cpu@plt>
mov    %rax,0x8(%r14)
mov    %r15,%rdi
call   1040 <be64_to_cpu@plt>
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.blk_io_trace_remap = type { i64, i8*, i8* }
define void @get_pdu_remap(i8* %0, %struct.blk_io_trace_remap* %1) {
%3 = alloca i8*
%4 = alloca %struct.blk_io_trace_remap*
%5 = alloca %struct.blk_io_trace_remap*
%6 = alloca i64
store i8* %0, i8** %3
store %struct.blk_io_trace_remap* %1, %struct.blk_io_trace_remap** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.blk_io_trace_remap*
store %struct.blk_io_trace_remap* %8, %struct.blk_io_trace_remap** %5
%9 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %5
%10 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %9, i32 0, i32 0
%11 = load i64, i64* %10
store i64 %11, i64* %6
%12 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %5
%13 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %12, i32 0, i32 2
%14 = load i8*, i8** %13
%15 = call i8* @be32_to_cpu(i8* %14)
%16 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %4
%17 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %16, i32 0, i32 2
store i8* %15, i8** %17
%18 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %5
%19 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %18, i32 0, i32 1
%20 = load i8*, i8** %19
%21 = call i8* @be32_to_cpu(i8* %20)
%22 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %4
%23 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %22, i32 0, i32 1
store i8* %21, i8** %23
%24 = load i64, i64* %6
%25 = call i64 @be64_to_cpu(i64 %24)
%26 = load %struct.blk_io_trace_remap*, %struct.blk_io_trace_remap** %4
%27 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %26, i32 0, i32 0
store i64 %25, i64* %27
ret void
}

LLVM IR (-O2):
%struct.blk_io_trace_remap = type { i64, i8*, i8* }
define void @get_pdu_remap(i8* nocapture %0, %struct.blk_io_trace_remap* nocapture writeonly %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = getelementptr inbounds i8, i8* %0, i64 16
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = tail call i8* @be32_to_cpu(i8* %7)
%9 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %1, i64 0, i32 2
store i8* %8, i8** %9
%10 = getelementptr inbounds i8, i8* %0, i64 8
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
%13 = tail call i8* @be32_to_cpu(i8* %12)
%14 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %1, i64 0, i32 1
store i8* %13, i8** %14
%15 = tail call i64 @be64_to_cpu(i64 %4)
%16 = getelementptr inbounds %struct.blk_io_trace_remap, %struct.blk_io_trace_remap* %1, i64 0, i32 0
store i64 %15, i64* %16
ret void
}