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

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ htonl(long const);
int /*<<< orphan*/ memcpy(int, int /*<<< orphan*/ *, int);
bool_t xdrmem_putlong_unaligned(XDR *xdrs, const long *lp) {
  int32_t l;
  if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
    return (FALSE);
  l = htonl(*lp);
  memcpy(xdrs->x_private, &l, sizeof(int32_t));
  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),%rcx
movslq (%rcx),%rax
sub    $0x4,%rax
mov    %eax,(%rcx)
cmp    $0x0,%eax
jge    1157 <xdrmem_putlong_unaligned+0x37>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <xdrmem_putlong_unaligned+0x76>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <htonl@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
movslq 0x4(%rax),%rcx
add    $0x4,%rcx
mov    %ecx,0x4(%rax)
mov    0x2e57(%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
addl   $0xfffffffc,(%rdi)
js     1158 <xdrmem_putlong_unaligned+0x38>
mov    %rdi,%rbx
mov    (%rsi),%rdi
call   1030 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    0x4(%rbx),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
addl   $0x4,0x4(%rbx)
mov    0x2e92(%rip),%rax
jmp    115f <xdrmem_putlong_unaligned+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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