#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 */

/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t;

/* Variables and functions */
int /*<<< orphan*/ RSTATPROC_HAVEDISK;
int /*<<< orphan*/ RSTATPROG;
int /*<<< orphan*/ RSTATVERS_SWTCH;
scalar_t__ callrpc(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                   int /*<<< orphan*/, int /*<<< orphan*/, char *,
                   int /*<<< orphan*/, char *);
scalar_t__ xdr_long;
scalar_t__ xdr_void;
int havedisk(char *host) {
  long have;
  if (callrpc(host, RSTATPROG, RSTATVERS_SWTCH, RSTATPROC_HAVEDISK,
              (xdrproc_t)xdr_void, (char *)NULL, (xdrproc_t)xdr_long,
              (char *)&have) != 0)
    return (-1);
  else
    return (have);
}


x86 assembly (clang, -O0):
<havedisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
mov    0x2e8f(%rip),%rax
mov    (%rax),%ecx
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r10d
lea    -0x18(%rbp),%rax
xor    %r9d,%r9d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <callrpc@plt>
cmp    $0x0,%rax
je     1180 <havedisk+0x70>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <havedisk+0x77>
mov    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<havedisk>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
mov    0x2e9e(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea5(%rip),%rax
mov    (%rax),%r8d
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r10
xor    %r9d,%r9d
push   %r10
push   %rax
call   1030 <callrpc@plt>
add    $0x10,%rsp
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@RSTATPROG = global i32 0
@RSTATVERS_SWTCH = global i32 0
@RSTATPROC_HAVEDISK = global i32 0
@xdr_void = global i64 0
@xdr_long = global i64 0
define i32 @havedisk(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @RSTATPROG
%7 = load i32, i32* @RSTATVERS_SWTCH
%8 = load i32, i32* @RSTATPROC_HAVEDISK
%9 = load i64, i64* @xdr_void
%10 = trunc i64 %9 to i32
%11 = load i64, i64* @xdr_long
%12 = trunc i64 %11 to i32
%13 = bitcast i64* %4 to i8*
%14 = call i64 @callrpc(i8* %5, i32 %6, i32 %7, i32 %8, i32 %10, i8* null, i32 %12, i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 -1, i32* %2
br label %20
17: ; preds = %1
%18 = load i64, i64* %4
%19 = trunc i64 %18 to i32
store i32 %19, i32* %2
br label %20
20: ; preds = %17, %16
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@RSTATPROG = global i32 0
@RSTATVERS_SWTCH = global i32 0
@RSTATPROC_HAVEDISK = global i32 0
@xdr_void = global i64 0
@xdr_long = global i64 0
define i32 @havedisk(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = load i32, i32* @RSTATPROG
%5 = load i32, i32* @RSTATVERS_SWTCH
%6 = load i32, i32* @RSTATPROC_HAVEDISK
%7 = load i64, i64* @xdr_void
%8 = trunc i64 %7 to i32
%9 = load i64, i64* @xdr_long
%10 = trunc i64 %9 to i32
%11 = call i64 @callrpc(i8* %0, i32 %4, i32 %5, i32 %6, i32 %8, i8* null, i32 %10, i8* %3)
%12 = icmp eq i64 %11, 0
%13 = load i64, i64* %2
%14 = trunc i64 %13 to i32
%15 = select i1 %12, i32 %14, i32 -1
ret i32 %15
}