#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 bool_t;
struct TYPE_7__ {
  int x_op;
  TYPE_1__ *x_ops;
};
typedef TYPE_2__ XDR;
struct TYPE_6__ {
  int (*x_putlong)(TYPE_2__ *, long *);
  int /*<<< orphan*/ (*x_getlong)(TYPE_2__ *, long *);
};

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


x86 assembly (clang, -O0):
<xdr_short>:
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     11bd <xdr_short+0xbd>
jmp    1129 <xdr_short+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     114f <xdr_short+0x4f>
jmp    113c <xdr_short+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     1178 <xdr_short+0x78>
jmp    11c9 <xdr_short+0xc9>
mov    -0x18(%rbp),%rax
movswq (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    11d0 <xdr_short+0xd0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
jne    11a3 <xdr_short+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <xdr_short+0xd0>
mov    -0x20(%rbp),%rax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11d0 <xdr_short+0xd0>
movl   $0x1,-0x4(%rbp)
jmp    11d0 <xdr_short+0xd0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_short>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
mov    $0x1,%ebx
cmp    $0x80,%eax
je     1152 <xdr_short+0x52>
mov    %rsi,%r14
cmp    $0x82,%eax
je     1138 <xdr_short+0x38>
cmp    $0x81,%eax
jne    1150 <xdr_short+0x50>
movswq (%r14),%rax
mov    %rax,(%rsp)
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *(%rax)
mov    %eax,%ebx
jmp    1152 <xdr_short+0x52>
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *0x8(%rax)
test   %eax,%eax
je     1150 <xdr_short+0x50>
movzwl (%rsp),%eax
mov    %ax,(%r14)
jmp    1152 <xdr_short+0x52>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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*)* }
define i32 @xdr_short(%struct.TYPE_7__* %0, i16* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_7__*
%5 = alloca i16*
%6 = alloca i64
store %struct.TYPE_7__* %0, %struct.TYPE_7__** %4
store i16* %1, i16** %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 %36 [
i32 129, label %10
i32 130, label %21
i32 128, label %35
]
10: ; preds = %2
%11 = load i16*, i16** %5
%12 = load i16, i16* %11
%13 = sext i16 %12 to i64
store i64 %13, i64* %6
%14 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%15 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %14, i32 0, i32 1
%16 = load %struct.TYPE_6__*, %struct.TYPE_6__** %15
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %16, i32 0, i32 0
%18 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %17
%19 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%20 = call i32 %18(%struct.TYPE_7__* %19, i64* %6)
store i32 %20, i32* %3
br label %37
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 1
%26 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %25
%27 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%28 = call i32 %26(%struct.TYPE_7__* %27, i64* %6)
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %21
store i32 0, i32* %3
br label %37
31: ; preds = %21
%32 = load i64, i64* %6
%33 = trunc i64 %32 to i16
%34 = load i16*, i16** %5
store i16 %33, i16* %34
store i32 1, i32* %3
br label %37
35: ; preds = %2
store i32 1, i32* %3
br label %37
36: ; preds = %2
store i32 0, i32* %3
br label %37
37: ; preds = %36, %35, %31, %30, %10
%38 = load i32, i32* %3
ret i32 %38
}

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*)* }
define i32 @xdr_short(%struct.TYPE_7__* %0, i16* 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 %25 [
i32 129, label %7
i32 130, label %15
i32 128, label %26
]
7: ; preds = %2
%8 = load i16, i16* %1
%9 = sext i16 %8 to i64
store i64 %9, i64* %3
%10 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%11 = load %struct.TYPE_6__*, %struct.TYPE_6__** %10
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %11, i64 0, i32 0
%13 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %12
%14 = call i32 %13(%struct.TYPE_7__* %0, i64* %3)
br label %26
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 1
%19 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %18
%20 = call i32 %19(%struct.TYPE_7__* %0, i64* %3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %15
%23 = load i64, i64* %3
%24 = trunc i64 %23 to i16
store i16 %24, i16* %1
br label %26
25: ; preds = %2
br label %26
26: ; preds = %2, %15, %25, %22, %7
%27 = phi i32 [ 0, %25 ], [ 1, %22 ], [ %14, %7 ], [ 0, %15 ], [ 1, %2 ]
ret i32 %27
}