#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 int /*<<< orphan*/ bool_t;
struct TYPE_3__ {
  unsigned int x_handy;
  unsigned int x_private;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ memmove(unsigned int, char const *, unsigned int);
bool_t xdrmem_putbytes(XDR *xdrs, const char *addr, unsigned int len) {
  if (xdrs->x_handy < len)
    return FALSE;
  xdrs->x_handy -= len;
  memmove(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    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jae    1143 <xdrmem_putbytes+0x33>
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <xdrmem_putbytes+0x6c>
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memmove@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
mov    0x2e71(%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   %rbp
push   %rbx
push   %rax
mov    (%rdi),%eax
sub    %edx,%eax
jae    1122 <xdrmem_putbytes+0x12>
mov    0x2eb8(%rip),%rax
jmp    113b <xdrmem_putbytes+0x2b>
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %eax,(%rdi)
mov    0x4(%rdi),%edi
call   1030 <memmove@plt>
add    %ebp,0x4(%rbx)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
%7 = alloca i32
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %5
store i8* %1, i8** %6
store i32 %2, i32* %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 i32, i32* %9
%11 = load i32, i32* %7
%12 = icmp ult i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32, i32* @FALSE
store i32 %14, i32* %4
br label %33
15: ; preds = %3
%16 = load i32, i32* %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 i32, i32* %18
%20 = sub i32 %19, %16
store i32 %20, i32* %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 i32, i32* %7
%26 = call i32 @memmove(i32 %23, i8* %24, i32 %25)
%27 = load i32, i32* %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 = add i32 %30, %27
store i32 %31, i32* %29
%32 = load i32, i32* @TRUE
store i32 %32, i32* %4
br label %33
33: ; preds = %15, %13
%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, i32 %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = icmp ult i32 %5, %2
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = sub i32 %5, %2
store i32 %8, i32* %4
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%10 = load i32, i32* %9
%11 = tail call i32 @memmove(i32 %10, i8* %1, i32 %2)
%12 = load i32, i32* %9
%13 = add i32 %12, %2
store i32 %13, i32* %9
br label %14
14: ; preds = %3, %7
%15 = phi i32* [ @TRUE, %7 ], [ @FALSE, %3 ]
%16 = load i32, i32* %15
ret i32 %16
}