#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;
scalar_t__ xdr_u_long(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
bool_t xdr_pmap(XDR *xdrs, struct pmap *regs) {
  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)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0xc,%rsi
call   1030 <xdr_u_long@plt>
cmp    $0x0,%rax
je     1187 <xdr_pmap+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
call   1030 <xdr_u_long@plt>
cmp    $0x0,%rax
je     1187 <xdr_pmap+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1030 <xdr_u_long@plt>
cmp    $0x0,%rax
je     1187 <xdr_pmap+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <xdr_u_long@plt>
mov    %rax,-0x8(%rbp)
jmp    1195 <xdr_pmap+0x85>
mov    0x2e52(%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
add    $0xc,%rsi
call   1030 <xdr_u_long@plt>
test   %rax,%rax
je     115c <xdr_pmap+0x4c>
lea    0x8(%r14),%rsi
mov    %rbx,%rdi
call   1030 <xdr_u_long@plt>
test   %rax,%rax
je     115c <xdr_pmap+0x4c>
lea    0x4(%r14),%rsi
mov    %rbx,%rdi
call   1030 <xdr_u_long@plt>
test   %rax,%rax
je     115c <xdr_pmap+0x4c>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <xdr_u_long@plt>
mov    0x2e7d(%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 = load %struct.pmap*, %struct.pmap** %5
%8 = getelementptr inbounds %struct.pmap, %struct.pmap* %7, i32 0, i32 3
%9 = call i64 @xdr_u_long(i32* %6, i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = load %struct.pmap*, %struct.pmap** %5
%14 = getelementptr inbounds %struct.pmap, %struct.pmap* %13, i32 0, i32 2
%15 = call i64 @xdr_u_long(i32* %12, i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = load i32*, i32** %4
%19 = load %struct.pmap*, %struct.pmap** %5
%20 = getelementptr inbounds %struct.pmap, %struct.pmap* %19, i32 0, i32 1
%21 = call i64 @xdr_u_long(i32* %18, i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = load i32*, i32** %4
%25 = load %struct.pmap*, %struct.pmap** %5
%26 = getelementptr inbounds %struct.pmap, %struct.pmap* %25, i32 0, i32 0
%27 = call i64 @xdr_u_long(i32* %24, i32* %26)
store i64 %27, i64* %3
br label %30
28: ; preds = %17, %11, %2
%29 = load i64, i64* @FALSE
store i64 %29, i64* %3
br label %30
30: ; preds = %28, %23
%31 = load i64, i64* %3
ret i64 %31
}

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