#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 int /*<<< orphan*/ bool_t;
struct TYPE_5__ {
  int x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
#define XDR_DECODE 130
#define XDR_ENCODE 129
#define XDR_FREE 128
int /*<<< orphan*/ rt_free(char *);
int /*<<< orphan*/ rt_kprintf(char *);
scalar_t__ rt_malloc(unsigned int);
int /*<<< orphan*/ xdr_opaque(TYPE_1__ *, char *, unsigned int);
int /*<<< orphan*/ xdr_u_int(TYPE_1__ *, unsigned int *);
bool_t xdr_bytes(XDR *xdrs, char **cpp, unsigned int *sizep,
                 unsigned int maxsize) {
  register char *sp = *cpp;
  register unsigned int nodesize;
  if (!xdr_u_int(xdrs, sizep)) {
    return (FALSE);
  }
  nodesize = *sizep;
  if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
    return (FALSE);
  }
  switch (xdrs->x_op) {
  case XDR_DECODE:
    if (nodesize == 0) {
      return (TRUE);
    }
    if (sp == NULL) {
      *cpp = sp = (char *)rt_malloc(nodesize);
    }
    if (sp == NULL) {
      rt_kprintf("xdr_bytes: out of memory\n");
      return (FALSE);
    }
  case XDR_ENCODE:
    return (xdr_opaque(xdrs, sp, nodesize));
  case XDR_FREE:
    if (sp != NULL) {
      rt_free(sp);
      *cpp = NULL;
    }
    return (TRUE);
  }
  return (FALSE);
}


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    %ecx,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    1199 <xdr_bytes+0x49>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jbe    11cf <xdr_bytes+0x7f>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
je     11cf <xdr_bytes+0x7f>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
sub    $0x80,%eax
je     128f <xdr_bytes+0x13f>
jmp    11e8 <xdr_bytes+0x98>
mov    -0x38(%rbp),%eax
sub    $0x81,%eax
je     1277 <xdr_bytes+0x127>
jmp    11fb <xdr_bytes+0xab>
mov    -0x38(%rbp),%eax
sub    $0x82,%eax
jne    12bf <xdr_bytes+0x16f>
jmp    120e <xdr_bytes+0xbe>
cmpl   $0x0,-0x34(%rbp)
jne    1229 <xdr_bytes+0xd9>
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
cmpq   $0x0,-0x30(%rbp)
jne    124a <xdr_bytes+0xfa>
mov    -0x34(%rbp),%edi
call   1030 <rt_malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x30(%rbp)
jne    1272 <xdr_bytes+0x122>
lea    0xda4(%rip),%rdi
call   1070 <rt_kprintf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
jmp    1277 <xdr_bytes+0x127>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1040 <xdr_opaque@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
cmpq   $0x0,-0x30(%rbp)
je     12ae <xdr_bytes+0x15e>
mov    -0x30(%rbp),%rdi
call   1050 <rt_free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <xdr_bytes+0x17b>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r13
mov    (%rsi),%r14
mov    %rdx,%rsi
call   1060 <xdr_u_int@plt>
test   %eax,%eax
je     1205 <xdr_bytes+0xb5>
mov    (%rbx),%r12d
mov    0x0(%r13),%eax
cmp    %ebp,%r12d
jbe    118e <xdr_bytes+0x3e>
cmp    $0x80,%eax
jne    1205 <xdr_bytes+0xb5>
jmp    11dc <xdr_bytes+0x8c>
cmp    $0x80,%eax
je     11dc <xdr_bytes+0x8c>
cmp    $0x81,%eax
je     11c0 <xdr_bytes+0x70>
cmp    $0x82,%eax
jne    1205 <xdr_bytes+0xb5>
test   %r12d,%r12d
je     11f0 <xdr_bytes+0xa0>
test   %r14,%r14
jne    11c0 <xdr_bytes+0x70>
mov    %r12d,%edi
call   1030 <rt_malloc@plt>
mov    %rax,%r14
mov    %rax,(%r15)
test   %rax,%rax
je     11f9 <xdr_bytes+0xa9>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <xdr_opaque@plt>
test   %r14,%r14
je     11f0 <xdr_bytes+0xa0>
mov    %r14,%rdi
call   1050 <rt_free@plt>
movq   $0x0,(%r15)
mov    0x2df1(%rip),%rax
jmp    120c <xdr_bytes+0xbc>
lea    0xe00(%rip),%rdi
call   1070 <rt_kprintf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
@FALSE = global i32 0
@TRUE = 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, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.TYPE_5__*
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %6
store i8** %1, i8*** %7
store i32* %2, i32** %8
store i32 %3, i32* %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 i32*, i32** %8
%16 = call i32 @xdr_u_int(%struct.TYPE_5__* %14, i32* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %4
%19 = load i32, i32* @FALSE
store i32 %19, i32* %5
br label %73
20: ; preds = %4
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
store i32 %22, i32* %11
%23 = load i32, i32* %11
%24 = load i32, i32* %9
%25 = icmp ugt i32 %23, %24
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 0
%29 = load i32, i32* %28
%30 = icmp ne i32 %29, 128
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = load i32, i32* @FALSE
store i32 %32, i32* %5
br label %73
33: ; preds = %26, %20
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %34, i32 0, i32 0
%36 = load i32, i32* %35
switch i32 %36, label %71 [
i32 130, label %37
i32 129, label %57
i32 128, label %62
]
37: ; preds = %33
%38 = load i32, i32* %11
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = load i32, i32* @TRUE
store i32 %41, i32* %5
br label %73
42: ; preds = %37
%43 = load i8*, i8** %10
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load i32, i32* %11
%47 = call i64 @rt_malloc(i32 %46)
%48 = inttoptr i64 %47 to i8*
store i8* %48, i8** %10
%49 = load i8**, i8*** %7
store i8* %48, i8** %49
br label %50
50: ; preds = %45, %42
%51 = load i8*, i8** %10
%52 = icmp eq i8* %51, null
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i32 @rt_kprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%55 = load i32, i32* @FALSE
store i32 %55, i32* %5
br label %73
56: ; preds = %50
br label %57
57: ; preds = %33, %56
%58 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%59 = load i8*, i8** %10
%60 = load i32, i32* %11
%61 = call i32 @xdr_opaque(%struct.TYPE_5__* %58, i8* %59, i32 %60)
store i32 %61, i32* %5
br label %73
62: ; preds = %33
%63 = load i8*, i8** %10
%64 = icmp ne i8* %63, null
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i8*, i8** %10
%67 = call i32 @rt_free(i8* %66)
%68 = load i8**, i8*** %7
store i8* null, i8** %68
br label %69
69: ; preds = %65, %62
%70 = load i32, i32* @TRUE
store i32 %70, i32* %5
br label %73
71: ; preds = %33
%72 = load i32, i32* @FALSE
store i32 %72, i32* %5
br label %73
73: ; preds = %71, %69, %57, %53, %40, %31, %18
%74 = load i32, i32* %5
ret i32 %74
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
@FALSE = global i32 0
@TRUE = 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, i32* %2, i32 %3) {
%5 = load i8*, i8** %1
%6 = tail call i32 @xdr_u_int(%struct.TYPE_5__* %0, i32* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = load i32, i32* @FALSE
br label %44
10: ; preds = %4
%11 = load i32, i32* %2
%12 = icmp ugt i32 %11, %3
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%14 = load i32, i32* %13
br i1 %12, label %15, label %19
15: ; preds = %10
%16 = icmp eq i32 %14, 128
br i1 %16, label %36, label %17
17: ; preds = %15
%18 = load i32, i32* @FALSE
br label %44
19: ; preds = %10
switch i32 %14, label %42 [
i32 130, label %20
i32 129, label %33
i32 128, label %36
]
20: ; preds = %19
%21 = icmp eq i32 %11, 0
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = load i32, i32* @TRUE
br label %44
24: ; preds = %20
%25 = icmp eq i8* %5, null
br i1 %25, label %26, label %33
26: ; preds = %24
%27 = tail call i64 @rt_malloc(i32 %11)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %1
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = tail call i32 @rt_kprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @FALSE
br label %44
33: ; preds = %24, %26, %19
%34 = phi i8* [ %5, %19 ], [ %28, %26 ], [ %5, %24 ]
%35 = tail call i32 @xdr_opaque(%struct.TYPE_5__* %0, i8* %34, i32 %11)
br label %44
36: ; preds = %15, %19
%37 = icmp eq i8* %5, null
br i1 %37, label %40, label %38
38: ; preds = %36
%39 = tail call i32 @rt_free(i8* %5)
store i8* null, i8** %1
br label %40
40: ; preds = %38, %36
%41 = load i32, i32* @TRUE
br label %44
42: ; preds = %19
%43 = load i32, i32* @FALSE
br label %44
44: ; preds = %42, %40, %33, %30, %22, %17, %8
%45 = phi i32 [ %18, %17 ], [ %43, %42 ], [ %41, %40 ], [ %35, %33 ], [ %23, %22 ], [ %32, %30 ], [ %9, %8 ]
ret i32 %45
}