#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main() {
  int c, state = 0, wordOccurence = 0, tmpLength = 0;
  int length[6];
  for (int i = 0; i < 6; i++) {
    length[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      state = 0;
    } else {
      state = 1;
      wordOccurence = 0;
      tmpLength++;
    }
    if (wordOccurence == 0 && state == 0) {
      wordOccurence++;
      if (tmpLength > 5) {
        tmpLength = 6;
      }
      length[tmpLength - 1]++;
      tmpLength = 0;
    }
  }
  printf("\nWord Length Histogram\nLength\n* = 1 instance\n");
  for (int i = 0; i < 6; i++) {
    if (i == 5) {
      printf("5+\t");
    } else {
      printf("%d\t", i + 1);
    }
    for (int index = length[i]; index > 0; index--) {
      putchar('*');
    }
    putchar('\n');
  }
  printf("============================\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x6,-0x34(%rbp)
jge    117f <main+0x4f>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115b <main+0x2b>
jmp    1184 <main+0x54>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e53(%rip),%rcx
cmp    (%rcx),%eax
je     122b <main+0xfb>
cmpl   $0x20,-0x8(%rbp)
je     11bb <main+0x8b>
cmpl   $0x9,-0x8(%rbp)
je     11bb <main+0x8b>
cmpl   $0xa,-0x8(%rbp)
jne    11c7 <main+0x97>
movl   $0x0,-0xc(%rbp)
jmp    11de <main+0xae>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1226 <main+0xf6>
cmpl   $0x0,-0xc(%rbp)
jne    1226 <main+0xf6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x5,-0x14(%rbp)
jle    120c <main+0xdc>
movl   $0x6,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
movl   $0x0,-0x14(%rbp)
jmp    1184 <main+0x54>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x6,-0x38(%rbp)
jge    12c0 <main+0x190>
cmpl   $0x5,-0x38(%rbp)
jne    1267 <main+0x137>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127b <main+0x14b>
mov    -0x38(%rbp),%esi
add    $0x1,%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jle    12a8 <main+0x178>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    1286 <main+0x156>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1240 <main+0x110>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7e(%rip),%r12
cmp    (%r12),%eax
jne    1317 <main+0x1d7>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7d(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%ebx
test   %ebx,%ebx
jle    11b2 <main+0x72>
add    $0x1,%ebx
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe41(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jle    11f2 <main+0xb2>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11e0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe01(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%ebx
test   %ebx,%ebx
jle    1232 <main+0xf2>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1220 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc1(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
jle    1272 <main+0x132>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1260 <main+0x120>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd81(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%ebx
test   %ebx,%ebx
jle    12b2 <main+0x172>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     12a0 <main+0x160>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd3d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%ebx
test   %ebx,%ebx
jle    12f2 <main+0x1b2>
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     12e0 <main+0x1a0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd32(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x6,%r14d
movabs $0x100000600,%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1341 <main+0x201>
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%r12),%eax
je     1174 <main+0x34>
cmp    $0x20,%eax
sete   %dl
lea    -0x9(%rax),%ecx
cmp    $0x2,%ecx
setb   %cl
or     %dl,%cl
cmp    $0x20,%eax
ja     135f <main+0x21f>
mov    %eax,%eax
bt     %rax,%r15
jb     1364 <main+0x224>
add    $0x1,%ebp
xor    %ebx,%ebx
test   %ebx,%ebx
setne  %al
xor    $0x1,%cl
or     %al,%cl
jne    1330 <main+0x1f0>
cmp    $0x6,%ebp
cmovge %r14d,%ebp
movslq %ebp,%rax
addl   $0x1,-0x4(%rsp,%rax,4)
xor    %ebp,%ebp
mov    $0x1,%ebx
jmp    1330 <main+0x1f0>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [46 x i8] c"\0AWord Length Histogram\0ALength\0A* = 1 instance\0A\00"
@.str.1 = [4 x i8] c"5+\09\00"
@.str.2 = [4 x i8] c"%d\09\00"
@.str.3 = [30 x i8] c"============================\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [6 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %7
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 %15
store i32 0, i32* %16
br label %17
17: ; preds = %13
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %10
20: ; preds = %10
br label %21
21: ; preds = %57, %20
%22 = call i32 (...) @getchar()
store i32 %22, i32* %2
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %58
25: ; preds = %21
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 32
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 9
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %31, %28, %25
store i32 0, i32* %3
br label %38
35: ; preds = %31
store i32 1, i32* %3
store i32 0, i32* %4
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %35, %34
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %57
41: ; preds = %38
%42 = load i32, i32* %3
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %57
44: ; preds = %41
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
%47 = load i32, i32* %5
%48 = icmp sgt i32 %47, 5
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 6, i32* %5
br label %50
50: ; preds = %49, %44
%51 = load i32, i32* %5
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = add nsw i32 %55, 1
store i32 %56, i32* %54
store i32 0, i32* %5
br label %57
57: ; preds = %50, %41, %38
br label %21
58: ; preds = %21
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %60
60: ; preds = %87, %58
%61 = load i32, i32* %8
%62 = icmp slt i32 %61, 6
br i1 %62, label %63, label %90
63: ; preds = %60
%64 = load i32, i32* %8
%65 = icmp eq i32 %64, 5
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %72
68: ; preds = %63
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %68, %66
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 %74
%76 = load i32, i32* %75
store i32 %76, i32* %9
br label %77
77: ; preds = %82, %72
%78 = load i32, i32* %9
%79 = icmp sgt i32 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %77
%81 = call i32 @putchar(i8 signext 42)
br label %82
82: ; preds = %80
%83 = load i32, i32* %9
%84 = add nsw i32 %83, -1
store i32 %84, i32* %9
br label %77
85: ; preds = %77
%86 = call i32 @putchar(i8 signext 10)
br label %87
87: ; preds = %85
%88 = load i32, i32* %8
%89 = add nsw i32 %88, 1
store i32 %89, i32* %8
br label %60
90: ; preds = %60
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [4 x i8] c"5+\09\00"
@.str.2 = [4 x i8] c"%d\09\00"
@str = [45 x i8] c"\0AWord Length Histogram\0ALength\0A* = 1 instance\00"
@str.4 = [29 x i8] c"============================\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %35, label %6
6: ; preds = %0, %29
%7 = phi i32 [ %32, %29 ], [ %3, %0 ]
%8 = phi i32 [ %31, %29 ], [ 0, %0 ]
%9 = phi i32 [ %30, %29 ], [ 0, %0 ]
%10 = icmp eq i32 %7, 32
%11 = add i32 %7, -9
%12 = icmp ult i32 %11, 2
%13 = or i1 %10, %12
switch i32 %7, label %14 [
i32 32, label %16
i32 10, label %16
i32 9, label %16
]
14: ; preds = %6
%15 = add nsw i32 %8, 1
br label %16
16: ; preds = %6, %6, %6, %14
%17 = phi i32 [ 0, %14 ], [ %9, %6 ], [ %9, %6 ], [ %9, %6 ]
%18 = phi i32 [ %15, %14 ], [ %8, %6 ], [ %8, %6 ], [ %8, %6 ]
%19 = icmp eq i32 %17, 0
%20 = and i1 %13, %19
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = icmp slt i32 %18, 6
%23 = select i1 %22, i32 %18, i32 6
%24 = add nsw i32 %23, -1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %29
29: ; preds = %21, %16
%30 = phi i32 [ 1, %21 ], [ %17, %16 ]
%31 = phi i32 [ 0, %21 ], [ %18, %16 ]
%32 = tail call i32 (...) @getchar()
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %6
35: ; preds = %29, %0
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%38 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%39 = load i32, i32* %38
%40 = icmp sgt i32 %39, 0
br i1 %40, label %99, label %41
41: ; preds = %99, %35
%42 = tail call i32 @putchar(i8 signext 10)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2)
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%45 = load i32, i32* %44
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %41, %47
%48 = phi i32 [ %50, %47 ], [ %45, %41 ]
%49 = tail call i32 @putchar(i8 signext 42)
%50 = add nsw i32 %48, -1
%51 = icmp ugt i32 %48, 1
br i1 %51, label %47, label %52
52: ; preds = %47, %41
%53 = tail call i32 @putchar(i8 signext 10)
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%55 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%56 = load i32, i32* %55
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %52, %58
%59 = phi i32 [ %61, %58 ], [ %56, %52 ]
%60 = tail call i32 @putchar(i8 signext 42)
%61 = add nsw i32 %59, -1
%62 = icmp ugt i32 %59, 1
br i1 %62, label %58, label %63
63: ; preds = %58, %52
%64 = tail call i32 @putchar(i8 signext 10)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 4)
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%67 = load i32, i32* %66
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %74
69: ; preds = %63, %69
%70 = phi i32 [ %72, %69 ], [ %67, %63 ]
%71 = tail call i32 @putchar(i8 signext 42)
%72 = add nsw i32 %70, -1
%73 = icmp ugt i32 %70, 1
br i1 %73, label %69, label %74
74: ; preds = %69, %63
%75 = tail call i32 @putchar(i8 signext 10)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 5)
%77 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%78 = load i32, i32* %77
%79 = icmp sgt i32 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %74, %80
%81 = phi i32 [ %83, %80 ], [ %78, %74 ]
%82 = tail call i32 @putchar(i8 signext 42)
%83 = add nsw i32 %81, -1
%84 = icmp ugt i32 %81, 1
br i1 %84, label %80, label %85
85: ; preds = %80, %74
%86 = tail call i32 @putchar(i8 signext 10)
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%88 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%89 = load i32, i32* %88
%90 = icmp sgt i32 %89, 0
br i1 %90, label %91, label %96
91: ; preds = %85, %91
%92 = phi i32 [ %94, %91 ], [ %89, %85 ]
%93 = tail call i32 @putchar(i8 signext 42)
%94 = add nsw i32 %92, -1
%95 = icmp ugt i32 %92, 1
br i1 %95, label %91, label %96
96: ; preds = %91, %85
%97 = tail call i32 @putchar(i8 signext 10)
%98 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
ret i32 0
99: ; preds = %35, %99
%100 = phi i32 [ %102, %99 ], [ %39, %35 ]
%101 = tail call i32 @putchar(i8 signext 42)
%102 = add nsw i32 %100, -1
%103 = icmp ugt i32 %100, 1
br i1 %103, label %99, label %41
}