#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 */

/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t;
typedef int /*<<< orphan*/ u_int;
typedef int bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ xdr_bool(int /*<<< orphan*/ *, int *);
int xdr_reference(int /*<<< orphan*/ *, char **, int /*<<< orphan*/,
                  int /*<<< orphan*/);
bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj) {
  bool_t more_data;
  more_data = (*objpp != NULL);
  if (!xdr_bool(xdrs, &more_data))
    return 0;
  if (!more_data) {
    *objpp = NULL;
    return 1;
  }
  return xdr_reference(xdrs, objpp, obj_size, xdr_obj);
}


x86 assembly (clang, -O0):
<xdr_pointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <xdr_bool@plt>
cmp    $0x0,%eax
jne    116b <xdr_pointer+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <xdr_pointer+0x82>
cmpl   $0x0,-0x24(%rbp)
jne    118c <xdr_pointer+0x6c>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11a2 <xdr_pointer+0x82>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <xdr_reference@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_pointer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %eax,%eax
cmpq   $0x0,(%rsi)
setne  %al
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1040 <xdr_bool@plt>
test   %eax,%eax
je     1168 <xdr_pointer+0x48>
cmpl   $0x0,0x4(%rsp)
je     116c <xdr_pointer+0x4c>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <xdr_reference@plt>
jmp    1178 <xdr_pointer+0x58>
xor    %eax,%eax
jmp    1178 <xdr_pointer+0x58>
movq   $0x0,(%rbx)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xdr_pointer(i32* %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i8** %1, i8*** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i8**, i8*** %7
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i32
store i32 %14, i32* %10
%15 = load i32*, i32** %6
%16 = call i32 @xdr_bool(i32* %15, i32* %10)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %4
store i32 0, i32* %5
br label %30
19: ; preds = %4
%20 = load i32, i32* %10
%21 = icmp ne i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = load i8**, i8*** %7
store i8* null, i8** %23
store i32 1, i32* %5
br label %30
24: ; preds = %19
%25 = load i32*, i32** %6
%26 = load i8**, i8*** %7
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = call i32 @xdr_reference(i32* %25, i8** %26, i32 %27, i32 %28)
store i32 %29, i32* %5
br label %30
30: ; preds = %24, %22, %18
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @xdr_pointer(i32* %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = load i8*, i8** %1
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
store i32 %9, i32* %5
%10 = call i32 @xdr_bool(i32* %0, i32* %5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %4
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i8* null, i8** %1
br label %18
16: ; preds = %12
%17 = call i32 @xdr_reference(i32* %0, i8** %1, i32 %2, i32 %3)
br label %18
18: ; preds = %4, %16, %15
%19 = phi i32 [ %17, %16 ], [ 1, %15 ], [ 0, %4 ]
ret i32 %19
}