#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*/ 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 fwrite(char const *, int, int, int /*<<< orphan*/ *);
bool_t xdrstdio_putbytes(XDR *xdrs, const char *addr, u_int len) {
  if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
    return (FALSE);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdrstdio_putbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1164 <xdrstdio_putbytes+0x54>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
cmp    $0x1,%eax
je     1164 <xdrstdio_putbytes+0x54>
mov    0x2e7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <xdrstdio_putbytes+0x60>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrstdio_putbytes>:
push   %rax
test   %rdx,%rdx
je     112d <xdrstdio_putbytes+0x1d>
mov    (%rdi),%rcx
mov    %rsi,%rdi
mov    %edx,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
cmp    $0x1,%eax
jne    1136 <xdrstdio_putbytes+0x26>
mov    0x2eb4(%rip),%rax
jmp    113d <xdrstdio_putbytes+0x2d>
mov    0x2e9b(%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_putbytes(%struct.TYPE_3__* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
%7 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %5
store i8* %1, i8** %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 i8*, i8** %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 @fwrite(i8* %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_putbytes(%struct.TYPE_3__* nocapture %0, i8* nocapture %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 @fwrite(i8* %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
}