#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_5__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ u_int;
typedef int bool_t;
struct TYPE_5__ {
  int x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
scalar_t__ calloc(int, scalar_t__);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
int xdr_opaque(TYPE_1__ *, char *, scalar_t__);
int /*<<< orphan*/ xdr_u_int(TYPE_1__ *, scalar_t__ *);
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) {
  char *sp = *cpp;
  u_int nodesize;
  if (!xdr_u_int(xdrs, sizep)) {
    return (0);
  }
  nodesize = *sizep;
  if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
    return (0);
  }
  switch (xdrs->x_op) {
  case XDR_DECODE:
    if (nodesize == 0) {
      return (1);
    }
    if (sp == 0) {
      *cpp = sp = (char *)calloc(1, nodesize);
    }
    if (sp == 0) {
      (void)fprintf(stderr, "xdr_bytes: out of memory\n");
      return (0);
    }
  case XDR_ENCODE:
    return (xdr_opaque(xdrs, sp, nodesize));
  case XDR_FREE:
    if (sp != 0) {
      free(sp);
      *cpp = 0;
    }
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<xdr_bytes>:
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    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    1195 <xdr_bytes+0x45>
movl   $0x0,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    11ca <xdr_bytes+0x7a>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
je     11ca <xdr_bytes+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x80,%eax
je     1291 <xdr_bytes+0x141>
jmp    11e3 <xdr_bytes+0x93>
mov    -0x3c(%rbp),%eax
sub    $0x81,%eax
je     1278 <xdr_bytes+0x128>
jmp    11f6 <xdr_bytes+0xa6>
mov    -0x3c(%rbp),%eax
sub    $0x82,%eax
jne    12bc <xdr_bytes+0x16c>
jmp    1209 <xdr_bytes+0xb9>
cmpq   $0x0,-0x38(%rbp)
jne    1220 <xdr_bytes+0xd0>
movl   $0x1,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
cmpq   $0x0,-0x30(%rbp)
jne    1247 <xdr_bytes+0xf7>
mov    -0x38(%rbp),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x30(%rbp)
jne    1273 <xdr_bytes+0x123>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xd9e(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
jmp    1278 <xdr_bytes+0x128>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1060 <xdr_opaque@plt>
mov    %eax,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
cmpq   $0x0,-0x30(%rbp)
je     12b0 <xdr_bytes+0x160>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    12c3 <xdr_bytes+0x173>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_bytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%r13
mov    %rdi,%r14
mov    (%rsi),%rbx
mov    %rdx,%rsi
call   1070 <xdr_u_int@plt>
xor    %ecx,%ecx
test   %eax,%eax
je     1208 <xdr_bytes+0xb8>
mov    %rbx,%rdi
mov    0x0(%rbp),%r12
mov    (%r14),%eax
cmp    %r15,%r12
jle    1194 <xdr_bytes+0x44>
cmp    $0x80,%eax
je     11ec <xdr_bytes+0x9c>
jmp    1208 <xdr_bytes+0xb8>
cmp    $0x80,%eax
je     11ec <xdr_bytes+0x9c>
cmp    $0x81,%eax
je     1219 <xdr_bytes+0xc9>
cmp    $0x82,%eax
jne    1208 <xdr_bytes+0xb8>
test   %r12,%r12
je     1235 <xdr_bytes+0xe5>
mov    %rdi,%rsi
test   %rdi,%rdi
jne    121c <xdr_bytes+0xcc>
mov    $0x1,%edi
mov    %r12,%rsi
call   1040 <calloc@plt>
mov    %rax,%rsi
mov    %rax,0x0(%r13)
test   %rax,%rax
jne    121c <xdr_bytes+0xcc>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
call   1050 <fprintf@plt>
xor    %ecx,%ecx
jmp    1208 <xdr_bytes+0xb8>
mov    $0x1,%ecx
test   %rdi,%rdi
je     1208 <xdr_bytes+0xb8>
call   1030 <free@plt>
mov    $0x1,%ecx
movq   $0x0,0x0(%r13)
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdi,%rsi
mov    %r14,%rdi
mov    %r12,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <xdr_opaque@plt>
mov    $0x1,%ecx
jmp    1208 <xdr_bytes+0xb8>

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

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"xdr_bytes: out of memory\0A\00"
define i32 @xdr_bytes(%struct.TYPE_5__* %0, i8** nocapture %1, i64* %2, i64 %3) {
%5 = load i8*, i8** %1
%6 = tail call i32 @xdr_u_int(%struct.TYPE_5__* %0, i64* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %34, label %8
8: ; preds = %4
%9 = load i64, i64* %2
%10 = icmp sgt i64 %9, %3
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%12 = load i32, i32* %11
br i1 %10, label %13, label %15
13: ; preds = %8
%14 = icmp eq i32 %12, 128
br i1 %14, label %30, label %34
15: ; preds = %8
switch i32 %12, label %34 [
i32 130, label %16
i32 129, label %27
i32 128, label %30
]
16: ; preds = %15
%17 = icmp eq i64 %9, 0
br i1 %17, label %34, label %18
18: ; preds = %16
%19 = icmp eq i8* %5, null
br i1 %19, label %20, label %27
20: ; preds = %18
%21 = tail call i64 @calloc(i32 1, i64 %9)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %1
%23 = icmp eq i64 %21, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %34
27: ; preds = %18, %20, %15
%28 = phi i8* [ %5, %15 ], [ %22, %20 ], [ %5, %18 ]
%29 = tail call i32 @xdr_opaque(%struct.TYPE_5__* %0, i8* %28, i64 %9)
br label %34
30: ; preds = %13, %15
%31 = icmp eq i8* %5, null
br i1 %31, label %34, label %32
32: ; preds = %30
%33 = tail call i32 @free(i8* %5)
store i8* null, i8** %1
br label %34
34: ; preds = %15, %30, %32, %16, %13, %4, %27, %24
%35 = phi i32 [ %29, %27 ], [ 0, %24 ], [ 0, %4 ], [ 0, %13 ], [ 1, %16 ], [ 1, %32 ], [ 1, %30 ], [ 0, %15 ]
ret i32 %35
}