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

/* Variables and functions */
int /*<<< orphan*/ IO_Write_UBYTE(unsigned char, int /*<<< orphan*/ *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int IO_Write_UBYTES(unsigned char *buffer, int number, FILE *fp) {
  assert(buffer && (number > 0) && fp);
  while (number > 0) {
    if (!IO_Write_UBYTE(*buffer, fp))
      return 0;
    buffer++;
    number--;
  }
  return 1;
}


x86 assembly (clang, -O0):
<IO_Write_UBYTES>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     115d <IO_Write_UBYTES+0x3d>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jle    115d <IO_Write_UBYTES+0x3d>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
jle    11b5 <IO_Write_UBYTES+0x95>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x20(%rbp),%rsi
movzbl %al,%edi
call   1030 <IO_Write_UBYTE@plt>
cmp    $0x0,%eax
jne    119b <IO_Write_UBYTES+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    11bc <IO_Write_UBYTES+0x9c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    116a <IO_Write_UBYTES+0x4a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_Write_UBYTES>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %esi,%esi
setg   %cl
and    %al,%cl
test   %rdx,%rdx
setne  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x1,%r15d
test   %ebp,%ebp
jle    1180 <IO_Write_UBYTES+0x60>
add    $0x1,%ebp
nopl   0x0(%rax)
movzbl (%rbx),%edi
mov    %r14,%rsi
call   1030 <IO_Write_UBYTE@plt>
test   %eax,%eax
je     117d <IO_Write_UBYTES+0x5d>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1160 <IO_Write_UBYTES+0x40>
jmp    1180 <IO_Write_UBYTES+0x60>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IO_Write_UBYTES(i8* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32*, i32** %7
%15 = icmp ne i32* %14, null
br label %16
16: ; preds = %13, %10, %3
%17 = phi i1 [ false, %10 ], [ false, %3 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
br label %20
20: ; preds = %30, %16
%21 = load i32, i32* %6
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = load i8*, i8** %5
%25 = load i8, i8* %24
%26 = load i32*, i32** %7
%27 = call i32 @IO_Write_UBYTE(i8 zeroext %25, i32* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %23
store i32 0, i32* %4
br label %36
30: ; preds = %23
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
%33 = load i32, i32* %6
%34 = add nsw i32 %33, -1
store i32 %34, i32* %6
br label %20
35: ; preds = %20
store i32 1, i32* %4
br label %36
36: ; preds = %35, %29
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
define i32 @IO_Write_UBYTES(i8* %0, i32 %1, i32* %2) {
%4 = icmp ne i8* %0, null
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
%7 = icmp ne i32* %2, null
%8 = and i1 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
br i1 %5, label %11, label %21
11: ; preds = %3, %17
%12 = phi i32 [ %19, %17 ], [ %1, %3 ]
%13 = phi i8* [ %18, %17 ], [ %0, %3 ]
%14 = load i8, i8* %13
%15 = tail call i32 @IO_Write_UBYTE(i8 zeroext %14, i32* %2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = getelementptr inbounds i8, i8* %13, i64 1
%19 = add nsw i32 %12, -1
%20 = icmp sgt i32 %12, 1
br i1 %20, label %11, label %21
21: ; preds = %11, %17, %3
%22 = phi i32 [ 1, %3 ], [ 1, %17 ], [ 0, %11 ]
ret i32 %22
}