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

/* Variables and functions */
int /*<<< orphan*/ UBRK_SENTENCE;
int /*<<< orphan*/ UBRK_WORD;
scalar_t__ U_FAILURE(int /*<<< orphan*/);
int /*<<< orphan*/ U_ZERO_ERROR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printAt(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printEachBackward(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ printEachForward(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printFirst(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printLast(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
char *u_errorName(int /*<<< orphan*/);
int u_strlen(int /*<<< orphan*/ *);
int /*<<< orphan*/ u_uastrcpy(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ubrk_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ubrk_open(int /*<<< orphan*/, char *, int /*<<< orphan*/ *,
                              int, int /*<<< orphan*/ *);
int c_main(void) {
  UBreakIterator *boundary;
  char cStringToExamine[] = "Aaa bbb ccc. Ddd eee fff.";
  UChar stringToExamine[sizeof(cStringToExamine) + 1];
  UErrorCode status = U_ZERO_ERROR;
  printf("\n\n"
         "C Boundary Analysis\n"
         "-------------------\n\n");
  printf("Examining: %s\n", cStringToExamine);
  u_uastrcpy(stringToExamine, cStringToExamine);
  boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine, -1, &status);
  if (U_FAILURE(status)) {
    printf("ubrk_open error: %s\n", u_errorName(status));
    exit(1);
  }
  printf("\n----- Sentence Boundaries, forward: -----------\n");
  printEachForward(boundary, stringToExamine);
  printf("\n----- Sentence Boundaries, backward: ----------\n");
  printEachBackward(boundary, stringToExamine);
  ubrk_close(boundary);
  boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine,
                       u_strlen(stringToExamine), &status);
  printf("\n----- Word Boundaries, forward: -----------\n");
  printEachForward(boundary, stringToExamine);
  printf("\n----- Word Boundaries, backward: ----------\n");
  printEachBackward(boundary, stringToExamine);
  printf("\n----- first: -------------\n");
  printFirst(boundary, stringToExamine);
  printf("\n----- last: --------------\n");
  printLast(boundary, stringToExamine);
  printf("\n----- at pos 10: ---------\n");
  printAt(boundary, 10, stringToExamine);
  ubrk_close(boundary);
  printf("\nEnd of C boundary analysis\n");
  return 0;
}


x86 assembly (clang, -O0):
<c_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0xe1e(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe1b(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe18(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe15(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <u_uastrcpy@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    -0xa0(%rbp),%rdx
lea    0xdf8(%rip),%rsi
mov    $0xffffffff,%ecx
lea    -0xa4(%rbp),%r8
call   10e0 <ubrk_open@plt>
mov    %rax,-0x8(%rbp)
mov    -0xa4(%rbp),%edi
call   1050 <U_FAILURE@plt>
cmp    $0x0,%rax
je     12ad <c_main+0xdd>
mov    -0xa4(%rbp),%edi
call   1030 <u_errorName@plt>
mov    %rax,%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1070 <printEachForward@plt>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10b0 <printEachBackward@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <ubrk_close@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb4(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
lea    -0xa0(%rbp),%rdi
call   10c0 <u_strlen@plt>
mov    -0xb4(%rbp),%edi
mov    -0xb0(%rbp),%rdx
mov    %eax,%ecx
lea    0xd24(%rip),%rsi
lea    -0xa4(%rbp),%r8
call   10e0 <ubrk_open@plt>
mov    %rax,-0x8(%rbp)
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1070 <printEachForward@plt>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10b0 <printEachBackward@plt>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10a0 <printFirst@plt>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1080 <printLast@plt>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
mov    $0xa,%esi
call   1090 <printAt@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <ubrk_close@plt>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
movups 0xe19(%rip),%xmm0
movups %xmm0,0x1a(%rsp)
movaps 0xe03(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0xe2e(%rip),%rdi
call   1050 <puts@plt>
lea    0xdf8(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <u_uastrcpy@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
lea    0xc(%rsp),%r8
mov    %r14,%rdx
mov    $0xffffffff,%ecx
call   10f0 <ubrk_open@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%edi
call   1060 <U_FAILURE@plt>
test   %rax,%rax
jne    1378 <c_main+0x198>
lea    0xdf0(%rip),%rdi
call   1050 <puts@plt>
lea    0x30(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <printEachForward@plt>
lea    0xe05(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <printEachBackward@plt>
mov    %rbx,%rdi
call   10e0 <ubrk_close@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
call   10d0 <u_strlen@plt>
lea    0xd5e(%rip),%rsi
lea    0xc(%rsp),%r8
mov    %ebx,%edi
mov    %r14,%rdx
mov    %eax,%ecx
call   10f0 <ubrk_open@plt>
mov    %rax,%rbx
lea    0xdeb(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <printEachForward@plt>
lea    0xe01(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <printEachBackward@plt>
lea    0xe17(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <printFirst@plt>
lea    0xe1c(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <printLast@plt>
lea    0xe21(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %r14,%rdx
call   10a0 <printAt@plt>
mov    %rbx,%rdi
call   10e0 <ubrk_close@plt>
lea    0xe19(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret
mov    0xc(%rsp),%edi
call   1030 <u_errorName@plt>
lea    0xca7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@__const.c_main.cStringToExamine = [26 x i8] c"Aaa bbb ccc. Ddd eee fff.\00"
@U_ZERO_ERROR = global i32 0
@.str = [44 x i8] c"\0A\0AC Boundary Analysis\0A-------------------\0A\0A\00"
@.str.1 = [15 x i8] c"Examining: %s\0A\00"
@UBRK_SENTENCE = global i32 0
@.str.2 = [6 x i8] c"en_us\00"
@.str.3 = [21 x i8] c"ubrk_open error: %s\0A\00"
@.str.4 = [50 x i8] c"\0A----- Sentence Boundaries, forward: -----------\0A\00"
@.str.5 = [50 x i8] c"\0A----- Sentence Boundaries, backward: ----------\0A\00"
@UBRK_WORD = global i32 0
@.str.6 = [46 x i8] c"\0A----- Word Boundaries, forward: -----------\0A\00"
@.str.7 = [46 x i8] c"\0A----- Word Boundaries, backward: ----------\0A\00"
@.str.8 = [29 x i8] c"\0A----- first: -------------\0A\00"
@.str.9 = [29 x i8] c"\0A----- last: --------------\0A\00"
@.str.10 = [29 x i8] c"\0A----- at pos 10: ---------\0A\00"
@.str.11 = [29 x i8] c"\0AEnd of C boundary analysis\0A\00"
define i32 @c_main() {
%1 = alloca i32*
%2 = alloca [26 x i8]
%3 = alloca [27 x i32]
%4 = alloca i32
%5 = bitcast [26 x i8]* %2 to i8*
%6 = load i32, i32* @U_ZERO_ERROR
store i32 %6, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [26 x i8], [26 x i8]* %2, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [26 x i8], [26 x i8]* %2, i64 0, i64 0
%12 = call i32 @u_uastrcpy(i32* %10, i8* %11)
%13 = load i32, i32* @UBRK_SENTENCE
%14 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%15 = call i32* @ubrk_open(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %14, i32 -1, i32* %4)
store i32* %15, i32** %1
%16 = load i32, i32* %4
%17 = call i64 @U_FAILURE(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %0
%20 = load i32, i32* %4
%21 = call i8* @u_errorName(i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%26 = load i32*, i32** %1
%27 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%28 = call i32 @printEachForward(i32* %26, i32* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32*, i32** %1
%31 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%32 = call i32 @printEachBackward(i32* %30, i32* %31)
%33 = load i32*, i32** %1
%34 = call i32 @ubrk_close(i32* %33)
%35 = load i32, i32* @UBRK_WORD
%36 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%37 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%38 = call i32 @u_strlen(i32* %37)
%39 = call i32* @ubrk_open(i32 %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %36, i32 %38, i32* %4)
store i32* %39, i32** %1
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%41 = load i32*, i32** %1
%42 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%43 = call i32 @printEachForward(i32* %41, i32* %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
%45 = load i32*, i32** %1
%46 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%47 = call i32 @printEachBackward(i32* %45, i32* %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
%49 = load i32*, i32** %1
%50 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%51 = call i32 @printFirst(i32* %49, i32* %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%53 = load i32*, i32** %1
%54 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%55 = call i32 @printLast(i32* %53, i32* %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
%57 = load i32*, i32** %1
%58 = getelementptr inbounds [27 x i32], [27 x i32]* %3, i64 0, i64 0
%59 = call i32 @printAt(i32* %57, i32 10, i32* %58)
%60 = load i32*, i32** %1
%61 = call i32 @ubrk_close(i32* %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.c_main.cStringToExamine = [26 x i8] c"Aaa bbb ccc. Ddd eee fff.\00"
@U_ZERO_ERROR = global i32 0
@.str.1 = [15 x i8] c"Examining: %s\0A\00"
@UBRK_SENTENCE = global i32 0
@.str.2 = [6 x i8] c"en_us\00"
@.str.3 = [21 x i8] c"ubrk_open error: %s\0A\00"
@UBRK_WORD = global i32 0
@str = [43 x i8] c"\0A\0AC Boundary Analysis\0A-------------------\0A\00"
@str.12 = [49 x i8] c"\0A----- Sentence Boundaries, forward: -----------\00"
@str.13 = [49 x i8] c"\0A----- Sentence Boundaries, backward: ----------\00"
@str.14 = [45 x i8] c"\0A----- Word Boundaries, forward: -----------\00"
@str.15 = [45 x i8] c"\0A----- Word Boundaries, backward: ----------\00"
@str.16 = [28 x i8] c"\0A----- first: -------------\00"
@str.17 = [28 x i8] c"\0A----- last: --------------\00"
@str.18 = [28 x i8] c"\0A----- at pos 10: ---------\00"
@str.19 = [28 x i8] c"\0AEnd of C boundary analysis\00"
define i32 @c_main() {
%1 = alloca [26 x i8]
%2 = alloca [27 x i32]
%3 = alloca i32
%4 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%5 = bitcast [27 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = load i32, i32* @U_ZERO_ERROR
store i32 %7, i32* %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%10 = getelementptr inbounds [27 x i32], [27 x i32]* %2, i64 0, i64 0
%11 = call i32 @u_uastrcpy(i32* %10, i8* %4)
%12 = load i32, i32* @UBRK_SENTENCE
%13 = call i32* @ubrk_open(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %10, i32 -1, i32* %3)
%14 = load i32, i32* %3
%15 = call i64 @U_FAILURE(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %0
%18 = load i32, i32* %3
%19 = call i8* @u_errorName(i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.12, i64 0, i64 0))
%24 = call i32 @printEachForward(i32* %13, i32* %10)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.13, i64 0, i64 0))
%26 = call i32 @printEachBackward(i32* %13, i32* %10)
%27 = call i32 @ubrk_close(i32* %13)
%28 = load i32, i32* @UBRK_WORD
%29 = call i32 @u_strlen(i32* %10)
%30 = call i32* @ubrk_open(i32 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %10, i32 %29, i32* %3)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.14, i64 0, i64 0))
%32 = call i32 @printEachForward(i32* %30, i32* %10)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.15, i64 0, i64 0))
%34 = call i32 @printEachBackward(i32* %30, i32* %10)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.16, i64 0, i64 0))
%36 = call i32 @printFirst(i32* %30, i32* %10)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.17, i64 0, i64 0))
%38 = call i32 @printLast(i32* %30, i32* %10)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.18, i64 0, i64 0))
%40 = call i32 @printAt(i32* %30, i32 10, i32* %10)
%41 = call i32 @ubrk_close(i32* %30)
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.19, i64 0, i64 0))
ret i32 0
}