#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*/ caddr_t;
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*/, int /*<<< orphan*/, scalar_t__);
bool_t xdrmem_getbytes(XDR *xdrs, caddr_t addr, u_int len) {
  if ((xdrs->x_handy -= len) < 0)
    return (FALSE);
  memcpy(addr, xdrs->x_private, len);
  xdrs->x_private += len;
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdrmem_getbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%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    114f <xdrmem_getbytes+0x3f>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <xdrmem_getbytes+0x6d>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
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    0x2e70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrmem_getbytes>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
sub    %r14d,0x4(%rdi)
js     113a <xdrmem_getbytes+0x2a>
mov    %rdi,%rbx
mov    (%rdi),%eax
mov    %esi,%edi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <memcpy@plt>
add    %r14d,(%rbx)
mov    0x2eb0(%rip),%rax
jmp    1141 <xdrmem_getbytes+0x31>
mov    0x2e97(%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_getbytes(%struct.TYPE_3__* %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i32
%7 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %5
store i32 %1, i32* %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 i32, i32* %6
%20 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 0
%22 = load i32, i32* %21
%23 = load i64, i64* %7
%24 = call i32 @memcpy(i32 %19, i32 %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_getbytes(%struct.TYPE_3__* nocapture %0, i32 %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 %1, i32 %11, 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
}