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

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ memmove(char *, int /*<<< orphan*/ *, int);
bool_t xdrmem_putlong_unaligned(XDR *xdrs, const long *lp) {
  u_int32_t l;
  if (xdrs->x_handy < sizeof(int32_t))
    return (FALSE);
  xdrs->x_handy -= sizeof(int32_t);
  l = htonl((u_int32_t)*lp);
  memmove(xdrs->x_private, &l, sizeof(int32_t));
  xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdrmem_putlong_unaligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
cmp    $0x4,%rax
jae    1152 <xdrmem_putlong_unaligned+0x32>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <xdrmem_putlong_unaligned+0x86>
mov    -0x10(%rbp),%rax
movslq (%rax),%rcx
sub    $0x4,%rcx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <htonl@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memmove@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x4,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrmem_putlong_unaligned>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x4,%eax
jae    1135 <xdrmem_putlong_unaligned+0x15>
mov    0x2ea5(%rip),%rax
jmp    1167 <xdrmem_putlong_unaligned+0x47>
mov    %rdi,%rbx
add    $0xfffffffc,%eax
mov    %eax,(%rdi)
mov    (%rsi),%edi
call   1030 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    0x8(%rbx),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memmove@plt>
addq   $0x4,0x8(%rbx)
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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