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

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ stub1(int /*<<< orphan*/ *, char *);
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)) {
      return (FALSE);
    }
    elptr += elemsize;
  }
  return (TRUE);
}


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    117f <xdr_vector+0x7f>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
jne    1162 <xdr_vector+0x62>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <xdr_vector+0x8b>
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>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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    0x2ed6(%rip),%rbp
test   %rdx,%rdx
jle    114f <xdr_vector+0x4f>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r13
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   *%r15
test   %eax,%eax
je     1148 <xdr_vector+0x48>
add    %r14,%rbx
add    $0xffffffffffffffff,%r12
jne    1130 <xdr_vector+0x30>
jmp    114f <xdr_vector+0x4f>
mov    0x2e89(%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):
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_vector(i32* %0, i8* %1, i64 %2, i64 %3, i32 (i32*, i8*)* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32 (i32*, i8*)*
%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*)* %4, i32 (i32*, i8*)** %11
%14 = load i8*, i8** %8
store i8* %14, i8** %13
store i64 0, i64* %12
br label %15
15: ; preds = %31, %5
%16 = load i64, i64* %12
%17 = load i64, i64* %9
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32 (i32*, i8*)*, i32 (i32*, i8*)** %11
%21 = load i32*, i32** %7
%22 = load i8*, i8** %13
%23 = call i32 %20(i32* %21, i8* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %19
%26 = load i32, i32* @FALSE
store i32 %26, i32* %6
br label %36
27: ; preds = %19
%28 = load i64, i64* %10
%29 = load i8*, i8** %13
%30 = getelementptr inbounds i8, i8* %29, i64 %28
store i8* %30, i8** %13
br label %31
31: ; preds = %27
%32 = load i64, i64* %12
%33 = add nsw i64 %32, 1
store i64 %33, i64* %12
br label %15
34: ; preds = %15
%35 = load i32, i32* @TRUE
store i32 %35, i32* %6
br label %36
36: ; preds = %34, %25
%37 = load i32, i32* %6
ret i32 %37
}

LLVM IR (-O2):
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_vector(i32* %0, i8* %1, i64 %2, i64 %3, i32 (i32*, i8*)* 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)
%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* [ @TRUE, %5 ], [ @TRUE, %12 ], [ @FALSE, %7 ]
%18 = load i32, i32* %17
ret i32 %18
}