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


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     11b9 <xdr_int16_t+0xb9>
jmp    1129 <xdr_int16_t+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     114f <xdr_int16_t+0x4f>
jmp    113c <xdr_int16_t+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     1177 <xdr_int16_t+0x77>
jmp    11c5 <xdr_int16_t+0xc5>
mov    -0x18(%rbp),%rax
mov    (%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    11cc <xdr_int16_t+0xcc>
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    11a2 <xdr_int16_t+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11cc <xdr_int16_t+0xcc>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11cc <xdr_int16_t+0xcc>
movl   $0x1,-0x4(%rbp)
jmp    11cc <xdr_int16_t+0xcc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_int16_t>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
mov    $0x1,%ebx
cmp    $0x80,%eax
je     1150 <xdr_int16_t+0x50>
mov    %rsi,%r14
cmp    $0x82,%eax
je     1137 <xdr_int16_t+0x37>
cmp    $0x81,%eax
jne    114e <xdr_int16_t+0x4e>
mov    (%r14),%rax
mov    %rax,(%rsp)
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *(%rax)
mov    %eax,%ebx
jmp    1150 <xdr_int16_t+0x50>
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *0x8(%rax)
test   %eax,%eax
je     114e <xdr_int16_t+0x4e>
mov    (%rsp),%rax
mov    %rax,(%r14)
jmp    1150 <xdr_int16_t+0x50>
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 { {}*, {}* }
define i32 @xdr_int16_t(%struct.TYPE_7__* %0, i64* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_7__*
%5 = alloca i64*
%6 = alloca i64
store %struct.TYPE_7__* %0, %struct.TYPE_7__** %4
store i64* %1, i64** %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 i64*, i64** %5
%12 = load i64, i64* %11
store i64 %12, i64* %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 0
%17 = bitcast {}** %16 to i32 (%struct.TYPE_7__*, i64*)**
%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 = bitcast {}** %25 to i32 (%struct.TYPE_7__*, i64*)**
%27 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %26
%28 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%29 = call i32 %27(%struct.TYPE_7__* %28, i64* %6)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %21
store i32 0, i32* %3
br label %37
32: ; preds = %21
%33 = load i64, i64* %6
%34 = load i64*, i64** %5
store i64 %33, i64* %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, %32, %31, %10
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i32, %struct.TYPE_6__* }
%struct.TYPE_6__ = type { {}*, {}* }
define i32 @xdr_int16_t(%struct.TYPE_7__* %0, i64* 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 %24 [
i32 129, label %7
i32 130, label %14
i32 128, label %25
]
7: ; preds = %2
%8 = load i64, i64* %1
store i64 %8, i64* %3
%9 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%10 = bitcast %struct.TYPE_6__** %9 to i32 (%struct.TYPE_7__*, i64*)***
%11 = load i32 (%struct.TYPE_7__*, i64*)**, i32 (%struct.TYPE_7__*, i64*)*** %10
%12 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %11
%13 = call i32 %12(%struct.TYPE_7__* %0, i64* %3)
br label %25
14: ; preds = %2
%15 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%16 = load %struct.TYPE_6__*, %struct.TYPE_6__** %15
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %16, i64 0, i32 1
%18 = bitcast {}** %17 to i32 (%struct.TYPE_7__*, i64*)**
%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 %25, label %22
22: ; preds = %14
%23 = load i64, i64* %3
store i64 %23, i64* %1
br label %25
24: ; preds = %2
br label %25
25: ; preds = %2, %14, %24, %22, %7
%26 = phi i32 [ 0, %24 ], [ 1, %22 ], [ %13, %7 ], [ 0, %14 ], [ 1, %2 ]
ret i32 %26
}