#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 scalar_t__ 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_int16_t(XDR *xdrs, int16_t *int16_p) {
  long l;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    l = (long)*int16_p;
    return (XDR_PUTLONG(xdrs, &l));
  case XDR_DECODE:
    if (!XDR_GETLONG(xdrs, &l)) {
      return (FALSE);
    }
    *int16_p = (int16_t)l;
    return (TRUE);
  case XDR_FREE:
    return (TRUE);
  }
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_int16_t>:
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     11d2 <xdr_int16_t+0xb2>
jmp    1149 <xdr_int16_t+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_int16_t+0x4f>
jmp    115c <xdr_int16_t+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     118f <xdr_int16_t+0x6f>
jmp    11e3 <xdr_int16_t+0xc3>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %eax,-0x4(%rbp)
jmp    11ef <xdr_int16_t+0xcf>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
cmp    $0x0,%eax
jne    11b6 <xdr_int16_t+0x96>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <xdr_int16_t+0xcf>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <xdr_int16_t+0xcf>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <xdr_int16_t+0xcf>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_int16_t>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1169 <xdr_int16_t+0x49>
mov    %rsi,%rbx
cmp    $0x82,%eax
je     1153 <xdr_int16_t+0x33>
cmp    $0x81,%eax
jne    1172 <xdr_int16_t+0x52>
mov    (%rbx),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1040 <XDR_PUTLONG@plt>
jmp    117b <xdr_int16_t+0x5b>
lea    0x8(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
test   %eax,%eax
je     1172 <xdr_int16_t+0x52>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    0x2e78(%rip),%rax
jmp    1179 <xdr_int16_t+0x59>
mov    0x2e5f(%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_int16_t(%struct.TYPE_5__* %0, i64* %1) {
%3 = alloca i32
%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 i32, i32* %8
switch i32 %9, label %27 [
i32 129, label %10
i32 130, label %15
i32 128, label %25
]
10: ; preds = %2
%11 = load i64*, i64** %5
%12 = load i64, i64* %11
store i64 %12, i64* %6
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%14 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %13, i64* %6)
store i32 %14, i32* %3
br label %29
15: ; preds = %2
%16 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%17 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %16, i64* %6)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = load i32, i32* @FALSE
store i32 %20, i32* %3
br label %29
21: ; preds = %15
%22 = load i64, i64* %6
%23 = load i64*, i64** %5
store i64 %22, i64* %23
%24 = load i32, i32* @TRUE
store i32 %24, i32* %3
br label %29
25: ; preds = %2
%26 = load i32, i32* @TRUE
store i32 %26, i32* %3
br label %29
27: ; preds = %2
%28 = load i32, i32* @FALSE
store i32 %28, i32* %3
br label %29
29: ; preds = %27, %25, %21, %19, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_int16_t(%struct.TYPE_5__* %0, i64* nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %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 %20 [
i32 129, label %7
i32 130, label %10
i32 128, label %18
]
7: ; preds = %2
%8 = load i64, i64* %1
store i64 %8, i64* %3
%9 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %0, i64* %3)
br label %22
10: ; preds = %2
%11 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %0, i64* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* @FALSE
br label %22
15: ; preds = %10
%16 = load i64, i64* %3
store i64 %16, i64* %1
%17 = load i32, i32* @TRUE
br label %22
18: ; preds = %2
%19 = load i32, i32* @TRUE
br label %22
20: ; preds = %2
%21 = load i32, i32* @FALSE
br label %22
22: ; preds = %20, %18, %15, %13, %7
%23 = phi i32 [ %21, %20 ], [ %19, %18 ], [ %17, %15 ], [ %14, %13 ], [ %9, %7 ]
ret i32 %23
}