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

/* Type definitions */
typedef int /*<<< orphan*/ bool_t;
struct TYPE_7__ {
  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 *);
int /*<<< orphan*/ xdr_short(TYPE_1__ *, short *);
int /*<<< orphan*/ xdr_u_long(TYPE_1__ *, unsigned long *);
bool_t xdr_u_int(XDR *xdrs, unsigned int *up) {
  if (sizeof(unsigned int) == sizeof(unsigned long)) {
    return (xdr_u_long(xdrs, (unsigned long *)up));
  } else if (sizeof(unsigned int) < sizeof(unsigned long)) {
    unsigned long l;
    switch (xdrs->x_op) {
    case XDR_ENCODE:
      l = (unsigned long)*up;
      return XDR_PUTLONG(xdrs, (long *)&l);
    case XDR_DECODE:
      if (!XDR_GETLONG(xdrs, (long *)&l))
        return FALSE;
      *up = (unsigned int)l;
    case XDR_FREE:
      return TRUE;
    }
    return FALSE;
  } else {
    return (xdr_short(xdrs, (short *)up));
  }
}


x86 assembly (clang, -O0):
<xdr_u_int>:
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     11c1 <xdr_u_int+0xa1>
jmp    1149 <xdr_u_int+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_u_int+0x4f>
jmp    115c <xdr_u_int+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     118e <xdr_u_int+0x6e>
jmp    11d2 <xdr_u_int+0xb2>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %eax,-0x4(%rbp)
jmp    11de <xdr_u_int+0xbe>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
cmp    $0x0,%eax
jne    11b5 <xdr_u_int+0x95>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11de <xdr_u_int+0xbe>
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11de <xdr_u_int+0xbe>
mov    0x2dff(%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_int>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1166 <xdr_u_int+0x46>
mov    %rsi,%rbx
cmp    $0x82,%eax
je     1152 <xdr_u_int+0x32>
cmp    $0x81,%eax
jne    116f <xdr_u_int+0x4f>
mov    (%rbx),%eax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1040 <XDR_PUTLONG@plt>
jmp    1178 <xdr_u_int+0x58>
lea    0x8(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
test   %eax,%eax
je     116f <xdr_u_int+0x4f>
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
mov    0x2e7b(%rip),%rax
jmp    1176 <xdr_u_int+0x56>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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