#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 uint32_t;
typedef int int64_t;
typedef int /*<<< orphan*/ int32_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
int /*<<< orphan*/ XDR_GETINT32(TYPE_1__ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ XDR_PUTINT32(TYPE_1__ *, int /*<<< orphan*/ *);
int xdr_int64_t(XDR *xdrs, int64_t *ip) {
  int32_t t1, t2;
  switch (xdrs->x_op) {
  case XDR_ENCODE:
    t1 = (int32_t)((*ip) >> 32);
    t2 = (int32_t)(*ip);
    return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, &t2));
  case XDR_DECODE:
    if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, &t2))
      return 0;
    *ip = ((int64_t)t1) << 32;
    *ip |= (uint32_t)t2;
    return 1;
  case XDR_FREE:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<xdr_int64_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x80,%eax
je     122c <xdr_int64_t+0x10c>
jmp    1149 <xdr_int64_t+0x29>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     116f <xdr_int64_t+0x4f>
jmp    115c <xdr_int64_t+0x3c>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     11cb <xdr_int64_t+0xab>
jmp    1238 <xdr_int64_t+0x118>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <XDR_PUTINT32@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
je     11bb <xdr_int64_t+0x9b>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <XDR_PUTINT32@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    123f <xdr_int64_t+0x11f>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <XDR_GETINT32@plt>
cmp    $0x0,%eax
je     11f7 <xdr_int64_t+0xd7>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <XDR_GETINT32@plt>
cmp    $0x0,%eax
jne    1203 <xdr_int64_t+0xe3>
movl   $0x0,-0x4(%rbp)
jmp    123f <xdr_int64_t+0x11f>
mov    -0x1c(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    123f <xdr_int64_t+0x11f>
movl   $0x1,-0x4(%rbp)
jmp    123f <xdr_int64_t+0x11f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_int64_t>:
push   %rbx
sub    $0x10,%rsp
mov    (%rdi),%eax
cmp    $0x80,%eax
je     1165 <xdr_int64_t+0x45>
mov    %rdi,%rbx
cmp    $0x82,%eax
je     1169 <xdr_int64_t+0x49>
cmp    $0x81,%eax
jne    118e <xdr_int64_t+0x6e>
mov    (%rsi),%eax
mov    %eax,0x8(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <XDR_PUTINT32@plt>
test   %eax,%eax
je     118e <xdr_int64_t+0x6e>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <XDR_PUTINT32@plt>
jmp    1187 <xdr_int64_t+0x67>
mov    $0x1,%al
jmp    1190 <xdr_int64_t+0x70>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <XDR_GETINT32@plt>
test   %eax,%eax
je     118e <xdr_int64_t+0x6e>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <XDR_GETINT32@plt>
test   %eax,%eax
setne  %al
jmp    1190 <xdr_int64_t+0x70>
xor    %eax,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
define i32 @xdr_int64_t(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32* %1, i32** %5
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i32, i32* %9
switch i32 %10, label %45 [
i32 129, label %11
i32 130, label %27
i32 128, label %44
]
11: ; preds = %2
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = ashr i32 %13, 32
store i32 %14, i32* %6
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
store i32 %16, i32* %7
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%18 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %17, i32* %6)
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %11
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%22 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %21, i32* %7)
%23 = icmp ne i32 %22, 0
br label %24
24: ; preds = %20, %11
%25 = phi i1 [ false, %11 ], [ %23, %20 ]
%26 = zext i1 %25 to i32
store i32 %26, i32* %3
br label %46
27: ; preds = %2
%28 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%29 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %28, i32* %6)
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%33 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %32, i32* %7)
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31, %27
store i32 0, i32* %3
br label %46
36: ; preds = %31
%37 = load i32, i32* %6
%38 = shl i32 %37, 32
%39 = load i32*, i32** %5
store i32 %38, i32* %39
%40 = load i32, i32* %7
%41 = load i32*, i32** %5
%42 = load i32, i32* %41
%43 = or i32 %42, %40
store i32 %43, i32* %41
store i32 1, i32* %3
br label %46
44: ; preds = %2
store i32 1, i32* %3
br label %46
45: ; preds = %2
store i32 0, i32* %3
br label %46
46: ; preds = %45, %44, %36, %35, %24
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
define i32 @xdr_int64_t(%struct.TYPE_5__* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%8 = load i32, i32* %7
switch i32 %8, label %22 [
i32 129, label %9
i32 130, label %16
i32 128, label %23
]
9: ; preds = %2
%10 = load i32, i32* %1
store i32 %10, i32* %4
%11 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %0, i32* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %9
%14 = call i32 @XDR_PUTINT32(%struct.TYPE_5__* %0, i32* %4)
%15 = icmp ne i32 %14, 0
br label %23
16: ; preds = %2
%17 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %0, i32* %3)
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = call i32 @XDR_GETINT32(%struct.TYPE_5__* %0, i32* %4)
%21 = icmp ne i32 %20, 0
br label %23
22: ; preds = %2
br label %23
23: ; preds = %19, %2, %16, %9, %13, %22
%24 = phi i1 [ false, %22 ], [ false, %9 ], [ %15, %13 ], [ false, %16 ], [ true, %2 ], [ %21, %19 ]
%25 = zext i1 %24 to i32
ret i32 %25
}