#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 func_longestWord(char *, char *, int);
int /*<<< orphan*/ getSentence(char *);
int numberOfWords(char *, int);
int /*<<< orphan*/ print_string(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main() {
  char string[100001], longestWord[100001] = {'\0'};
  int numWords, longestWordCount;
  getSentence(string);
  printf("\n\n\nThe sentence: \"");
  print_string(string, strlen(string), 0);
  printf("\"\n");
  numWords = numberOfWords(string, strlen(string));
  printf("\nNumber of words: %d\n", numWords);
  longestWordCount = func_longestWord(string, longestWord, strlen(string));
  printf("\nLongest word: \"");
  print_string(longestWord, longestWordCount, 0);
  printf("\" (%d characters).\n", longestWordCount);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30d60(%rbp),%rdi
xor    %esi,%esi
mov    $0x186a1,%edx
call   1060 <memset@plt>
lea    -0x186b0(%rbp),%rdi
call   1030 <getSentence@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x186b0(%rbp),%rax
mov    %rax,-0x30d88(%rbp)
lea    -0x186b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30d88(%rbp),%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1070 <print_string@plt>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x186b0(%rbp),%rax
mov    %rax,-0x30d80(%rbp)
lea    -0x186b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30d80(%rbp),%rdi
mov    %eax,%esi
call   1090 <numberOfWords@plt>
mov    %eax,-0x30d64(%rbp)
mov    -0x30d64(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x186b0(%rbp),%rax
mov    %rax,-0x30d78(%rbp)
lea    -0x30d60(%rbp),%rax
mov    %rax,-0x30d70(%rbp)
lea    -0x186b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30d78(%rbp),%rdi
mov    -0x30d70(%rbp),%rsi
mov    %eax,%edx
call   1080 <func_longestWord@plt>
mov    %eax,-0x30d68(%rbp)
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30d60(%rbp),%rdi
mov    -0x30d68(%rbp),%esi
xor    %edx,%edx
call   1070 <print_string@plt>
mov    -0x30d68(%rbp),%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30d90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x30d58,%rsp
mov    %rsp,%r14
mov    $0x186a1,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x186b0(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <getSentence@plt>
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1080 <print_string@plt>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <numberOfWords@plt>
lea    0xe20(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1090 <func_longestWord@plt>
mov    %eax,%ebx
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1080 <print_string@plt>
lea    0xe06(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x30d58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0A\0A\0AThe sentence: \22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
@.str.2 = [22 x i8] c"\0ANumber of words: %d\0A\00"
@.str.3 = [17 x i8] c"\0ALongest word: \22\00"
@.str.4 = [20 x i8] c"\22 (%d characters).\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100001 x i8]
%3 = alloca [100001 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [100001 x i8]* %3 to i8*
%7 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%8 = call i32 @getSentence(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @print_string(i8* %10, i32 %12, i32 0)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @numberOfWords(i8* %15, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = call i32 @func_longestWord(i8* %21, i8* %22, i32 %24)
store i32 %25, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%27 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%28 = load i32, i32* %5
%29 = call i32 @print_string(i8* %27, i32 %28, i32 0)
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0A\0A\0AThe sentence: \22\00"
@.str.2 = [22 x i8] c"\0ANumber of words: %d\0A\00"
@.str.3 = [17 x i8] c"\0ALongest word: \22\00"
@.str.4 = [20 x i8] c"\22 (%d characters).\0A\00"
@str = [2 x i8] c"\22\00"
define i32 @main() {
%1 = alloca [100001 x i8]
%2 = alloca [100001 x i8]
%3 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%5 = call i32 @getSentence(i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strlen(i8* %3)
%8 = call i32 @print_string(i8* %3, i32 %7, i32 0)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%10 = call i32 @strlen(i8* %3)
%11 = call i32 @numberOfWords(i8* %3, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = call i32 @strlen(i8* %3)
%14 = call i32 @func_longestWord(i8* %3, i8* %4, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @print_string(i8* %4, i32 %14, i32 0)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %14)
ret i32 0
}