#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 /*<<< orphan*/ printf(char *, unsigned int, char const *, char *, int);
unsigned int wordLengthAnalysis(char **, int, int);
void testWordLengthAnalysis(char **bufferPtr, int numOfLines, int wordLength) {
  unsigned int numOfWords = 0;
  numOfWords = wordLengthAnalysis(bufferPtr, numOfLines, wordLength);
  const char *singleWord = "word";
  const char *pluralWord = "words";
  if (numOfWords <= 1) {
    printf("%3d %-5s %s %d\n", numOfWords, singleWord, "of length", wordLength);
  } else {
    printf("%3d %-5s %s %d\n", numOfWords, pluralWord, "of length", wordLength);
  }
}


x86 assembly (clang, -O0):
<testWordLengthAnalysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <wordLengthAnalysis@plt>
mov    %eax,-0x14(%rbp)
lea    0xeae(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0x14(%rbp)
ja     118e <testWordLengthAnalysis+0x6e>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%r8d
lea    0xe8e(%rip),%rdi
lea    0xe97(%rip),%rcx
call   1040 <printf@plt>
jmp    11ac <testWordLengthAnalysis+0x8c>
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%r8d
lea    0xe6b(%rip),%rdi
lea    0xe74(%rip),%rcx
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testWordLengthAnalysis>:
push   %rbx
mov    %edx,%ebx
call   1030 <wordLengthAnalysis@plt>
cmp    $0x2,%eax
lea    0xece(%rip),%rcx
lea    0xecc(%rip),%rdx
cmovb  %rcx,%rdx
lea    0xec7(%rip),%rdi
lea    0xed0(%rip),%rcx
mov    %eax,%esi
mov    %ebx,%r8d
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"word\00"
@.str.1 = [6 x i8] c"words\00"
@.str.2 = [16 x i8] c"%3d %-5s %s %d\0A\00"
@.str.3 = [10 x i8] c"of length\00"
define void @testWordLengthAnalysis(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%10 = load i8**, i8*** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @wordLengthAnalysis(i8** %10, i32 %11, i32 %12)
store i32 %13, i32* %7
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %9
%14 = load i32, i32* %7
%15 = icmp ule i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %3
%17 = load i32, i32* %7
%18 = load i8*, i8** %8
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %17, i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %26
21: ; preds = %3
%22 = load i32, i32* %7
%23 = load i8*, i8** %9
%24 = load i32, i32* %6
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %22, i8* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %21, %16
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"word\00"
@.str.1 = [6 x i8] c"words\00"
@.str.2 = [16 x i8] c"%3d %-5s %s %d\0A\00"
@.str.3 = [10 x i8] c"of length\00"
define void @testWordLengthAnalysis(i8** %0, i32 %1, i32 %2) {
%4 = tail call i32 @wordLengthAnalysis(i8** %0, i32 %1, i32 %2)
%5 = icmp ult i32 %4, 2
%6 = select i1 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %4, i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %2)
ret void
}