#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*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;
typedef int bool_t;
struct TYPE_7__ {
  int x_op;
  TYPE_1__ *x_ops;
};
typedef TYPE_2__ XDR;
struct TYPE_6__ {
  int (*x_putint32)(TYPE_2__ *, int /*<<< orphan*/ *);
  int /*<<< orphan*/ (*x_getint32)(TYPE_2__ *, int /*<<< orphan*/ *);
};

/* Variables and functions */
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int stub1(TYPE_2__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stub2(TYPE_2__ *, int /*<<< orphan*/ *);
bool_t xdr_uint16_t(XDR *xdrs, uint16_t *uip) {
  uint32_t ut;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    ut = (uint32_t)*uip;
    return (*(xdrs)->x_ops->x_putint32)(xdrs, (int32_t *)&ut);
  case XDR_DECODE:
    if (!(*(xdrs)->x_ops->x_getint32)(xdrs, (int32_t *)&ut))
      return 0;
    *uip = (uint16_t)ut;
    return 1;
  case XDR_FREE:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<xdr_uint16_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     11b5 <xdr_uint16_t+0xb5>
jmp    1129 <xdr_uint16_t+0x29>
mov    -0x20(%rbp),%eax
sub    $0x81,%eax
je     114f <xdr_uint16_t+0x4f>
jmp    113c <xdr_uint16_t+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x82,%eax
je     1175 <xdr_uint16_t+0x75>
jmp    11c1 <xdr_uint16_t+0xc1>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    11c8 <xdr_uint16_t+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
jne    11a0 <xdr_uint16_t+0xa0>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <xdr_uint16_t+0xc8>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11c8 <xdr_uint16_t+0xc8>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <xdr_uint16_t+0xc8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_uint16_t>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
mov    $0x1,%ebx
cmp    $0x80,%eax
je     1154 <xdr_uint16_t+0x54>
mov    %rsi,%r14
cmp    $0x82,%eax
je     1139 <xdr_uint16_t+0x39>
cmp    $0x81,%eax
jne    1152 <xdr_uint16_t+0x52>
mov    (%r14),%eax
mov    %eax,0x4(%rsp)
mov    0x8(%rdi),%rax
lea    0x4(%rsp),%rsi
call   *(%rax)
mov    %eax,%ebx
jmp    1154 <xdr_uint16_t+0x54>
mov    0x8(%rdi),%rax
lea    0x4(%rsp),%rsi
call   *0x8(%rax)
test   %eax,%eax
je     1152 <xdr_uint16_t+0x52>
mov    0x4(%rsp),%eax
mov    %eax,(%r14)
jmp    1154 <xdr_uint16_t+0x54>
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_uint16_t(%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 %36 [
i32 129, label %10
i32 130, label %21
i32 128, label %35
]
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 0
%17 = bitcast {}** %16 to i32 (%struct.TYPE_7__*, i32*)**
%18 = load i32 (%struct.TYPE_7__*, i32*)*, i32 (%struct.TYPE_7__*, i32*)** %17
%19 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%20 = call i32 %18(%struct.TYPE_7__* %19, i32* %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__*, i32*)**
%27 = load i32 (%struct.TYPE_7__*, i32*)*, i32 (%struct.TYPE_7__*, i32*)** %26
%28 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%29 = call i32 %27(%struct.TYPE_7__* %28, i32* %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 i32, i32* %6
%34 = load i32*, i32** %5
store i32 %33, i32* %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_uint16_t(%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 %24 [
i32 129, label %7
i32 130, label %14
i32 128, label %25
]
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 = bitcast %struct.TYPE_6__** %9 to i32 (%struct.TYPE_7__*, i32*)***
%11 = load i32 (%struct.TYPE_7__*, i32*)**, i32 (%struct.TYPE_7__*, i32*)*** %10
%12 = load i32 (%struct.TYPE_7__*, i32*)*, i32 (%struct.TYPE_7__*, i32*)** %11
%13 = call i32 %12(%struct.TYPE_7__* %0, i32* %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__*, i32*)**
%19 = load i32 (%struct.TYPE_7__*, i32*)*, i32 (%struct.TYPE_7__*, i32*)** %18
%20 = call i32 %19(%struct.TYPE_7__* %0, i32* %3)
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %14
%23 = load i32, i32* %3
store i32 %23, i32* %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
}