#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;
  scalar_t__ x_private;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ htonl(long const);
bool_t xdrmem_putlong_aligned(XDR *xdrs, const long *lp) {
  if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
    return (FALSE);
  *(int32_t *)xdrs->x_private = htonl(*lp);
  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),%rcx
movslq (%rcx),%rax
sub    $0x4,%rax
mov    %eax,(%rcx)
cmp    $0x0,%eax
jge    1147 <xdrmem_putlong_aligned+0x37>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <xdrmem_putlong_aligned+0x6b>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
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    %rcx,0x8(%rax)
mov    0x2e72(%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
addl   $0xfffffffc,(%rdi)
js     1138 <xdrmem_putlong_aligned+0x28>
mov    %rdi,%rbx
mov    (%rsi),%rdi
call   1030 <htonl@plt>
mov    0x8(%rbx),%rcx
mov    %eax,(%rcx)
add    $0x4,%rcx
mov    %rcx,0x8(%rbx)
mov    0x2eb2(%rip),%rax
jmp    113f <xdrmem_putlong_aligned+0x2f>
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

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

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