#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)(int /*<<< orphan*/ *, char *,
                                        scalar_t__);
typedef scalar_t__ u_int;
typedef int bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ stub1(int /*<<< orphan*/ *, char *, scalar_t__);
bool_t xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize,
                  xdrproc_t xdr_elem) {
  u_int i;
  char *elptr;
  elptr = basep;
  for (i = 0; i < nelem; i++) {
    if (!(*xdr_elem)(xdrs, elptr, ((u_int)((int)0 - 1))))
      return 0;
    elptr += elemsize;
  }
  return 1;
}


x86 assembly (clang, -O0):
<xdr_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1181 <xdr_vector+0x81>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0xffffffffffffffff,%rdx
call   *%rax
cmp    $0x0,%eax
jne    1164 <xdr_vector+0x64>
movl   $0x0,-0x4(%rbp)
jmp    1188 <xdr_vector+0x88>
mov    -0x28(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    112c <xdr_vector+0x2c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_vector>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %rdx,%rdx
jle    1152 <xdr_vector+0x52>
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0xffffffffffffffff,%rdx
call   *%r12
test   %eax,%eax
je     114f <xdr_vector+0x4f>
add    %r15,%rbx
add    $0xffffffffffffffff,%rbp
jne    1130 <xdr_vector+0x30>
jmp    1152 <xdr_vector+0x52>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xdr_vector(i32* %0, i8* %1, i64 %2, i64 %3, i32 (i32*, i8*, i64)* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32 (i32*, i8*, i64)*
%12 = alloca i64
%13 = alloca i8*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i32 (i32*, i8*, i64)* %4, i32 (i32*, i8*, i64)** %11
%14 = load i8*, i8** %8
store i8* %14, i8** %13
store i64 0, i64* %12
br label %15
15: ; preds = %30, %5
%16 = load i64, i64* %12
%17 = load i64, i64* %9
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i32 (i32*, i8*, i64)*, i32 (i32*, i8*, i64)** %11
%21 = load i32*, i32** %7
%22 = load i8*, i8** %13
%23 = call i32 %20(i32* %21, i8* %22, i64 -1)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %19
store i32 0, i32* %6
br label %34
26: ; preds = %19
%27 = load i64, i64* %10
%28 = load i8*, i8** %13
%29 = getelementptr inbounds i8, i8* %28, i64 %27
store i8* %29, i8** %13
br label %30
30: ; preds = %26
%31 = load i64, i64* %12
%32 = add nsw i64 %31, 1
store i64 %32, i64* %12
br label %15
33: ; preds = %15
store i32 1, i32* %6
br label %34
34: ; preds = %33, %25
%35 = load i32, i32* %6
ret i32 %35
}

LLVM IR (-O2):
define i32 @xdr_vector(i32* %0, i8* %1, i64 %2, i64 %3, i32 (i32*, i8*, i64)* nocapture %4) {
%6 = icmp sgt i64 %2, 0
br i1 %6, label %7, label %16
7: ; preds = %5, %12
%8 = phi i8* [ %13, %12 ], [ %1, %5 ]
%9 = phi i64 [ %14, %12 ], [ 0, %5 ]
%10 = tail call i32 %4(i32* %0, i8* %8, i64 -1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %8, i64 %3
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %2
br i1 %15, label %16, label %7
16: ; preds = %7, %12, %5
%17 = phi i32 [ 1, %5 ], [ 1, %12 ], [ 0, %7 ]
ret i32 %17
}