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

/* Type definitions */
typedef scalar_t__ u_int;
typedef int /*<<< orphan*/ caddr_t;
typedef int /*<<< orphan*/ bool_t;
struct TYPE_3__ {
  scalar_t__ x_private;
};
typedef TYPE_1__ XDR;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
int fread(int /*<<< orphan*/, int, int, int /*<<< orphan*/ *);
bool_t xdrstdio_getbytes(XDR *xdrs, caddr_t addr, u_int len) {
  if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
    return (FALSE);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdrstdio_getbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1162 <xdrstdio_getbytes+0x52>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     1162 <xdrstdio_getbytes+0x52>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <xdrstdio_getbytes+0x5e>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrstdio_getbytes>:
push   %rax
test   %rdx,%rdx
je     112c <xdrstdio_getbytes+0x1c>
mov    (%rdi),%rcx
mov    %esi,%edi
mov    %edx,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1135 <xdrstdio_getbytes+0x25>
mov    0x2eb5(%rip),%rax
jmp    113c <xdrstdio_getbytes+0x2c>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrstdio_getbytes(%struct.TYPE_3__* %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i32
%7 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i32, i32* %6
%12 = load i64, i64* %7
%13 = trunc i64 %12 to i32
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = inttoptr i64 %16 to i32*
%18 = call i32 @fread(i32 %11, i32 %13, i32 1, i32* %17)
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %10
%21 = load i32, i32* @FALSE
store i32 %21, i32* %4
br label %24
22: ; preds = %10, %3
%23 = load i32, i32* @TRUE
store i32 %23, i32* %4
br label %24
24: ; preds = %22, %20
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrstdio_getbytes(%struct.TYPE_3__* nocapture %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = trunc i64 %2 to i32
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%8 = load i64, i64* %7
%9 = inttoptr i64 %8 to i32*
%10 = tail call i32 @fread(i32 %1, i32 %6, i32 1, i32* %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %5, %3
br label %13
13: ; preds = %5, %12
%14 = phi i32* [ @TRUE, %12 ], [ @FALSE, %5 ]
%15 = load i32, i32* %14
ret i32 %15
}