#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*/);
bool_t xdrmem_putlong_aligned(XDR *xdrs, const long *lp) {
  if (xdrs->x_handy < sizeof(int32_t))
    return (FALSE);
  xdrs->x_handy -= sizeof(int32_t);
  *(u_int32_t *)xdrs->x_private = htonl((u_int32_t)*lp);
  xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdrmem_putlong_aligned>:
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    1142 <xdrmem_putlong_aligned+0x32>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <xdrmem_putlong_aligned+0x79>
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,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x4,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,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_putlong_aligned>:
push   %rbx
mov    (%rdi),%eax
cmp    $0x4,%eax
jae    1121 <xdrmem_putlong_aligned+0x11>
mov    0x2eb9(%rip),%rax
jmp    1145 <xdrmem_putlong_aligned+0x35>
mov    %rdi,%rbx
add    $0xfffffffc,%eax
mov    %eax,(%rdi)
mov    (%rsi),%edi
call   1030 <htonl@plt>
mov    0x8(%rbx),%rcx
mov    %eax,(%rcx)
add    $0x4,%rcx
mov    %rcx,0x8(%rbx)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

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

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