#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*/ u_long;
typedef int /*<<< orphan*/ u_int16_t;
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_int16_t(XDR *xdrs, u_int16_t *u_int16_p) {
  u_long l;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    l = (u_long)*u_int16_p;
    return (XDR_PUTLONG(xdrs, (long *)&l));
  case XDR_DECODE:
    if (!XDR_GETLONG(xdrs, (long *)&l)) {
      return (FALSE);
    }
    *u_int16_p = (u_int16_t)l;
    return (TRUE);
  case XDR_FREE:
    return (TRUE);
  }
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_u_int16_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x80,%eax
je     11ce <xdr_u_int16_t+0xae>
jmp    1149 <xdr_u_int16_t+0x29>
mov    -0x20(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_u_int16_t+0x4f>
jmp    115c <xdr_u_int16_t+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x82,%eax
je     118d <xdr_u_int16_t+0x6d>
jmp    11df <xdr_u_int16_t+0xbf>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_int16_t+0xcb>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
cmp    $0x0,%eax
jne    11b4 <xdr_u_int16_t+0x94>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_int16_t+0xcb>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_int16_t+0xcb>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11eb <xdr_u_int16_t+0xcb>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_u_int16_t>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1165 <xdr_u_int16_t+0x45>
mov    %rsi,%rbx
cmp    $0x82,%eax
je     1151 <xdr_u_int16_t+0x31>
cmp    $0x81,%eax
jne    116e <xdr_u_int16_t+0x4e>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1040 <XDR_PUTLONG@plt>
jmp    1177 <xdr_u_int16_t+0x57>
lea    0xc(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
test   %eax,%eax
je     116e <xdr_u_int16_t+0x4e>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x2e7c(%rip),%rax
jmp    1175 <xdr_u_int16_t+0x55>
mov    0x2e63(%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_int16_t(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca i32
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 129, label %10
i32 130, label %16
i32 128, label %27
]
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%14 = bitcast i32* %6 to i64*
%15 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %13, i64* %14)
store i32 %15, i32* %3
br label %31
16: ; preds = %2
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%18 = bitcast i32* %6 to i64*
%19 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %17, i64* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = load i32, i32* @FALSE
store i32 %22, i32* %3
br label %31
23: ; preds = %16
%24 = load i32, i32* %6
%25 = load i32*, i32** %5
store i32 %24, i32* %25
%26 = load i32, i32* @TRUE
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, %23, %21, %10
%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_int16_t(%struct.TYPE_5__* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%6 = load i32, i32* %5
switch i32 %6, label %22 [
i32 129, label %7
i32 130, label %11
i32 128, label %20
]
7: ; preds = %2
%8 = load i32, i32* %1
store i32 %8, i32* %3
%9 = bitcast i32* %3 to i64*
%10 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %0, i64* %9)
br label %24
11: ; preds = %2
%12 = bitcast i32* %3 to i64*
%13 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %0, i64* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* @FALSE
br label %24
17: ; preds = %11
%18 = load i32, i32* %3
store i32 %18, i32* %1
%19 = load i32, i32* @TRUE
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, %7
%25 = phi i32 [ %23, %22 ], [ %21, %20 ], [ %19, %17 ], [ %16, %15 ], [ %10, %7 ]
ret i32 %25
}