#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_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ u_short;
typedef int /*<<< orphan*/ u_long;
typedef int /*<<< orphan*/ bool_t;
struct TYPE_7__ {
  int x_op;
  TYPE_1__ *x_ops;
};
typedef TYPE_2__ XDR;
struct TYPE_6__ {
  int /*<<< orphan*/ (*x_getlong)(TYPE_2__ *, long *);
  int /*<<< orphan*/ (*x_putlong)(TYPE_2__ *, long *);
};

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int /*<<< orphan*/ stub1(TYPE_2__ *, long *);
int /*<<< orphan*/ stub2(TYPE_2__ *, long *);
bool_t xdr_u_short(XDR *xdrs, u_short *usp) {
  u_long l;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    l = (u_long)*usp;
    return (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)&l);
  case XDR_DECODE:
    if (!(*(xdrs)->x_ops->x_getlong)(xdrs, (long *)&l)) {
      return FALSE;
    }
    *usp = (u_short)l;
    return TRUE;
  case XDR_FREE:
    return TRUE;
  }
  return FALSE;
}


x86 assembly (clang, -O0):
<xdr_u_short>:
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     11bf <xdr_u_short+0xbf>
jmp    1129 <xdr_u_short+0x29>
mov    -0x20(%rbp),%eax
sub    $0x81,%eax
je     114f <xdr_u_short+0x4f>
jmp    113c <xdr_u_short+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x82,%eax
je     1176 <xdr_u_short+0x76>
jmp    11d0 <xdr_u_short+0xd0>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    11dc <xdr_u_short+0xdc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
jne    11a5 <xdr_u_short+0xa5>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11dc <xdr_u_short+0xdc>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11dc <xdr_u_short+0xdc>
mov    0x2e22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11dc <xdr_u_short+0xdc>
mov    0x2e01(%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_short>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1148 <xdr_u_short+0x48>
mov    %rsi,%rbx
cmp    $0x82,%eax
je     1133 <xdr_u_short+0x33>
cmp    $0x81,%eax
jne    1151 <xdr_u_short+0x51>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
mov    0x8(%rdi),%rax
lea    0xc(%rsp),%rsi
call   *0x8(%rax)
jmp    115a <xdr_u_short+0x5a>
mov    0x8(%rdi),%rax
lea    0xc(%rsp),%rsi
call   *(%rax)
test   %eax,%eax
je     1151 <xdr_u_short+0x51>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x2e99(%rip),%rax
jmp    1158 <xdr_u_short+0x58>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_7__ = type { i32, %struct.TYPE_6__* }
%struct.TYPE_6__ = type { i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)* }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_u_short(%struct.TYPE_7__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_7__*
%5 = alloca i32*
%6 = alloca i32
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 %39 [
i32 129, label %10
i32 130, label %21
i32 128, label %37
]
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%14 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %13, i32 0, i32 1
%15 = load %struct.TYPE_6__*, %struct.TYPE_6__** %14
%16 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %15, i32 0, i32 1
%17 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %16
%18 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%19 = bitcast i32* %6 to i64*
%20 = call i32 %17(%struct.TYPE_7__* %18, i64* %19)
store i32 %20, i32* %3
br label %41
21: ; preds = %2
%22 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%23 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %22, i32 0, i32 1
%24 = load %struct.TYPE_6__*, %struct.TYPE_6__** %23
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %24, i32 0, i32 0
%26 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %25
%27 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%28 = bitcast i32* %6 to i64*
%29 = call i32 %26(%struct.TYPE_7__* %27, i64* %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %21
%32 = load i32, i32* @FALSE
store i32 %32, i32* %3
br label %41
33: ; preds = %21
%34 = load i32, i32* %6
%35 = load i32*, i32** %5
store i32 %34, i32* %35
%36 = load i32, i32* @TRUE
store i32 %36, i32* %3
br label %41
37: ; preds = %2
%38 = load i32, i32* @TRUE
store i32 %38, i32* %3
br label %41
39: ; preds = %2
%40 = load i32, i32* @FALSE
store i32 %40, i32* %3
br label %41
41: ; preds = %39, %37, %33, %31, %10
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i32, %struct.TYPE_6__* }
%struct.TYPE_6__ = type { i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)* }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_u_short(%struct.TYPE_7__* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %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 %30 [
i32 129, label %7
i32 130, label %15
i32 128, label %28
]
7: ; preds = %2
%8 = load i32, i32* %1
store i32 %8, i32* %3
%9 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%10 = load %struct.TYPE_6__*, %struct.TYPE_6__** %9
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %10, i64 0, i32 1
%12 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %11
%13 = bitcast i32* %3 to i64*
%14 = call i32 %12(%struct.TYPE_7__* %0, i64* %13)
br label %32
15: ; preds = %2
%16 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%17 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%18 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %17, i64 0, i32 0
%19 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %18
%20 = bitcast i32* %3 to i64*
%21 = call i32 %19(%struct.TYPE_7__* %0, i64* %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = load i32, i32* @FALSE
br label %32
25: ; preds = %15
%26 = load i32, i32* %3
store i32 %26, i32* %1
%27 = load i32, i32* @TRUE
br label %32
28: ; preds = %2
%29 = load i32, i32* @TRUE
br label %32
30: ; preds = %2
%31 = load i32, i32* @FALSE
br label %32
32: ; preds = %30, %28, %25, %23, %7
%33 = phi i32 [ %31, %30 ], [ %29, %28 ], [ %27, %25 ], [ %24, %23 ], [ %14, %7 ]
ret i32 %33
}