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

/* Variables and functions */
scalar_t__ ispunct(char);
scalar_t__ isspace(char);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ toupper(int /*<<< orphan*/);
char *format_initial_capital_cr(char *destination, char *string) {
  int beginning = 1;
  char *destination_ptr = destination;
  if (!string)
    return "";
  while (*string) {
    if (*string == '\\') {
      *destination_ptr++ = *string++;
      beginning = 0;
    } else if (beginning) {
      if (isspace(*string) || (ispunct(*string) && *string != '\'')) {
        beginning = 1;
      } else {
        beginning = 0;
      }
      *destination_ptr++ = toupper(*string++);
    } else if (*string == '_') {
      beginning = 1;
      destination_ptr += sprintf(destination_ptr, "<br>");
      string++;
    } else if (*string == '|') {
      beginning = 1;
      *destination_ptr++ = *string++;
    } else if (isspace(*string) || (ispunct(*string) && *string != '\'')) {
      beginning = 1;
      *destination_ptr++ = *string++;
    } else {
      *destination_ptr++ = *string++;
    }
  }
  *destination_ptr = '\0';
  return destination;
}


x86 assembly (clang, -O0):
<format_initial_capital_cr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117a <format_initial_capital_cr+0x3a>
lea    0xe93(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    138c <format_initial_capital_cr+0x24c>
jmp    117f <format_initial_capital_cr+0x3f>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     137d <format_initial_capital_cr+0x23d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11ca <format_initial_capital_cr+0x8a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
movl   $0x0,-0x1c(%rbp)
jmp    1378 <format_initial_capital_cr+0x238>
cmpl   $0x0,-0x1c(%rbp)
je     1252 <format_initial_capital_cr+0x112>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
jne    1210 <format_initial_capital_cr+0xd0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ispunct@plt>
cmp    $0x0,%rax
je     121c <format_initial_capital_cr+0xdc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
je     121c <format_initial_capital_cr+0xdc>
movl   $0x1,-0x1c(%rbp)
jmp    1223 <format_initial_capital_cr+0xe3>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1373 <format_initial_capital_cr+0x233>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    129a <format_initial_capital_cr+0x15a>
movl   $0x1,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xd8c(%rip),%rsi
call   1060 <sprintf@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    136e <format_initial_capital_cr+0x22e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    12d8 <format_initial_capital_cr+0x198>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1369 <format_initial_capital_cr+0x229>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
jne    1314 <format_initial_capital_cr+0x1d4>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ispunct@plt>
cmp    $0x0,%rax
je     1342 <format_initial_capital_cr+0x202>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
je     1342 <format_initial_capital_cr+0x202>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1364 <format_initial_capital_cr+0x224>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
jmp    1369 <format_initial_capital_cr+0x229>
jmp    136e <format_initial_capital_cr+0x22e>
jmp    1373 <format_initial_capital_cr+0x233>
jmp    1378 <format_initial_capital_cr+0x238>
jmp    117f <format_initial_capital_cr+0x3f>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_initial_capital_cr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     121b <format_initial_capital_cr+0xeb>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x1,%ebp
mov    %rdi,%r15
jmp    1165 <format_initial_capital_cr+0x35>
xor    %ebp,%ebp
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%r15)
add    $0x1,%r15
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x5c,%al
je     11a0 <format_initial_capital_cr+0x70>
test   %al,%al
je     1215 <format_initial_capital_cr+0xe5>
test   %ebp,%ebp
je     11b0 <format_initial_capital_cr+0x80>
movsbl %al,%edi
call   1050 <isspace@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1152 <format_initial_capital_cr+0x22>
movsbl (%rbx),%edi
call   1040 <ispunct@plt>
test   %rax,%rax
je     1150 <format_initial_capital_cr+0x20>
cmpb   $0x27,(%rbx)
je     1150 <format_initial_capital_cr+0x20>
jmp    1152 <format_initial_capital_cr+0x22>
xchg   %ax,%ax
movb   $0x5c,(%r15)
add    $0x1,%r15
xor    %ebp,%ebp
add    $0x1,%rbx
jmp    1165 <format_initial_capital_cr+0x35>
cmp    $0x7c,%al
je     11ca <format_initial_capital_cr+0x9a>
cmp    $0x5f,%al
jne    11d0 <format_initial_capital_cr+0xa0>
movb   $0x0,0x4(%r15)
movl   $0x3e72623c,(%r15)
add    $0x4,%r15
jmp    11e7 <format_initial_capital_cr+0xb7>
movb   $0x7c,(%r15)
jmp    11e3 <format_initial_capital_cr+0xb3>
movsbl %al,%edi
call   1050 <isspace@plt>
movzbl (%rbx),%ecx
test   %rax,%rax
je     11f5 <format_initial_capital_cr+0xc5>
mov    %cl,(%r15)
add    $0x1,%r15
add    $0x1,%rbx
mov    $0x1,%ebp
jmp    1165 <format_initial_capital_cr+0x35>
movsbl %cl,%edi
call   1040 <ispunct@plt>
movzbl (%rbx),%ecx
test   %rax,%rax
je     120e <format_initial_capital_cr+0xde>
mov    $0x27,%al
cmp    $0x27,%cl
jne    11e0 <format_initial_capital_cr+0xb0>
jmp    1210 <format_initial_capital_cr+0xe0>
mov    %ecx,%eax
mov    %al,(%r15)
jmp    11a4 <format_initial_capital_cr+0x74>
movb   $0x0,(%r15)
jmp    1222 <format_initial_capital_cr+0xf2>
lea    0xde2(%rip),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"<br>\00"
define i8* @format_initial_capital_cr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 1, i32* %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %116
12: ; preds = %2
br label %13
13: ; preds = %112, %12
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %113
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 92
br i1 %21, label %22, label %28
22: ; preds = %17
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
%25 = load i8, i8* %23
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %7
store i8 %25, i8* %26
store i32 0, i32* %6
br label %112
28: ; preds = %17
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %57
31: ; preds = %28
%32 = load i8*, i8** %5
%33 = load i8, i8* %32
%34 = call i64 @isspace(i8 signext %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %46, label %36
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = load i8, i8* %37
%39 = call i64 @ispunct(i8 signext %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %47
41: ; preds = %36
%42 = load i8*, i8** %5
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 39
br i1 %45, label %46, label %47
46: ; preds = %41, %31
store i32 1, i32* %6
br label %48
47: ; preds = %41, %36
store i32 0, i32* %6
br label %48
48: ; preds = %47, %46
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %5
%51 = load i8, i8* %49
%52 = sext i8 %51 to i32
%53 = call i32 @toupper(i32 %52)
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %7
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %7
store i8 %54, i8* %55
br label %111
57: ; preds = %28
%58 = load i8*, i8** %5
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 95
br i1 %61, label %62, label %70
62: ; preds = %57
store i32 1, i32* %6
%63 = load i8*, i8** %7
%64 = call i32 @sprintf(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%65 = load i8*, i8** %7
%66 = sext i32 %64 to i64
%67 = getelementptr inbounds i8, i8* %65, i64 %66
store i8* %67, i8** %7
%68 = load i8*, i8** %5
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %5
br label %110
70: ; preds = %57
%71 = load i8*, i8** %5
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 124
br i1 %74, label %75, label %81
75: ; preds = %70
store i32 1, i32* %6
%76 = load i8*, i8** %5
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %5
%78 = load i8, i8* %76
%79 = load i8*, i8** %7
%80 = getelementptr inbounds i8, i8* %79, i32 1
store i8* %80, i8** %7
store i8 %78, i8* %79
br label %109
81: ; preds = %70
%82 = load i8*, i8** %5
%83 = load i8, i8* %82
%84 = call i64 @isspace(i8 signext %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %96, label %86
86: ; preds = %81
%87 = load i8*, i8** %5
%88 = load i8, i8* %87
%89 = call i64 @ispunct(i8 signext %88)
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %102
91: ; preds = %86
%92 = load i8*, i8** %5
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp ne i32 %94, 39
br i1 %95, label %96, label %102
96: ; preds = %91, %81
store i32 1, i32* %6
%97 = load i8*, i8** %5
%98 = getelementptr inbounds i8, i8* %97, i32 1
store i8* %98, i8** %5
%99 = load i8, i8* %97
%100 = load i8*, i8** %7
%101 = getelementptr inbounds i8, i8* %100, i32 1
store i8* %101, i8** %7
store i8 %99, i8* %100
br label %108
102: ; preds = %91, %86
%103 = load i8*, i8** %5
%104 = getelementptr inbounds i8, i8* %103, i32 1
store i8* %104, i8** %5
%105 = load i8, i8* %103
%106 = load i8*, i8** %7
%107 = getelementptr inbounds i8, i8* %106, i32 1
store i8* %107, i8** %7
store i8 %105, i8* %106
br label %108
108: ; preds = %102, %96
br label %109
109: ; preds = %108, %75
br label %110
110: ; preds = %109, %62
br label %111
111: ; preds = %110, %48
br label %112
112: ; preds = %111, %22
br label %13
113: ; preds = %13
%114 = load i8*, i8** %7
store i8 0, i8* %114
%115 = load i8*, i8** %4
store i8* %115, i8** %3
br label %116
116: ; preds = %113, %11
%117 = load i8*, i8** %3
ret i8* %117
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"<br>\00"
define i8* @format_initial_capital_cr(i8* writeonly %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %57, label %4
4: ; preds = %2, %52
%5 = phi i8* [ %55, %52 ], [ %1, %2 ]
%6 = phi i32 [ %53, %52 ], [ 1, %2 ]
%7 = phi i8* [ %54, %52 ], [ %0, %2 ]
%8 = load i8, i8* %5
switch i8 %8, label %11 [
i8 0, label %56
i8 92, label %9
]
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 92, i8* %7
br label %52
11: ; preds = %4
%12 = icmp eq i32 %6, 0
br i1 %12, label %31, label %13
13: ; preds = %11
%14 = tail call i64 @isspace(i8 signext %8)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i8, i8* %5
%18 = tail call i64 @ispunct(i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = load i8, i8* %5
%22 = icmp eq i8 %21, 39
br i1 %22, label %23, label %24
23: ; preds = %20, %16
br label %24
24: ; preds = %13, %20, %23
%25 = phi i32 [ 0, %23 ], [ 1, %20 ], [ 1, %13 ]
%26 = load i8, i8* %5
%27 = sext i8 %26 to i32
%28 = tail call i32 @toupper(i32 %27)
%29 = trunc i32 %28 to i8
%30 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %29, i8* %7
br label %52
31: ; preds = %11
switch i8 %8, label %36 [
i8 95, label %32
i8 124, label %34
]
32: ; preds = %31
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %7, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5, i1 false)
%33 = getelementptr inbounds i8, i8* %7, i64 4
br label %52
34: ; preds = %31
%35 = getelementptr inbounds i8, i8* %7, i64 1
store i8 124, i8* %7
br label %52
36: ; preds = %31
%37 = tail call i64 @isspace(i8 signext %8)
%38 = icmp eq i64 %37, 0
%39 = load i8, i8* %5
br i1 %38, label %40, label %46
40: ; preds = %36
%41 = tail call i64 @ispunct(i8 signext %39)
%42 = icmp eq i64 %41, 0
%43 = load i8, i8* %5
br i1 %42, label %49, label %44
44: ; preds = %40
%45 = icmp eq i8 %43, 39
br i1 %45, label %49, label %46
46: ; preds = %36, %44
%47 = phi i8 [ %43, %44 ], [ %39, %36 ]
%48 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %47, i8* %7
br label %52
49: ; preds = %40, %44
%50 = phi i8 [ 39, %44 ], [ %43, %40 ]
%51 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %50, i8* %7
br label %52
52: ; preds = %24, %34, %49, %46, %32, %9
%53 = phi i32 [ 0, %9 ], [ %25, %24 ], [ 1, %32 ], [ 1, %34 ], [ 1, %46 ], [ 0, %49 ]
%54 = phi i8* [ %10, %9 ], [ %30, %24 ], [ %33, %32 ], [ %35, %34 ], [ %48, %46 ], [ %51, %49 ]
%55 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
56: ; preds = %4
store i8 0, i8* %7
br label %57
57: ; preds = %2, %56
%58 = phi i8* [ %0, %56 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %58
}