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


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     11d3 <xdr_bool+0xd3>
jmp    1129 <xdr_bool+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     114f <xdr_bool+0x4f>
jmp    113c <xdr_bool+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     1184 <xdr_bool+0x84>
jmp    11df <xdr_bool+0xdf>
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),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    11e6 <xdr_bool+0xe6>
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    11af <xdr_bool+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <xdr_bool+0xe6>
mov    -0x20(%rbp),%rdx
mov    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%rdx
cmove  %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11e6 <xdr_bool+0xe6>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <xdr_bool+0xe6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_bool>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%eax
mov    $0x1,%ebx
cmp    $0x80,%eax
je     115c <xdr_bool+0x5c>
mov    %rsi,%r14
cmp    $0x82,%eax
je     113d <xdr_bool+0x3d>
cmp    $0x81,%eax
jne    115a <xdr_bool+0x5a>
xor    %eax,%eax
cmpl   $0x0,(%r14)
setne  %al
mov    %rax,(%rsp)
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *(%rax)
mov    %eax,%ebx
jmp    115c <xdr_bool+0x5c>
mov    0x8(%rdi),%rax
mov    %rsp,%rsi
call   *0x8(%rax)
test   %eax,%eax
je     115a <xdr_bool+0x5a>
xor    %eax,%eax
cmpq   $0x0,(%rsp)
setne  %al
mov    %eax,(%r14)
jmp    115c <xdr_bool+0x5c>
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_bool(%struct.TYPE_7__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_7__*
%5 = alloca i32*
%6 = alloca i64
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 %40 [
i32 129, label %10
i32 130, label %23
i32 128, label %39
]
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_7__*, %struct.TYPE_7__** %4
%17 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %16, i32 0, i32 1
%18 = load %struct.TYPE_6__*, %struct.TYPE_6__** %17
%19 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %18, i32 0, i32 0
%20 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %19
%21 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%22 = call i32 %20(%struct.TYPE_7__* %21, i64* %6)
store i32 %22, i32* %3
br label %41
23: ; preds = %2
%24 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%25 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %24, i32 0, i32 1
%26 = load %struct.TYPE_6__*, %struct.TYPE_6__** %25
%27 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %26, i32 0, i32 1
%28 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %27
%29 = load %struct.TYPE_7__*, %struct.TYPE_7__** %4
%30 = call i32 %28(%struct.TYPE_7__* %29, i64* %6)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %23
store i32 0, i32* %3
br label %41
33: ; preds = %23
%34 = load i64, i64* %6
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 0, i32 1
%38 = load i32*, i32** %5
store i32 %37, i32* %38
store i32 1, i32* %3
br label %41
39: ; preds = %2
store i32 1, i32* %3
br label %41
40: ; preds = %2
store i32 0, i32* %3
br label %41
41: ; preds = %40, %39, %33, %32, %10
%42 = load i32, i32* %3
ret i32 %42
}

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_bool(%struct.TYPE_7__* %0, i32* 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 %27 [
i32 129, label %7
i32 130, label %16
i32 128, label %28
]
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 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%12 = load %struct.TYPE_6__*, %struct.TYPE_6__** %11
%13 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %12, i64 0, i32 0
%14 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %13
%15 = call i32 %14(%struct.TYPE_7__* %0, i64* %3)
br label %28
16: ; preds = %2
%17 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 1
%18 = load %struct.TYPE_6__*, %struct.TYPE_6__** %17
%19 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %18, i64 0, i32 1
%20 = load i32 (%struct.TYPE_7__*, i64*)*, i32 (%struct.TYPE_7__*, i64*)** %19
%21 = call i32 %20(%struct.TYPE_7__* %0, i64* %3)
%22 = icmp eq i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %16
%24 = load i64, i64* %3
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
store i32 %26, i32* %1
br label %28
27: ; preds = %2
br label %28
28: ; preds = %2, %16, %27, %23, %7
%29 = phi i32 [ 0, %27 ], [ 1, %23 ], [ %15, %7 ], [ 0, %16 ], [ 1, %2 ]
ret i32 %29
}