#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 */
struct pmap {
  int /*<<< orphan*/ pm_port;
  int /*<<< orphan*/ pm_prot;
  int /*<<< orphan*/ pm_vers;
  int /*<<< orphan*/ pm_prog;
};
typedef scalar_t__ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
scalar_t__ FALSE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ xdr_u_long(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
bool_t xdr_pmap(XDR *xdrs, struct pmap *regs) {
  assert(xdrs != NULL);
  assert(regs != NULL);
  if (xdr_u_long(xdrs, &regs->pm_prog) && xdr_u_long(xdrs, &regs->pm_vers) &&
      xdr_u_long(xdrs, &regs->pm_prot))
    return (xdr_u_long(xdrs, &regs->pm_port));
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_pmap>:
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   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0xc,%rsi
call   1040 <xdr_u_long@plt>
cmp    $0x0,%rax
je     11bb <xdr_pmap+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
call   1040 <xdr_u_long@plt>
cmp    $0x0,%rax
je     11bb <xdr_pmap+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1040 <xdr_u_long@plt>
cmp    $0x0,%rax
je     11bb <xdr_pmap+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <xdr_u_long@plt>
mov    %rax,-0x8(%rbp)
jmp    11c9 <xdr_pmap+0xa9>
mov    0x2e1e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_pmap>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
lea    0xc(%r14),%rsi
mov    %rbx,%rdi
call   1040 <xdr_u_long@plt>
test   %rax,%rax
je     118b <xdr_pmap+0x6b>
lea    0x8(%r14),%rsi
mov    %rbx,%rdi
call   1040 <xdr_u_long@plt>
test   %rax,%rax
je     118b <xdr_pmap+0x6b>
lea    0x4(%r14),%rsi
mov    %rbx,%rdi
call   1040 <xdr_u_long@plt>
test   %rax,%rax
je     118b <xdr_pmap+0x6b>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <xdr_u_long@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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