#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*/ 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_bool(XDR *xdrs, bool_t *bp) {
  long lb;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    lb = *bp ? ((long)1) : ((long)0);
    return XDR_PUTLONG(xdrs, &lb);
  case XDR_DECODE:
    if (!XDR_GETLONG(xdrs, &lb)) {
      return FALSE;
    }
    *bp = (lb == ((long)0)) ? FALSE : TRUE;
    return TRUE;
  case XDR_FREE:
    return TRUE;
  }
  return FALSE;
}


x86 assembly (clang, -O0):
<xdr_bool>:
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     1205 <xdr_bool+0xe5>
jmp    1149 <xdr_bool+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_bool+0x4f>
jmp    115c <xdr_bool+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     119c <xdr_bool+0x7c>
jmp    1216 <xdr_bool+0xf6>
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <XDR_PUTLONG@plt>
mov    %eax,-0x4(%rbp)
jmp    1222 <xdr_bool+0x102>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_GETLONG@plt>
cmp    $0x0,%eax
jne    11c3 <xdr_bool+0xa3>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <xdr_bool+0x102>
cmpq   $0x0,-0x20(%rbp)
jne    11df <xdr_bool+0xbf>
mov    0x2e03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    11eb <xdr_bool+0xcb>
mov    0x2e02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <xdr_bool+0x102>
mov    0x2ddc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <xdr_bool+0x102>
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_bool>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1158 <xdr_bool+0x38>
mov    %rsi,%rbx
cmp    $0x82,%eax
je     1161 <xdr_bool+0x41>
cmp    $0x81,%eax
jne    118e <xdr_bool+0x6e>
xor    %eax,%eax
cmpl   $0x0,(%rbx)
setne  %al
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1040 <XDR_PUTLONG@plt>
jmp    1197 <xdr_bool+0x77>
mov    0x2e89(%rip),%rax
jmp    1195 <xdr_bool+0x75>
lea    0x8(%rsp),%rsi
call   1030 <XDR_GETLONG@plt>
test   %eax,%eax
je     118e <xdr_bool+0x6e>
cmpq   $0x0,0x8(%rsp)
mov    0x2e6c(%rip),%rax
mov    %rax,%rcx
jne    1188 <xdr_bool+0x68>
mov    0x2e50(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rbx)
jmp    1195 <xdr_bool+0x75>
mov    0x2e43(%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_bool(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca i64
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 %37 [
i32 129, label %10
i32 130, label %18
i32 128, label %35
]
10: ; preds = %2
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i64 1, i64 0
store i64 %15, i64* %6
%16 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%17 = call i32 @XDR_PUTLONG(%struct.TYPE_5__* %16, i64* %6)
store i32 %17, i32* %3
br label %39
18: ; preds = %2
%19 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%20 = call i32 @XDR_GETLONG(%struct.TYPE_5__* %19, i64* %6)
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = load i32, i32* @FALSE
store i32 %23, i32* %3
br label %39
24: ; preds = %18
%25 = load i64, i64* %6
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = load i32, i32* @FALSE
br label %31
29: ; preds = %24
%30 = load i32, i32* @TRUE
br label %31
31: ; preds = %29, %27
%32 = phi i32 [ %28, %27 ], [ %30, %29 ]
%33 = load i32*, i32** %5
store i32 %32, i32* %33
%34 = load i32, i32* @TRUE
store i32 %34, i32* %3
br label %39
35: ; preds = %2
%36 = load i32, i32* @TRUE
store i32 %36, i32* %3
br label %39
37: ; preds = %2
%38 = load i32, i32* @FALSE
store i32 %38, i32* %3
br label %39
39: ; preds = %37, %35, %31, %22, %10
%40 = load i32, i32* %3
ret i32 %40
}

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