#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*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;
struct gpu_mapping {
  int dummy;
};

/* Variables and functions */
void *gpu_mapping_get_data(struct gpu_mapping *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ gpu_mapping_register_write(struct gpu_mapping *,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/, void *);
void gpu_mapping_register_copy(struct gpu_mapping *dst_mapping,
                               uint64_t dst_address,
                               struct gpu_mapping *src_mapping,
                               uint64_t src_address, uint32_t len) {
  void *src = gpu_mapping_get_data(src_mapping, src_address, len);
  gpu_mapping_register_write(dst_mapping, dst_address, len, src);
}


x86 assembly (clang, -O0):
<gpu_mapping_register_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <gpu_mapping_get_data@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <gpu_mapping_register_write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpu_mapping_register_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rdx,%rdi
mov    %ecx,%esi
mov    %r8d,%edx
call   1040 <gpu_mapping_get_data@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %rax,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <gpu_mapping_register_write@plt>

LLVM IR (-O0):
%struct.gpu_mapping = type { i32 }
define void @gpu_mapping_register_copy(%struct.gpu_mapping* %0, i32 %1, %struct.gpu_mapping* %2, i32 %3, i32 %4) {
%6 = alloca %struct.gpu_mapping*
%7 = alloca i32
%8 = alloca %struct.gpu_mapping*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store %struct.gpu_mapping* %0, %struct.gpu_mapping** %6
store i32 %1, i32* %7
store %struct.gpu_mapping* %2, %struct.gpu_mapping** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load %struct.gpu_mapping*, %struct.gpu_mapping** %8
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = call i8* @gpu_mapping_get_data(%struct.gpu_mapping* %12, i32 %13, i32 %14)
store i8* %15, i8** %11
%16 = load %struct.gpu_mapping*, %struct.gpu_mapping** %6
%17 = load i32, i32* %7
%18 = load i32, i32* %10
%19 = load i8*, i8** %11
%20 = call i32 @gpu_mapping_register_write(%struct.gpu_mapping* %16, i32 %17, i32 %18, i8* %19)
ret void
}

LLVM IR (-O2):
%struct.gpu_mapping = type { i32 }
define void @gpu_mapping_register_copy(%struct.gpu_mapping* %0, i32 %1, %struct.gpu_mapping* %2, i32 %3, i32 %4) {
%6 = tail call i8* @gpu_mapping_get_data(%struct.gpu_mapping* %2, i32 %3, i32 %4)
%7 = tail call i32 @gpu_mapping_register_write(%struct.gpu_mapping* %0, i32 %1, i32 %4, i8* %6)
ret void
}