#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*/ writeUtf8Character(int /*<<< orphan*/ *, int /*<<< orphan*/);
int writeUtf8Characters(FILE *stream, const unsigned char *characters,
                        size_t count) {
  const unsigned char *character = characters;
  const unsigned char *end = character + count;
  while (character < end) {
    if (!writeUtf8Character(stream, *character++)) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<writeUtf8Characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    117b <writeUtf8Characters+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movzbl (%rax),%esi
call   1030 <writeUtf8Character@plt>
cmp    $0x0,%eax
jne    1176 <writeUtf8Characters+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1182 <writeUtf8Characters+0x72>
jmp    1138 <writeUtf8Characters+0x28>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeUtf8Characters>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
add    %rsi,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r14,%rbx
jae    114c <writeUtf8Characters+0x3c>
movzbl (%rbx),%esi
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <writeUtf8Character@plt>
test   %eax,%eax
jne    1130 <writeUtf8Characters+0x20>
xor    %eax,%eax
jmp    1151 <writeUtf8Characters+0x41>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @writeUtf8Characters(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%10 = load i8*, i8** %6
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = load i64, i64* %7
%13 = getelementptr inbounds i8, i8* %11, i64 %12
store i8* %13, i8** %9
br label %14
14: ; preds = %27, %3
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = icmp ult i8* %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32*, i32** %5
%20 = load i8*, i8** %8
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %8
%22 = load i8, i8* %20
%23 = zext i8 %22 to i32
%24 = call i32 @writeUtf8Character(i32* %19, i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %18
store i32 0, i32* %4
br label %29
27: ; preds = %18
br label %14
28: ; preds = %14
store i32 1, i32* %4
br label %29
29: ; preds = %28, %26
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @writeUtf8Characters(i32* %0, i8* %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 %2
br label %5
5: ; preds = %8, %3
%6 = phi i8* [ %1, %3 ], [ %9, %8 ]
%7 = icmp ult i8* %6, %4
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = tail call i32 @writeUtf8Character(i32* %0, i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %8
%15 = phi i32 [ 0, %8 ], [ 1, %5 ]
ret i32 %15
}