#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 iovec {
  void *member_0;
  size_t member_1;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ process_vm_writev(int /*<<< orphan*/, struct iovec *, int,
                                     struct iovec *, int, int /*<<< orphan*/);
ssize_t process_vm_write(pid_t pid, void *dest, void *src, size_t n) {
  struct iovec local = {src, n};
  struct iovec remote = {dest, n};
  return process_vm_writev(pid, &local, 1, &remote, 1, 0);
}


x86 assembly (clang, -O0):
<process_vm_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x1,%r8d
lea    -0x40(%rbp),%rcx
xor    %r9d,%r9d
mov    %r8d,%edx
call   1030 <process_vm_writev@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_vm_write>:
sub    $0x28,%rsp
mov    %rdx,0x18(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rcx,0x10(%rsp)
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rcx
mov    $0x1,%edx
mov    $0x1,%r8d
xor    %r9d,%r9d
call   1030 <process_vm_writev@plt>
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
%struct.iovec = type { i8*, i64 }
define i32 @process_vm_write(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca %struct.iovec
%6 = alloca %struct.iovec
%7 = bitcast %struct.iovec* %5 to i8*
%8 = getelementptr inbounds %struct.iovec, %struct.iovec* %5, i64 0, i32 0
store i8* %2, i8** %8
%9 = getelementptr inbounds %struct.iovec, %struct.iovec* %5, i64 0, i32 1
store i64 %3, i64* %9
%10 = bitcast %struct.iovec* %6 to i8*
%11 = getelementptr inbounds %struct.iovec, %struct.iovec* %6, i64 0, i32 0
store i8* %1, i8** %11
%12 = getelementptr inbounds %struct.iovec, %struct.iovec* %6, i64 0, i32 1
store i64 %3, i64* %12
%13 = call i32 @process_vm_writev(i32 %0, %struct.iovec* %5, i32 1, %struct.iovec* %6, i32 1, i32 0)
ret i32 %13
}