#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 scalar_t__ u_long;
typedef scalar_t__ u_int;
struct rmtcallargs {
  scalar_t__ arglen;
  int /*<<< orphan*/ args_ptr;
  int /*<<< orphan*/ (*xdr_args)(int /*<<< orphan*/ *, int /*<<< orphan*/);
  scalar_t__ proc;
  scalar_t__ vers;
  scalar_t__ prog;
};
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
scalar_t__ XDR_GETPOS(int /*<<< orphan*/ *);
int /*<<< orphan*/ XDR_SETPOS(int /*<<< orphan*/ *, scalar_t__);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ stub1(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ xdr_u_long(int /*<<< orphan*/ *, scalar_t__ *);
bool_t xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap) {
  u_int lenposition, argposition, position;
  assert(xdrs != NULL);
  assert(cap != NULL);
  if (xdr_u_long(xdrs, &(cap->prog)) && xdr_u_long(xdrs, &(cap->vers)) &&
      xdr_u_long(xdrs, &(cap->proc))) {
    lenposition = XDR_GETPOS(xdrs);
    if (!xdr_u_long(xdrs, &(cap->arglen)))
      return (FALSE);
    argposition = XDR_GETPOS(xdrs);
    if (!(*(cap->xdr_args))(xdrs, cap->args_ptr))
      return (FALSE);
    position = XDR_GETPOS(xdrs);
    cap->arglen = (u_long)position - (u_long)argposition;
    XDR_SETPOS(xdrs, lenposition);
    if (!xdr_u_long(xdrs, &(cap->arglen)))
      return (FALSE);
    XDR_SETPOS(xdrs, position);
    return (TRUE);
  }
  return (FALSE);
}


