#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_long;
struct rmtcallres {
  int /*<<< orphan*/ results_ptr;
  int /*<<< orphan*/ (*xdr_results)(int /*<<< orphan*/ *, int /*<<< orphan*/);
  int /*<<< orphan*/ *port_ptr;
  int /*<<< orphan*/ resultslen;
};
typedef scalar_t__ caddr_t;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ stub1(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ xdr_reference(int /*<<< orphan*/ *, scalar_t__ *, int,
                         int /*<<< orphan*/);
scalar_t__ xdr_u_long(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
bool_t xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp) {
  caddr_t port_ptr;
  assert(xdrs != NULL);
  assert(crp != NULL);
  port_ptr = (caddr_t)(void *)crp->port_ptr;
  if (xdr_reference(xdrs, &port_ptr, sizeof(u_long), (xdrproc_t)xdr_u_long) &&
      xdr_u_long(xdrs, &crp->resultslen)) {
    crp->port_ptr = (u_long *)(void *)port_ptr;
    return ((*(crp->xdr_results))(xdrs, crp->results_ptr));
  }
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_rmtcallres>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
mov    0x2e74(%rip),%rax
mov    %eax,%ecx
call   1030 <xdr_reference@plt>
cmp    $0x0,%rax
je     11c8 <xdr_rmtcallres+0xa8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x18,%rsi
call   1050 <xdr_u_long@plt>
cmp    $0x0,%rax
je     11c8 <xdr_rmtcallres+0xa8>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    (%rcx),%esi
call   *%rax
mov    %eax,-0x4(%rbp)
jmp    11d4 <xdr_rmtcallres+0xb4>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_rmtcallres>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    0x10(%rbx),%rax
mov    %rax,(%rsp)
mov    0x2e94(%rip),%ecx
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <xdr_reference@plt>
test   %rax,%rax
je     118c <xdr_rmtcallres+0x6c>
lea    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1050 <xdr_u_long@plt>
test   %rax,%rax
je     118c <xdr_rmtcallres+0x6c>
mov    (%rsp),%rax
mov    %rax,0x10(%rbx)
mov    (%rbx),%esi
mov    %r14,%rdi
call   *0x8(%rbx)
jmp    1195 <xdr_rmtcallres+0x75>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rmtcallres = type { i32, i32 (i32*, i32)*, i32*, i32 }
@FALSE = global i32 0
define i32 @xdr_rmtcallres(i32* %0, %struct.rmtcallres* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca %struct.rmtcallres*
%6 = alloca i64
store i32* %0, i32** %4
store %struct.rmtcallres* %1, %struct.rmtcallres** %5
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%12 = icmp ne %struct.rmtcallres* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%16 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %15, i32 0, i32 2
%17 = load i32*, i32** %16
%18 = bitcast i32* %17 to i8*
%19 = ptrtoint i8* %18 to i64
store i64 %19, i64* %6
%20 = load i32*, i32** %4
%21 = call i64 @xdr_reference(i32* %20, i64* %6, i32 4, i32 ptrtoint (i64 (i32*, i32*)* @xdr_u_long to i32))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %43
23: ; preds = %2
%24 = load i32*, i32** %4
%25 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%26 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %25, i32 0, i32 3
%27 = call i64 @xdr_u_long(i32* %24, i32* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %23
%30 = load i64, i64* %6
%31 = inttoptr i64 %30 to i8*
%32 = bitcast i8* %31 to i32*
%33 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%34 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %33, i32 0, i32 2
store i32* %32, i32** %34
%35 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%36 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %35, i32 0, i32 1
%37 = load i32 (i32*, i32)*, i32 (i32*, i32)** %36
%38 = load i32*, i32** %4
%39 = load %struct.rmtcallres*, %struct.rmtcallres** %5
%40 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %39, i32 0, i32 0
%41 = load i32, i32* %40
%42 = call i32 %37(i32* %38, i32 %41)
store i32 %42, i32* %3
br label %45
43: ; preds = %23, %2
%44 = load i32, i32* @FALSE
store i32 %44, i32* %3
br label %45
45: ; preds = %43, %29
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
%struct.rmtcallres = type { i32, i32 (i32*, i32)*, i32*, i32 }
@FALSE = global i32 0
define i32 @xdr_rmtcallres(i32* %0, %struct.rmtcallres* %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp ne i32* %0, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp ne %struct.rmtcallres* %1, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %1, i64 0, i32 2
%12 = bitcast i32** %11 to i8**
%13 = load i8*, i8** %12
%14 = ptrtoint i8* %13 to i64
store i64 %14, i64* %3
%15 = call i64 @xdr_reference(i32* %0, i64* %3, i32 4, i32 ptrtoint (i64 (i32*, i32*)* @xdr_u_long to i32))
%16 = icmp eq i64 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %2
%18 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %1, i64 0, i32 3
%19 = call i64 @xdr_u_long(i32* %0, i32* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %17
%22 = load i64, i64* %3
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %11
%24 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %1, i64 0, i32 1
%25 = load i32 (i32*, i32)*, i32 (i32*, i32)** %24
%26 = getelementptr inbounds %struct.rmtcallres, %struct.rmtcallres* %1, i64 0, i32 0
%27 = load i32, i32* %26
%28 = call i32 %25(i32* %0, i32 %27)
br label %31
29: ; preds = %17, %2
%30 = load i32, i32* @FALSE
br label %31
31: ; preds = %29, %21
%32 = phi i32 [ %28, %21 ], [ %30, %29 ]
ret i32 %32
}