#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*/ *, int);
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 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *mem_alloc(int);
int /*<<< orphan*/ mem_free(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
scalar_t__ stub1(TYPE_1__ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ xdr_u_int(TYPE_1__ *, int *);
bool_t xdr_array(register XDR *xdrs, caddr_t *addrp, u_int *sizep,
                 u_int maxsize, u_int elsize, xdrproc_t elproc) {
  register u_int i;
  register caddr_t target = *addrp;
  register u_int c;
  register bool_t stat = TRUE;
  register u_int nodesize;
  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);
      }
      memset(target, 0, nodesize);
      break;
    case XDR_FREE:
      return (TRUE);
    case XDR_ENCODE:
      break;
    }
  for (i = 0; (i < c) && stat; i++) {
    stat = (*elproc)(xdrs, target, ((u_int)0 - 1));
    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    0x2e67(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    11b1 <xdr_array+0x61>
mov    0x2e2b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1372 <xdr_array+0x222>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    11e9 <xdr_array+0x99>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
je     11e9 <xdr_array+0x99>
mov    0x2df3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1372 <xdr_array+0x222>
mov    -0x44(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12d3 <xdr_array+0x183>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
sub    $0x80,%eax
je     12b6 <xdr_array+0x166>
jmp    1217 <xdr_array+0xc7>
mov    -0x58(%rbp),%eax
sub    $0x81,%eax
je     12c9 <xdr_array+0x179>
jmp    122a <xdr_array+0xda>
mov    -0x58(%rbp),%eax
sub    $0x82,%eax
jne    12ce <xdr_array+0x17e>
jmp    123d <xdr_array+0xed>
cmpl   $0x0,-0x44(%rbp)
jne    125a <xdr_array+0x10a>
mov    0x2d9a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1372 <xdr_array+0x222>
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    12a3 <xdr_array+0x153>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xd75(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d39(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1372 <xdr_array+0x222>
mov    -0x40(%rbp),%rdi
mov    -0x54(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
jmp    12ce <xdr_array+0x17e>
mov    0x2d2b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1372 <xdr_array+0x222>
jmp    12ce <xdr_array+0x17e>
jmp    12d3 <xdr_array+0x183>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    -0x44(%rbp),%ecx
mov    %al,-0x59(%rbp)
jge    12f6 <xdr_array+0x1a6>
cmpq   $0x0,-0x50(%rbp)
setne  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1306 <xdr_array+0x1b6>
jmp    1340 <xdr_array+0x1f0>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0xffffffff,%edx
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    12da <xdr_array+0x18a>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
jne    136a <xdr_array+0x21a>
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    %r8d,(%rsp)
mov    %ecx,%r13d
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    (%rsi),%rbp
mov    0x2e6b(%rip),%rax
mov    (%rax),%rbx
mov    %rdx,%rsi
call   1070 <xdr_u_int@plt>
test   %eax,%eax
je     1290 <xdr_array+0x140>
mov    (%r14),%r14d
cmp    %r13d,%r14d
jle    11a5 <xdr_array+0x55>
cmpl   $0x80,(%r15)
jne    1290 <xdr_array+0x140>
mov    %r14d,%r13d
mov    (%rsp),%ecx
imul   %ecx,%r13d
test   %rbp,%rbp
je     122c <xdr_array+0xdc>
test   %r14d,%r14d
mov    %r12,0x8(%rsp)
mov    %r13d,0x4(%rsp)
jle    1203 <xdr_array+0xb3>
test   %rbx,%rbx
je     1203 <xdr_array+0xb3>
movslq %ecx,%r13
shl    $0x2,%r13
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0xffffffff,%edx
call   *0x10(%rsp)
mov    %rax,%rbx
cmp    %r14d,%r12d
jge    1203 <xdr_array+0xb3>
add    $0x1,%r12d
add    %r13,%rbp
test   %rbx,%rbx
jne    11e0 <xdr_array+0x90>
cmpl   $0x80,(%r15)
jne    129a <xdr_array+0x14a>
mov    0x8(%rsp),%rbp
mov    0x0(%rbp),%rdi
mov    0x4(%rsp),%esi
call   1030 <mem_free@plt>
movq   $0x0,0x0(%rbp)
jmp    129a <xdr_array+0x14a>
mov    (%r15),%eax
cmp    $0x80,%eax
je     126b <xdr_array+0x11b>
cmp    $0x82,%eax
jne    1274 <xdr_array+0x124>
test   %r14d,%r14d
je     126b <xdr_array+0x11b>
mov    %r13d,%edi
call   1060 <mem_alloc@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     127b <xdr_array+0x12b>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1040 <memset@plt>
mov    (%rsp),%ecx
jmp    11b4 <xdr_array+0x64>
mov    0x2d76(%rip),%rax
jmp    1297 <xdr_array+0x147>
xor    %ebp,%ebp
jmp    11b4 <xdr_array+0x64>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xd75(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d39(%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*, 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*, 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*, i32)* %5, i64 (%struct.TYPE_7__*, i32*, 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 %struct.TYPE_7__*, %struct.TYPE_7__** %8
%23 = load i32*, i32** %10
%24 = call i32 @xdr_u_int(%struct.TYPE_7__* %22, i32* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %6
%27 = load i64, i64* @FALSE
store i64 %27, i64* %7
br label %109
28: ; preds = %6
%29 = load i32*, i32** %10
%30 = load i32, i32* %29
store i32 %30, i32* %16
%31 = load i32, i32* %16
%32 = load i32, i32* %11
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%36 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %35, i32 0, i32 0
%37 = load i32, i32* %36
%38 = icmp ne i32 %37, 128
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i64, i64* @FALSE
store i64 %40, i64* %7
br label %109
41: ; preds = %34, %28
%42 = load i32, i32* %16
%43 = load i32, i32* %12
%44 = mul nsw i32 %42, %43
store i32 %44, i32* %18
%45 = load i32*, i32** %15
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %74
47: ; preds = %41
%48 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%49 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %48, i32 0, i32 0
%50 = load i32, i32* %49
switch i32 %50, label %73 [
i32 130, label %51
i32 128, label %70
i32 129, label %72
]
51: ; preds = %47
%52 = load i32, i32* %16
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = load i64, i64* @TRUE
store i64 %55, i64* %7
br label %109
56: ; preds = %51
%57 = load i32, i32* %18
%58 = call i32* @mem_alloc(i32 %57)
store i32* %58, i32** %15
%59 = load i32**, i32*** %9
store i32* %58, i32** %59
%60 = load i32*, i32** %15
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%65 = load i64, i64* @FALSE
store i64 %65, i64* %7
br label %109
66: ; preds = %56
%67 = load i32*, i32** %15
%68 = load i32, i32* %18
%69 = call i32 @memset(i32* %67, i32 0, i32 %68)
br label %73
70: ; preds = %47
%71 = load i64, i64* @TRUE
store i64 %71, i64* %7
br label %109
72: ; preds = %47
br label %73
73: ; preds = %47, %72, %66
br label %74
74: ; preds = %73, %41
store i32 0, i32* %14
br label %75
75: ; preds = %93, %74
%76 = load i32, i32* %14
%77 = load i32, i32* %16
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %82
79: ; preds = %75
%80 = load i64, i64* %17
%81 = icmp ne i64 %80, 0
br label %82
82: ; preds = %79, %75
%83 = phi i1 [ false, %75 ], [ %81, %79 ]
br i1 %83, label %84, label %96
84: ; preds = %82
%85 = load i64 (%struct.TYPE_7__*, i32*, i32)*, i64 (%struct.TYPE_7__*, i32*, i32)** %13
%86 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%87 = load i32*, i32** %15
%88 = call i64 %85(%struct.TYPE_7__* %86, i32* %87, i32 -1)
store i64 %88, i64* %17
%89 = load i32, i32* %12
%90 = load i32*, i32** %15
%91 = sext i32 %89 to i64
%92 = getelementptr inbounds i32, i32* %90, i64 %91
store i32* %92, i32** %15
br label %93
93: ; preds = %84
%94 = load i32, i32* %14
%95 = add nsw i32 %94, 1
store i32 %95, i32* %14
br label %75
96: ; preds = %82
%97 = load %struct.TYPE_7__*, %struct.TYPE_7__** %8
%98 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %97, i32 0, i32 0
%99 = load i32, i32* %98
%100 = icmp eq i32 %99, 128
br i1 %100, label %101, label %107
101: ; preds = %96
%102 = load i32**, i32*** %9
%103 = load i32*, i32** %102
%104 = load i32, i32* %18
%105 = call i32 @mem_free(i32* %103, i32 %104)
%106 = load i32**, i32*** %9
store i32* null, i32** %106
br label %107
107: ; preds = %101, %96
%108 = load i64, i64* %17
store i64 %108, i64* %7
br label %109
109: ; preds = %107, %70, %62, %54, %39, %26
%110 = load i64, i64* %7
ret i64 %110
}

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