#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 int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int32_t;
struct TYPE_5__ {
  int x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int /*<<< orphan*/ XDR_GETINT32(TYPE_1__ *, int /*<<< orphan*/ *);
int XDR_PUTINT32(TYPE_1__ *, int /*<<< orphan*/ *);
int xdr_int8_t(XDR *xdrs, int8_t *ip) {
  int32_t t;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    t = (int32_t)*ip;
    return XDR_PUTINT32(xdrs, &t);
  case XDR_DECODE:
    if (!XDR_GETINT32(xdrs, &t))
      return 0;
    *ip = (int8_t)t;
    return 1;
  case XDR_FREE:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<xdr_int8_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     11c4 <xdr_int8_t+0xa4>
jmp    1149 <xdr_int8_t+0x29>
mov    -0x20(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_int8_t+0x4f>
jmp    115c <xdr_int8_t+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x82,%eax
je     118d <xdr_int8_t+0x6d>
jmp    11d0 <xdr_int8_t+0xb0>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <XDR_PUTINT32@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <xdr_int8_t+0xb7>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <XDR_GETINT32@plt>
cmp    $0x0,%eax
jne    11af <xdr_int8_t+0x8f>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <xdr_int8_t+0xb7>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11d7 <xdr_int8_t+0xb7>
movl   $0x1,-0x4(%rbp)
jmp    11d7 <xdr_int8_t+0xb7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_int8_t>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
mov    $0x1,%ebx
cmp    $0x80,%eax
je     1171 <xdr_int8_t+0x51>
mov    %rsi,%r14
cmp    $0x82,%eax
je     1158 <xdr_int8_t+0x38>
cmp    $0x81,%eax
jne    116f <xdr_int8_t+0x4f>
mov    (%r14),%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <XDR_PUTINT32@plt>
mov    %eax,%ebx
jmp    1171 <xdr_int8_t+0x51>
lea    0x4(%rsp),%rsi
call   1040 <XDR_GETINT32@plt>
test   %eax,%eax
je     116f <xdr_int8_t+0x4f>
mov    0x4(%rsp),%eax
mov    %eax,(%r14)
jmp    1171 <xdr_int8_t+0x51>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
define i32 @xdr_int8_t(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca i32
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32* %1, i32** %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 %24 [
i32 129, label %10
i32 130, label %15
i32 128, label %23
]
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%14 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %13, i32* %6)
store i32 %14, i32* %3
br label %25
15: ; preds = %2
%16 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%17 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %16, i32* %6)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i32 0, i32* %3
br label %25
20: ; preds = %15
%21 = load i32, i32* %6
%22 = load i32*, i32** %5
store i32 %21, i32* %22
store i32 1, i32* %3
br label %25
23: ; preds = %2
store i32 1, i32* %3
br label %25
24: ; preds = %2
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23, %20, %19, %10
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
define i32 @xdr_int8_t(%struct.TYPE_5__* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %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 %15 [
i32 129, label %7
i32 130, label %10
i32 128, label %16
]
7: ; preds = %2
%8 = load i32, i32* %1
store i32 %8, i32* %3
%9 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %0, i32* %3)
br label %16
10: ; preds = %2
%11 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %0, i32* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %3
store i32 %14, i32* %1
br label %16
15: ; preds = %2
br label %16
16: ; preds = %2, %10, %15, %13, %7
%17 = phi i32 [ 0, %15 ], [ 1, %13 ], [ %9, %7 ], [ 0, %10 ], [ 1, %2 ]
ret i32 %17
}