#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 */
int hexdump(char *, int);
int /*<<< orphan*/ hexdump_helper(char *, int, int);
int strlen(char *);
int main() {
  char *input =
      "About This DocumentTable of Contents1. Overview2. Quick Start3. "
      "Settings3.1. Appearance3.2. Actions3.3. Feedback3.4. Access Methods3.5. "
      "Prediction4. Screen-by-Screen Description4.1. Back4.2. Compose4.3. "
      "Launcher4.4. Activate4.5. Menus4.6. Toolbars4.7. UI Grab";
  int total = strlen(input), half = total / 2;
  int cont = hexdump(input, half);
  hexdump_helper(input + half, total - half, cont);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <hexdump@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <hexdump_helper@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <hexdump@plt>
movslq %ebp,%rcx
add    %rcx,%r14
sub    %ecx,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <hexdump_helper@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [260 x i8] c"About This DocumentTable of Contents1. Overview2. Quick Start3. Settings3.1. Appearance3.2. Actions3.3. Feedback3.4. Access Methods3.5. Prediction4. Screen-by-Screen Description4.1. Back4.2. Compose4.3. Launcher4.4. Activate4.5. Menus4.6. Toolbars4.7. UI Grab\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str, i64 0, i64 0), i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 2
store i32 %8, i32* %3
%9 = load i8*, i8** %1
%10 = load i32, i32* %3
%11 = call i32 @hexdump(i8* %9, i32 %10)
store i32 %11, i32* %4
%12 = load i8*, i8** %1
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %4
%20 = call i32 @hexdump_helper(i8* %15, i32 %18, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [260 x i8] c"About This DocumentTable of Contents1. Overview2. Quick Start3. Settings3.1. Appearance3.2. Actions3.3. Feedback3.4. Access Methods3.5. Prediction4. Screen-by-Screen Description4.1. Back4.2. Compose4.3. Launcher4.4. Activate4.5. Menus4.6. Toolbars4.7. UI Grab\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str, i64 0, i64 0))
%2 = sdiv i32 %1, 2
%3 = tail call i32 @hexdump(i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds [260 x i8], [260 x i8]* @.str, i64 0, i64 %4
%6 = sub nsw i32 %1, %2
%7 = tail call i32 @hexdump_helper(i8* %5, i32 %6, i32 %3)
ret i32 0
}