#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 unsigned long uint32_t;
typedef scalar_t__ bool_t;
struct TYPE_5__ {
  scalar_t__ x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
scalar_t__ FALSE;
scalar_t__ TRUE;
scalar_t__ XDR_DECODE;
scalar_t__ XDR_ENCODE;
scalar_t__ XDR_FREE;
scalar_t__ XDR_GETLONG(TYPE_1__ *, long *);
scalar_t__ XDR_PUTLONG(TYPE_1__ *, long *);
bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp) {
  if (xdrs->x_op == XDR_DECODE) {
    long l;
    if (XDR_GETLONG(xdrs, &l) == FALSE)
      return FALSE;
    *ulp = (uint32_t)l;
    return TRUE;
  }
  if (xdrs->x_op == XDR_ENCODE) {
    if (sizeof(uint32_t) != sizeof(unsigned long) && (uint32_t)*ulp != *ulp)
      return FALSE;
    return (XDR_PUTLONG(xdrs, (long *)ulp));
  }
  if (xdrs->x_op == XDR_FREE)
    return (TRUE);
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_u_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2eb2(%rip),%rcx
cmp    (%rcx),%rax
jne    1195 <xdr_u_long+0x75>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%rax
jne    1177 <xdr_u_long+0x57>
mov    0x2e55(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11fa <xdr_u_long+0xda>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e57(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11fa <xdr_u_long+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2e35(%rip),%rcx
cmp    (%rcx),%rax
jne    11c2 <xdr_u_long+0xa2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %rax,-0x8(%rbp)
jmp    11fa <xdr_u_long+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2df8(%rip),%rcx
cmp    (%rcx),%rax
jne    11ec <xdr_u_long+0xcc>
mov    0x2e00(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11fa <xdr_u_long+0xda>
mov    0x2dcd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_u_long>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    (%rdi),%rax
mov    0x2ebe(%rip),%rcx
cmp    (%rcx),%rax
jne    115e <xdr_u_long+0x3e>
lea    0x8(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
je     1196 <xdr_u_long+0x76>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    0x2e84(%rip),%rax
jmp    1193 <xdr_u_long+0x73>
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
jne    1177 <xdr_u_long+0x57>
mov    %rbx,%rsi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <XDR_PUTLONG@plt>
mov    0x2e4a(%rip),%rcx
cmp    (%rcx),%rax
jne    118c <xdr_u_long+0x6c>
mov    0x2e56(%rip),%rax
jmp    1193 <xdr_u_long+0x73>
mov    0x2e2d(%rip),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64 }
@XDR_DECODE = global i64 0
@FALSE = global i64 0
@TRUE = global i64 0
@XDR_ENCODE = global i64 0
@XDR_FREE = global i64 0
define i64 @xdr_u_long(%struct.TYPE_5__* %0, i64* %1) {
%3 = alloca i64
%4 = alloca %struct.TYPE_5__*
%5 = alloca i64*
%6 = alloca i64
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i64* %1, i64** %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 i64, i64* %8
%10 = load i64, i64* @XDR_DECODE
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%14 = call i64 @XDR_GETLONG(%struct.TYPE_5__* %13, i64* %6)
%15 = load i64, i64* @FALSE
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i64, i64* @FALSE
store i64 %18, i64* %3
br label %43
19: ; preds = %12
%20 = load i64, i64* %6
%21 = load i64*, i64** %5
store i64 %20, i64* %21
%22 = load i64, i64* @TRUE
store i64 %22, i64* %3
br label %43
23: ; preds = %2
%24 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %24, i32 0, i32 0
%26 = load i64, i64* %25
%27 = load i64, i64* @XDR_ENCODE
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%31 = load i64*, i64** %5
%32 = call i64 @XDR_PUTLONG(%struct.TYPE_5__* %30, i64* %31)
store i64 %32, i64* %3
br label %43
33: ; preds = %23
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %34, i32 0, i32 0
%36 = load i64, i64* %35
%37 = load i64, i64* @XDR_FREE
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = load i64, i64* @TRUE
store i64 %40, i64* %3
br label %43
41: ; preds = %33
%42 = load i64, i64* @FALSE
store i64 %42, i64* %3
br label %43
43: ; preds = %41, %39, %29, %19, %17
%44 = load i64, i64* %3
ret i64 %44
}

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