x86 assembly (clang, -O0):
<xdr_rmtcall_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x28,%rsi
call   1060 <xdr_u_long@plt>
cmp    $0x0,%rax
je     12a5 <xdr_rmtcall_args+0x165>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x20,%rsi
call   1060 <xdr_u_long@plt>
cmp    $0x0,%rax
je     12a5 <xdr_rmtcall_args+0x165>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x18,%rsi
call   1060 <xdr_u_long@plt>
cmp    $0x0,%rax
je     12a5 <xdr_rmtcall_args+0x165>
mov    -0x10(%rbp),%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <xdr_u_long@plt>
cmp    $0x0,%rax
jne    11fa <xdr_rmtcall_args+0xba>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12b1 <xdr_rmtcall_args+0x171>
mov    -0x10(%rbp),%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    0x8(%rcx),%esi
call   *%rax
cmp    $0x0,%eax
jne    1236 <xdr_rmtcall_args+0xf6>
mov    0x2dac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12b1 <xdr_rmtcall_args+0x171>
mov    -0x10(%rbp),%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
sub    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <XDR_SETPOS@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <xdr_u_long@plt>
cmp    $0x0,%rax
jne    1287 <xdr_rmtcall_args+0x147>
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12b1 <xdr_rmtcall_args+0x171>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <XDR_SETPOS@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12b1 <xdr_rmtcall_args+0x171>
mov    0x2d2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_rmtcall_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
lea    0x28(%r14),%rsi
mov    %rbx,%rdi
call   1060 <xdr_u_long@plt>
mov    0x2e58(%rip),%rbp
test   %rax,%rax
je     1222 <xdr_rmtcall_args+0xe2>
lea    0x20(%r14),%rsi
mov    %rbx,%rdi
call   1060 <xdr_u_long@plt>
test   %rax,%rax
je     1222 <xdr_rmtcall_args+0xe2>
lea    0x18(%r14),%rsi
mov    %rbx,%rdi
call   1060 <xdr_u_long@plt>
test   %rax,%rax
je     1222 <xdr_rmtcall_args+0xe2>
mov    %rbx,%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <xdr_u_long@plt>
test   %rax,%rax
je     1222 <xdr_rmtcall_args+0xe2>
mov    %rbx,%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,%r13
mov    0x8(%r14),%esi
mov    %rbx,%rdi
call   *0x10(%r14)
test   %eax,%eax
je     1222 <xdr_rmtcall_args+0xe2>
mov    %rbx,%rdi
call   1030 <XDR_GETPOS@plt>
mov    %rax,%r12
sub    %r13,%rax
mov    %rax,(%r14)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <XDR_SETPOS@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <xdr_u_long@plt>
test   %rax,%rax
je     1222 <xdr_rmtcall_args+0xe2>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <XDR_SETPOS@plt>
mov    0x2dc6(%rip),%rbp
mov    0x0(%rbp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rmtcallargs = type { i64, i32, i32 (i32*, i32)*, i64, i64, i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_rmtcall_args(i32* %0, %struct.rmtcallargs* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca %struct.rmtcallargs*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %4
store %struct.rmtcallargs* %1, %struct.rmtcallargs** %5
%9 = load i32*, i32** %4
%10 = icmp ne i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%14 = icmp ne %struct.rmtcallargs* %13, null
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32*, i32** %4
%18 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%19 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %18, i32 0, i32 5
%20 = call i64 @xdr_u_long(i32* %17, i64* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %81
22: ; preds = %2
%23 = load i32*, i32** %4
%24 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%25 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %24, i32 0, i32 4
%26 = call i64 @xdr_u_long(i32* %23, i64* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %81
28: ; preds = %22
%29 = load i32*, i32** %4
%30 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%31 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %30, i32 0, i32 3
%32 = call i64 @xdr_u_long(i32* %29, i64* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %81
34: ; preds = %28
%35 = load i32*, i32** %4
%36 = call i64 @XDR_GETPOS(i32* %35)
store i64 %36, i64* %6
%37 = load i32*, i32** %4
%38 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%39 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %38, i32 0, i32 0
%40 = call i64 @xdr_u_long(i32* %37, i64* %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %34
%43 = load i32, i32* @FALSE
store i32 %43, i32* %3
br label %83
44: ; preds = %34
%45 = load i32*, i32** %4
%46 = call i64 @XDR_GETPOS(i32* %45)
store i64 %46, i64* %7
%47 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%48 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %47, i32 0, i32 2
%49 = load i32 (i32*, i32)*, i32 (i32*, i32)** %48
%50 = load i32*, i32** %4
%51 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%52 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = call i32 %49(i32* %50, i32 %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %44
%57 = load i32, i32* @FALSE
store i32 %57, i32* %3
br label %83
58: ; preds = %44
%59 = load i32*, i32** %4
%60 = call i64 @XDR_GETPOS(i32* %59)
store i64 %60, i64* %8
%61 = load i64, i64* %8
%62 = load i64, i64* %7
%63 = sub nsw i64 %61, %62
%64 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%65 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %64, i32 0, i32 0
store i64 %63, i64* %65
%66 = load i32*, i32** %4
%67 = load i64, i64* %6
%68 = call i32 @XDR_SETPOS(i32* %66, i64 %67)
%69 = load i32*, i32** %4
%70 = load %struct.rmtcallargs*, %struct.rmtcallargs** %5
%71 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %70, i32 0, i32 0
%72 = call i64 @xdr_u_long(i32* %69, i64* %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %76, label %74
74: ; preds = %58
%75 = load i32, i32* @FALSE
store i32 %75, i32* %3
br label %83
76: ; preds = %58
%77 = load i32*, i32** %4
%78 = load i64, i64* %8
%79 = call i32 @XDR_SETPOS(i32* %77, i64 %78)
%80 = load i32, i32* @TRUE
store i32 %80, i32* %3
br label %83
81: ; preds = %28, %22, %2
%82 = load i32, i32* @FALSE
store i32 %82, i32* %3
br label %83
83: ; preds = %81, %76, %74, %56, %42
%84 = load i32, i32* %3
ret i32 %84
}

LLVM IR (-O2):
%struct.rmtcallargs = type { i64, i32, i32 (i32*, i32)*, i64, i64, i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_rmtcall_args(i32* %0, %struct.rmtcallargs* %1) {
%3 = icmp ne i32* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne %struct.rmtcallargs* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 5
%10 = tail call i64 @xdr_u_long(i32* %0, i64* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %41, label %12
12: ; preds = %2
%13 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 4
%14 = tail call i64 @xdr_u_long(i32* %0, i64* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %41, label %16
16: ; preds = %12
%17 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 3
%18 = tail call i64 @xdr_u_long(i32* %0, i64* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %41, label %20
20: ; preds = %16
%21 = tail call i64 @XDR_GETPOS(i32* %0)
%22 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 0
%23 = tail call i64 @xdr_u_long(i32* %0, i64* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %41, label %25
25: ; preds = %20
%26 = tail call i64 @XDR_GETPOS(i32* %0)
%27 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 2
%28 = load i32 (i32*, i32)*, i32 (i32*, i32)** %27
%29 = getelementptr inbounds %struct.rmtcallargs, %struct.rmtcallargs* %1, i64 0, i32 1
%30 = load i32, i32* %29
%31 = tail call i32 %28(i32* %0, i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %41, label %33
33: ; preds = %25
%34 = tail call i64 @XDR_GETPOS(i32* %0)
%35 = sub nsw i64 %34, %26
store i64 %35, i64* %22
%36 = tail call i32 @XDR_SETPOS(i32* %0, i64 %21)
%37 = tail call i64 @xdr_u_long(i32* %0, i64* %22)
%38 = icmp eq i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %33
%40 = tail call i32 @XDR_SETPOS(i32* %0, i64 %34)
br label %41
41: ; preds = %2, %12, %16, %33, %25, %20, %39
%42 = phi i32* [ @TRUE, %39 ], [ @FALSE, %20 ], [ @FALSE, %25 ], [ @FALSE, %33 ], [ @FALSE, %16 ], [ @FALSE, %12 ], [ @FALSE, %2 ]
%43 = load i32, i32* %42
ret i32 %43
}