#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 */
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ (*xdrproc_t)(TYPE_1__ *, int /*<<< orphan*/ *);
typedef int u_int;
typedef int /*<<< orphan*/ *caddr_t;
typedef scalar_t__ bool_t;
struct TYPE_7__ {
  int x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
scalar_t__ FALSE;
scalar_t__ TRUE;
#define XDR_DECODE 129
#define XDR_FREE 128
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ bzero(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *mem_alloc(int);
int /*<<< orphan*/ mem_free(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
scalar_t__ stub1(TYPE_1__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ xdr_u_int(TYPE_1__ *, int *);
bool_t xdr_array(XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize,
                 u_int elsize, xdrproc_t elproc) {
  u_int i;
  caddr_t target = *addrp;
  u_int c;
  bool_t stat = TRUE;
  u_int nodesize;
  assert(elsize);
  if (!xdr_u_int(xdrs, sizep)) {
    return (FALSE);
  }
  c = *sizep;
  if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
    return (FALSE);
  }
  nodesize = c * elsize;
  if (target == NULL)
    switch (xdrs->x_op) {
    case XDR_DECODE:
      if (c == 0)
        return (TRUE);
      *addrp = target = mem_alloc(nodesize);
      if (target == NULL) {
        (void)fprintf(stderr, "xdr_array: out of memory\n");
        return (FALSE);
      }
      bzero(target, nodesize);
      break;
    case XDR_FREE:
      return (TRUE);
    default:
      break;
    }
  for (i = 0; (i < c) && stat; i++) {
    stat = (*elproc)(xdrs, target);
    target += elsize;
  }
  if (xdrs->x_op == XDR_FREE) {
    mem_free(*addrp, nodesize);
    *addrp = NULL;
  }
  return (stat);
}


x86 assembly (clang, -O0):
<xdr_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    11c9 <xdr_array+0x69>
mov    0x2e13(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <xdr_array+0x210>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    1201 <xdr_array+0xa1>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
je     1201 <xdr_array+0xa1>
mov    0x2ddb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <xdr_array+0x210>
mov    -0x44(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12d6 <xdr_array+0x176>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
sub    $0x80,%eax
je     12b9 <xdr_array+0x159>
jmp    122f <xdr_array+0xcf>
mov    -0x58(%rbp),%eax
sub    $0x81,%eax
jne    12cc <xdr_array+0x16c>
jmp    1242 <xdr_array+0xe2>
cmpl   $0x0,-0x44(%rbp)
jne    125f <xdr_array+0xff>
mov    0x2d95(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <xdr_array+0x210>
mov    -0x54(%rbp),%edi
call   1060 <mem_alloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x40(%rbp)
jne    12a8 <xdr_array+0x148>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xd70(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d34(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <xdr_array+0x210>
mov    -0x40(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1070 <bzero@plt>
jmp    12d1 <xdr_array+0x171>
mov    0x2d28(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1370 <xdr_array+0x210>
jmp    12d1 <xdr_array+0x171>
jmp    12d6 <xdr_array+0x176>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    -0x44(%rbp),%ecx
mov    %al,-0x59(%rbp)
jge    12f9 <xdr_array+0x199>
cmpq   $0x0,-0x50(%rbp)
setne  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1309 <xdr_array+0x1a9>
jmp    133e <xdr_array+0x1de>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   *%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12dd <xdr_array+0x17d>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
jne    1368 <xdr_array+0x208>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x54(%rbp),%esi
call   1030 <mem_free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %ecx,%r14d
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%r15
mov    (%rsi),%rbp
mov    0x2e5f(%rip),%rax
mov    (%rax),%rbx
mov    %r8d,(%rsp)
mov    %r8d,%edi
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <xdr_u_int@plt>
test   %eax,%eax
je     12a9 <xdr_array+0x149>
mov    0x0(%r13),%r13d
cmp    %r14d,%r13d
jle    11c1 <xdr_array+0x61>
cmpl   $0x80,(%r15)
jne    12a9 <xdr_array+0x149>
mov    %r13d,%r14d
mov    (%rsp),%ecx
imul   %ecx,%r14d
test   %rbp,%rbp
je     1247 <xdr_array+0xe7>
test   %r13d,%r13d
mov    %r12,0x8(%rsp)
mov    %r14d,0x4(%rsp)
jle    121e <xdr_array+0xbe>
test   %rbx,%rbx
je     121e <xdr_array+0xbe>
movslq %ecx,%r14
shl    $0x2,%r14
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
call   *0x10(%rsp)
mov    %rax,%rbx
cmp    %r13d,%r12d
jge    121e <xdr_array+0xbe>
add    $0x1,%r12d
add    %r14,%rbp
test   %rbx,%rbx
jne    1200 <xdr_array+0xa0>
cmpl   $0x80,(%r15)
jne    12b3 <xdr_array+0x153>
mov    0x8(%rsp),%rbp
mov    0x0(%rbp),%rdi
mov    0x4(%rsp),%esi
call   1030 <mem_free@plt>
movq   $0x0,0x0(%rbp)
jmp    12b3 <xdr_array+0x153>
mov    (%r15),%eax
cmp    $0x80,%eax
je     1284 <xdr_array+0x124>
cmp    $0x81,%eax
jne    128d <xdr_array+0x12d>
test   %r13d,%r13d
je     1284 <xdr_array+0x124>
mov    %r14d,%edi
call   1060 <mem_alloc@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     1294 <xdr_array+0x134>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r14d,%esi
call   1070 <bzero@plt>
mov    (%rsp),%ecx
jmp    11d0 <xdr_array+0x70>
mov    0x2d5d(%rip),%rax
jmp    12b0 <xdr_array+0x150>
xor    %ebp,%ebp
jmp    11d0 <xdr_array+0x70>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
lea    0xd5c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_7__ = type { i32 }
@TRUE = global i64 0
@FALSE = global i64 0
@stderr = global i32 0
@.str = [26 x i8] c"xdr_array: out of memory\0A\00"
define i64 @xdr_array(%struct.TYPE_7__* %0, i32** %1, i32* %2, i32 %3, i32 %4, i64 (%struct.TYPE_7__*, i32*)* %5) {
%7 = alloca i64
%8 = alloca %struct.TYPE_7__*
%9 = alloca i32**
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64 (%struct.TYPE_7__*, i32*)*
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i64
%18 = alloca i32
store %struct.TYPE_7__* %0, %struct.TYPE_7__** %8
store i32** %1, i32*** %9
store i32* %2, i32** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i64 (%struct.TYPE_7__*, i32*)* %5, i64 (%struct.TYPE_7__*, i32*)** %13
%19 = load i32**, i32*** %9
%20 = load i32*, i32** %19
store i32* %20, i32** %15
%21 = load i64, i64* @TRUE
store i64 %21, i64* %17
%22 = load i32, i32* %12
%23 = call i32 @assert(i32 %22)
%24 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%25 = load i32*, i32** %10
%26 = call i32 @xdr_u_int(%struct.TYPE_7__* %24, i32* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %6
%29 = load i64, i64* @FALSE
store i64 %29, i64* %7
br label %111
30: ; preds = %6
%31 = load i32*, i32** %10
%32 = load i32, i32* %31
store i32 %32, i32* %16
%33 = load i32, i32* %16
%34 = load i32, i32* %11
%35 = icmp sgt i32 %33, %34
br i1 %35, label %36, label %43
36: ; preds = %30
%37 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%38 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %37, i32 0, i32 0
%39 = load i32, i32* %38
%40 = icmp ne i32 %39, 128
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = load i64, i64* @FALSE
store i64 %42, i64* %7
br label %111
43: ; preds = %36, %30
%44 = load i32, i32* %16
%45 = load i32, i32* %12
%46 = mul nsw i32 %44, %45
store i32 %46, i32* %18
%47 = load i32*, i32** %15
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %76
49: ; preds = %43
%50 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%51 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %50, i32 0, i32 0
%52 = load i32, i32* %51
switch i32 %52, label %74 [
i32 129, label %53
i32 128, label %72
]
53: ; preds = %49
%54 = load i32, i32* %16
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = load i64, i64* @TRUE
store i64 %57, i64* %7
br label %111
58: ; preds = %53
%59 = load i32, i32* %18
%60 = call i32* @mem_alloc(i32 %59)
store i32* %60, i32** %15
%61 = load i32**, i32*** %9
store i32* %60, i32** %61
%62 = load i32*, i32** %15
%63 = icmp eq i32* %62, null
br i1 %63, label %64, label %68
64: ; preds = %58
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%67 = load i64, i64* @FALSE
store i64 %67, i64* %7
br label %111
68: ; preds = %58
%69 = load i32*, i32** %15
%70 = load i32, i32* %18
%71 = call i32 @bzero(i32* %69, i32 %70)
br label %75
72: ; preds = %49
%73 = load i64, i64* @TRUE
store i64 %73, i64* %7
br label %111
74: ; preds = %49
br label %75
75: ; preds = %74, %68
br label %76
76: ; preds = %75, %43
store i32 0, i32* %14
br label %77
77: ; preds = %95, %76
%78 = load i32, i32* %14
%79 = load i32, i32* %16
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = load i64, i64* %17
%83 = icmp ne i64 %82, 0
br label %84
84: ; preds = %81, %77
%85 = phi i1 [ false, %77 ], [ %83, %81 ]
br i1 %85, label %86, label %98
86: ; preds = %84
%87 = load i64 (%struct.TYPE_7__*, i32*)*, i64 (%struct.TYPE_7__*, i32*)** %13
%88 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%89 = load i32*, i32** %15
%90 = call i64 %87(%struct.TYPE_7__* %88, i32* %89)
store i64 %90, i64* %17
%91 = load i32, i32* %12
%92 = load i32*, i32** %15
%93 = sext i32 %91 to i64
%94 = getelementptr inbounds i32, i32* %92, i64 %93
store i32* %94, i32** %15
br label %95
95: ; preds = %86
%96 = load i32, i32* %14
%97 = add nsw i32 %96, 1
store i32 %97, i32* %14
br label %77
98: ; preds = %84
%99 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%100 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %99, i32 0, i32 0
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 128
br i1 %102, label %103, label %109
103: ; preds = %98
%104 = load i32**, i32*** %9
%105 = load i32*, i32** %104
%106 = load i32, i32* %18
%107 = call i32 @mem_free(i32* %105, i32 %106)
%108 = load i32**, i32*** %9
store i32* null, i32** %108
br label %109
109: ; preds = %103, %98
%110 = load i64, i64* %17
store i64 %110, i64* %7
br label %111
111: ; preds = %109, %72, %64, %56, %41, %28
%112 = load i64, i64* %7
ret i64 %112
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i32 }
@TRUE = global i64 0
@FALSE = global i64 0
@stderr = global i32 0
@.str = [26 x i8] c"xdr_array: out of memory\0A\00"
define i64 @xdr_array(%struct.TYPE_7__* %0, i32** nocapture %1, i32* %2, i32 %3, i32 %4, i64 (%struct.TYPE_7__*, i32*)* nocapture %5) {
%7 = load i32*, i32** %1
%8 = load i64, i64* @TRUE
%9 = tail call i32 @assert(i32 %4)
%10 = tail call i32 @xdr_u_int(%struct.TYPE_7__* %0, i32* %2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = load i64, i64* @FALSE
br label %68
14: ; preds = %6
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, %3
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 0
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 128
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = load i64, i64* @FALSE
br label %68
23: ; preds = %17, %14
%24 = mul nsw i32 %15, %4
%25 = icmp eq i32* %7, null
br i1 %25, label %26, label %44
26: ; preds = %23
%27 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 0
%28 = load i32, i32* %27
switch i32 %28, label %44 [
i32 129, label %29
i32 128, label %42
]
29: ; preds = %26
%30 = icmp eq i32 %15, 0
br i1 %30, label %31, label %33
31: ; preds = %29
%32 = load i64, i64* @TRUE
br label %68
33: ; preds = %29
%34 = tail call i32* @mem_alloc(i32 %24)
store i32* %34, i32** %1
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = tail call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%39 = load i64, i64* @FALSE
br label %68
40: ; preds = %33
%41 = tail call i32 @bzero(i32* %34, i32 %24)
br label %44
42: ; preds = %26
%43 = load i64, i64* @TRUE
br label %68
44: ; preds = %40, %26, %23
%45 = phi i32* [ null, %26 ], [ %34, %40 ], [ %7, %23 ]
%46 = icmp sgt i32 %15, 0
%47 = icmp ne i64 %8, 0
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %49, label %60
49: ; preds = %44
%50 = sext i32 %4 to i64
br label %51
51: ; preds = %49, %51
%52 = phi i32 [ 0, %49 ], [ %56, %51 ]
%53 = phi i32* [ %45, %49 ], [ %55, %51 ]
%54 = tail call i64 %5(%struct.TYPE_7__* %0, i32* %53)
%55 = getelementptr inbounds i32, i32* %53, i64 %50
%56 = add nuw nsw i32 %52, 1
%57 = icmp slt i32 %56, %15
%58 = icmp ne i64 %54, 0
%59 = select i1 %57, i1 %58, i1 false
br i1 %59, label %51, label %60
60: ; preds = %51, %44
%61 = phi i64 [ %8, %44 ], [ %54, %51 ]
%62 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %0, i64 0, i32 0
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 128
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i32*, i32** %1
%67 = tail call i32 @mem_free(i32* %66, i32 %24)
store i32* null, i32** %1
br label %68
68: ; preds = %60, %65, %42, %36, %31, %21, %12
%69 = phi i64 [ %22, %21 ], [ %43, %42 ], [ %32, %31 ], [ %39, %36 ], [ %13, %12 ], [ %61, %65 ], [ %61, %60 ]
ret i64 %69
}