#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ u_int;
typedef int /*<<< orphan*/ bool_t;
struct TYPE_3__ {
  int /*<<< orphan*/ x_private;
  int /*<<< orphan*/ x_handy;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, char const *, scalar_t__);
bool_t xdrmem_putbytes(XDR *xdrs, const char *addr, u_int len) {
  if ((xdrs->x_handy -= len) < 0)
    return FALSE;
  memcpy(xdrs->x_private, addr, len);
  xdrs->x_private += len;
  return TRUE;
}


x86 assembly (clang, -O0):
<xdrmem_putbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
movslq 0x4(%rcx),%rax
sub    %rdx,%rax
mov    %eax,0x4(%rcx)
cmp    $0x0,%eax
jge    1150 <xdrmem_putbytes+0x40>
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <xdrmem_putbytes+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq (%rax),%rcx
add    %rdx,%rcx
mov    %ecx,(%rax)
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrmem_putbytes>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
sub    %r14d,0x4(%rdi)
js     1136 <xdrmem_putbytes+0x26>
mov    %rdi,%rbx
mov    (%rdi),%edi
mov    %r14,%rdx
call   1030 <memcpy@plt>
add    %r14d,(%rbx)
mov    0x2eb4(%rip),%rax
jmp    113d <xdrmem_putbytes+0x2d>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrmem_putbytes(%struct.TYPE_3__* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
%7 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%8 = load i64, i64* %7
%9 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 1
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = sub nsw i64 %12, %8
%14 = trunc i64 %13 to i32
store i32 %14, i32* %10
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = load i32, i32* @FALSE
store i32 %17, i32* %4
br label %33
18: ; preds = %3
%19 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = load i8*, i8** %6
%23 = load i64, i64* %7
%24 = call i32 @memcpy(i32 %21, i8* %22, i64 %23)
%25 = load i64, i64* %7
%26 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = sext i32 %28 to i64
%30 = add nsw i64 %29, %25
%31 = trunc i64 %30 to i32
store i32 %31, i32* %27
%32 = load i32, i32* @TRUE
store i32 %32, i32* %4
br label %33
33: ; preds = %18, %16
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrmem_putbytes(%struct.TYPE_3__* nocapture %0, i8* %1, i64 %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%5 = load i32, i32* %4
%6 = trunc i64 %2 to i32
%7 = sub i32 %5, %6
store i32 %7, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @memcpy(i32 %11, i8* %1, i64 %2)
%13 = load i32, i32* %10
%14 = add i32 %13, %6
store i32 %14, i32* %10
br label %15
15: ; preds = %3, %9
%16 = phi i32* [ @TRUE, %9 ], [ @FALSE, %3 ]
%17 = load i32, i32* %16
ret i32 %17
}