#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int strlen(char const *);
void output_titlebits(const char *mainttl, const char *subttl, FILE *outptr) {
  if (mainttl)
    fprintf(outptr, "%s", mainttl);
  if (subttl) {
    if (mainttl) {
      if (mainttl[strlen(mainttl) - 1] != '?')
        fprintf(outptr, ": ");
      else
        fprintf(outptr, " ");
    }
    fprintf(outptr, "%s", subttl);
  }
}


x86 assembly (clang, -O0):
<output_titlebits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <output_titlebits+0x35>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11d9 <output_titlebits+0xb9>
cmpq   $0x0,-0x8(%rbp)
je     11c3 <output_titlebits+0xa3>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3f,%eax
je     11ac <output_titlebits+0x8c>
mov    -0x18(%rbp),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11be <output_titlebits+0x9e>
mov    -0x18(%rbp),%rdi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11c3 <output_titlebits+0xa3>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe2e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_titlebits>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
test   %rdi,%rdi
je     1180 <output_titlebits+0x40>
mov    %rdi,%rbx
mov    %r14,%rsi
call   1040 <fputs@plt>
test   %r15,%r15
je     1185 <output_titlebits+0x45>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x3f,-0x1(%rax,%rbx,1)
jne    118b <output_titlebits+0x4b>
mov    $0x20,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
jmp    11a4 <output_titlebits+0x64>
test   %r15,%r15
jne    11a4 <output_titlebits+0x64>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe6e(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1060 <fwrite@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fputs@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [2 x i8] c" \00"
define void @output_titlebits(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32*, i32** %6
%11 = load i8*, i8** %4
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %9, %3
%14 = load i8*, i8** %5
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %40
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %36
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = load i8*, i8** %4
%22 = call i32 @strlen(i8* %21)
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %20, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 63
br i1 %28, label %29, label %32
29: ; preds = %19
%30 = load i32*, i32** %6
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
32: ; preds = %19
%33 = load i32*, i32** %6
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %32, %29
br label %36
36: ; preds = %35, %16
%37 = load i32*, i32** %6
%38 = load i8*, i8** %5
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %36, %13
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c": \00"
define void @output_titlebits(i8* %0, i8* %1, i32* nocapture %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = icmp eq i8* %1, null
br i1 %6, label %23, label %21
7: ; preds = %3
%8 = tail call i32 @fputs(i8* %0, i32* %2)
%9 = icmp eq i8* %1, null
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i32 @strlen(i8* %0)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 63
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %2)
br label %21
19: ; preds = %10
%20 = tail call i32 @fputc(i32 32, i32* %2)
br label %21
21: ; preds = %5, %17, %19
%22 = tail call i32 @fputs(i8* %1, i32* %2)
br label %23
23: ; preds = %7, %21, %5
ret void
}