#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__ {
  scalar_t__ x_handy;
  int /*<<< orphan*/ x_private;
};
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)
    return FALSE;
  xdrs->x_handy -= len;
  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    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jge    1146 <xdrmem_putbytes+0x36>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <xdrmem_putbytes+0x79>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
sub    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq 0x8(%rax),%rcx
add    %rdx,%rcx
mov    %ecx,0x8(%rax)
mov    0x2e64(%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    (%rdi),%rax
sub    %rdx,%rax
jge    1125 <xdrmem_putbytes+0x15>
mov    0x2eb5(%rip),%rax
jmp    1141 <xdrmem_putbytes+0x31>
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rax,(%rdi)
mov    0x8(%rdi),%edi
call   1030 <memcpy@plt>
add    %r14d,0x8(%rbx)
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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