#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_5__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ u_long;
typedef int /*<<< orphan*/ bool_t;
struct TYPE_5__ {
  int x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int /*<<< orphan*/ XDR_GETLONG(TYPE_1__ *, long *);
int /*<<< orphan*/ XDR_PUTLONG(TYPE_1__ *, long *);
bool_t xdr_u_long(XDR *xdrs, u_long *ulp) {
  switch (xdrs->x_op) {
  case XDR_DECODE: {
    long int tmp;
    if (XDR_GETLONG(xdrs, &tmp) == FALSE)
      return FALSE;
    *ulp = (uint32_t)tmp;
    return TRUE;
  }
  case XDR_ENCODE:
    if (sizeof(uint32_t) != sizeof(u_long) && (uint32_t)*ulp != *ulp)
      return FALSE;
    return XDR_PUTLONG(xdrs, (long *)ulp);
  case XDR_FREE:
    return TRUE;
  }
  return FALSE;
}


x86 assembly (clang, -O0):
<xdr_u_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x80,%eax
je     11ce <xdr_u_long+0xae>
jmp    1149 <xdr_u_long+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     11b9 <xdr_u_long+0x99>
jmp    115c <xdr_u_long+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
jne    11df <xdr_u_long+0xbf>
jmp    116f <xdr_u_long+0x4f>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
jne    119c <xdr_u_long+0x7c>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_long+0xcb>
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_long+0xcb>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_long+0xcb>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_long+0xcb>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_u_long>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     115a <xdr_u_long+0x3a>
mov    %rsi,%rbx
cmp    $0x81,%eax
je     1163 <xdr_u_long+0x43>
cmp    $0x82,%eax
jne    1170 <xdr_u_long+0x50>
lea    0x8(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
je     1179 <xdr_u_long+0x59>
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
mov    0x2e87(%rip),%rax
jmp    1177 <xdr_u_long+0x57>
mov    %rbx,%rsi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <XDR_PUTLONG@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_u_long(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca i64
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32* %1, i32** %5
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %7, i32 0, i32 0
%9 = load i32, i32* %8
switch i32 %9, label %29 [
i32 130, label %10
i32 129, label %22
i32 128, label %27
]
10: ; preds = %2
%11 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%12 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %11, i64* %6)
%13 = load i32, i32* @FALSE
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i32, i32* @FALSE
store i32 %16, i32* %3
br label %31
17: ; preds = %10
%18 = load i64, i64* %6
%19 = trunc i64 %18 to i32
%20 = load i32*, i32** %5
store i32 %19, i32* %20
%21 = load i32, i32* @TRUE
store i32 %21, i32* %3
br label %31
22: ; preds = %2
%23 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%24 = load i32*, i32** %5
%25 = bitcast i32* %24 to i64*
%26 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %23, i64* %25)
store i32 %26, i32* %3
br label %31
27: ; preds = %2
%28 = load i32, i32* @TRUE
store i32 %28, i32* %3
br label %31
29: ; preds = %2
%30 = load i32, i32* @FALSE
store i32 %30, i32* %3
br label %31
31: ; preds = %29, %27, %22, %17, %15
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_u_long(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i64
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%5 = load i32, i32* %4
switch i32 %5, label %22 [
i32 130, label %6
i32 129, label %17
i32 128, label %20
]
6: ; preds = %2
%7 = bitcast i64* %3 to i8*
%8 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %0, i64* %3)
%9 = load i32, i32* @FALSE
%10 = icmp eq i32 %8, %9
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = load i64, i64* %3
%13 = trunc i64 %12 to i32
store i32 %13, i32* %1
%14 = load i32, i32* @TRUE
br label %15
15: ; preds = %6, %11
%16 = phi i32 [ %14, %11 ], [ %8, %6 ]
br label %24
17: ; preds = %2
%18 = bitcast i32* %1 to i64*
%19 = tail call i32 @XDR_PUTLONG(%struct.TYPE_5__* %0, i64* %18)
br label %24
20: ; preds = %2
%21 = load i32, i32* @TRUE
br label %24
22: ; preds = %2
%23 = load i32, i32* @FALSE
br label %24
24: ; preds = %22, %20, %17, %15
%25 = phi i32 [ %23, %22 ], [ %21, %20 ], [ %19, %17 ], [ %16, %15 ]
ret i32 %25
}