#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 scalar_t__ int32_t;
typedef int /*<<< orphan*/ UChar;
typedef int /*<<< orphan*/ UBreakIterator;

/* Variables and functions */
scalar_t__ UBRK_DONE;
int /*<<< orphan*/ printTextRange(int /*<<< orphan*/ *, scalar_t__, scalar_t__);
scalar_t__ ubrk_first(int /*<<< orphan*/ *);
scalar_t__ ubrk_next(int /*<<< orphan*/ *);
void printEachForward(UBreakIterator *boundary, UChar *str) {
  int32_t end;
  int32_t start = ubrk_first(boundary);
  for (end = ubrk_next(boundary); end != UBRK_DONE;
       start = end, end = ubrk_next(boundary)) {
    printTextRange(str, start, end);
  }
}


x86 assembly (clang, -O0):
<printEachForward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ubrk_first@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ubrk_next@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%rax
je     1199 <printEachForward+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <printTextRange@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ubrk_next@plt>
mov    %rax,-0x18(%rbp)
jmp    115a <printEachForward+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printEachForward>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <ubrk_first@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1030 <ubrk_next@plt>
mov    0x2e9a(%rip),%r13
cmp    0x0(%r13),%rax
je     1182 <printEachForward+0x52>
mov    %rax,%rbx
nop
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <printTextRange@plt>
mov    %r15,%rdi
call   1030 <ubrk_next@plt>
mov    %rbx,%r12
mov    %rax,%rbx
cmp    0x0(%r13),%rax
jne    1160 <printEachForward+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@UBRK_DONE = global i64 0
define void @printEachForward(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i64
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %3
%8 = call i64 @ubrk_first(i32* %7)
store i64 %8, i64* %6
%9 = load i32*, i32** %3
%10 = call i64 @ubrk_next(i32* %9)
store i64 %10, i64* %5
br label %11
11: ; preds = %20, %2
%12 = load i64, i64* %5
%13 = load i64, i64* @UBRK_DONE
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i64, i64* %6
%18 = load i64, i64* %5
%19 = call i32 @printTextRange(i32* %16, i64 %17, i64 %18)
br label %20
20: ; preds = %15
%21 = load i64, i64* %5
store i64 %21, i64* %6
%22 = load i32*, i32** %3
%23 = call i64 @ubrk_next(i32* %22)
store i64 %23, i64* %5
br label %11
24: ; preds = %11
ret void
}

LLVM IR (-O2):
@UBRK_DONE = global i64 0
define void @printEachForward(i32* %0, i32* %1) {
%3 = tail call i64 @ubrk_first(i32* %0)
%4 = tail call i64 @ubrk_next(i32* %0)
%5 = load i64, i64* @UBRK_DONE
%6 = icmp eq i64 %4, %5
br i1 %6, label %14, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %9, %7 ], [ %3, %2 ]
%9 = phi i64 [ %11, %7 ], [ %4, %2 ]
%10 = tail call i32 @printTextRange(i32* %1, i64 %8, i64 %9)
%11 = tail call i64 @ubrk_next(i32* %0)
%12 = load i64, i64* @UBRK_DONE
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}