#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);
main() {
  int state;
  int length, maxLength, maxCount;
  int count[999];
  int i, c, j;
  length = 0;
  maxLength = 0;
  maxCount = 0;
  state = 1;
  for (i = 0; i < 999; ++i)
    count[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      state = 1;
      if (length > maxLength)
        maxLength = length;
      if (length != 0)
        count[length]++;
      if (count[length] > maxCount)
        maxCount = count[length];
      length = 0;
    } else if (state == 1) {
      state = 0;
      length++;
    } else {
      length++;
    }
  }
  for (i = maxCount; i > 0; --i) {
    printf("%2d: ", i);
    for (j = 1; j < maxLength + 1; ++j) {
      printf("  ");
      if (count[j] >= i)
        putchar('#');
      else
        putchar(' ');
    }
    putchar('\n');
  }
  printf("    ");
  for (i = 1; i < maxLength + 1; ++i)
    printf("%3d", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e7,-0xfb4(%rbp)
jge    119e <main+0x6e>
movslq -0xfb4(%rbp),%rax
movl   $0x0,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1168 <main+0x38>
jmp    11a3 <main+0x73>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xfb8(%rbp)
mov    0x2e31(%rip),%rcx
cmp    (%rcx),%eax
je     127e <main+0x14e>
cmpl   $0x20,-0xfb8(%rbp)
je     11e6 <main+0xb6>
cmpl   $0xa,-0xfb8(%rbp)
je     11e6 <main+0xb6>
cmpl   $0x9,-0xfb8(%rbp)
jne    124c <main+0x11c>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11ff <main+0xcf>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     121e <main+0xee>
movslq -0xc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xfb0(%rbp,%rax,4)
movslq -0xc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
cmp    -0x14(%rbp),%eax
jle    1240 <main+0x110>
movslq -0xc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1279 <main+0x149>
cmpl   $0x1,-0x8(%rbp)
jne    126b <main+0x13b>
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1274 <main+0x144>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1279 <main+0x149>
jmp    11a3 <main+0x73>
mov    -0x14(%rbp),%eax
mov    %eax,-0xfb4(%rbp)
cmpl   $0x0,-0xfb4(%rbp)
jle    133e <main+0x20e>
mov    -0xfb4(%rbp),%esi
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xfbc(%rbp)
mov    -0xfbc(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1320 <main+0x1f0>
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0xfbc(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
cmp    -0xfb4(%rbp),%eax
jl     12fd <main+0x1cd>
mov    $0x23,%edi
call   1030 <putchar@plt>
jmp    1307 <main+0x1d7>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    130c <main+0x1dc>
mov    -0xfbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfbc(%rbp)
jmp    12b2 <main+0x182>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xfb4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1287 <main+0x157>
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1392 <main+0x262>
mov    -0xfb4(%rbp),%esi
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1356 <main+0x226>
mov    -0x4(%rbp),%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfa8,%rsp
mov    %rsp,%rdi
mov    $0xf9c,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7a(%rip),%r14
cmp    (%r14),%eax
jne    1186 <main+0x46>
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12af <main+0x16f>
movabs $0x100000600,%r15
xor    %r13d,%r13d
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    11b5 <main+0x75>
nopw   0x0(%rax,%rax,1)
cmp    %r13d,%ecx
cmovg  %ecx,%r13d
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%r14),%eax
je     11f5 <main+0xb5>
cmp    $0x20,%eax
ja     11f0 <main+0xb0>
mov    %eax,%eax
bt     %rax,%r15
jae    11f0 <main+0xb0>
cmp    %r12d,%ebx
cmovg  %ebx,%r12d
xor    %eax,%eax
mov    $0x0,%ecx
test   %ebx,%ebx
je     11a0 <main+0x60>
movslq %ebx,%rdx
mov    (%rsp,%rdx,4),%ecx
add    $0x1,%ecx
mov    %ecx,(%rsp,%rdx,4)
jmp    11a0 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
jmp    11a9 <main+0x69>
test   %r13d,%r13d
jle    1269 <main+0x129>
lea    0x1(%r12),%ebx
lea    0xdfa(%rip),%r14
lea    0xdfb(%rip),%r15
jmp    1227 <main+0xe7>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r13),%eax
cmp    $0x1,%r13d
mov    %eax,%r13d
jle    1269 <main+0x129>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    1210 <main+0xd0>
mov    $0x1,%ebp
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
cmp    %r13d,(%rsp,%rbp,4)
setge  %al
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1240 <main+0x100>
jmp    1210 <main+0xd0>
lea    0xd96(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    12af <main+0x16f>
neg    %r12d
mov    $0x1,%ebx
lea    0xd80(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1290 <main+0x150>
xor    %eax,%eax
add    $0xfa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [6 x i8] c"%2d: \00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [5 x i8] c" \00"
@.str.3 = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [999 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 1, i32* %2
store i32 0, i32* %7
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 999
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [999 x i32], [999 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 = %72, %20
%22 = call i32 (...) @getchar()
store i32 %22, i32* %8
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %73
25: ; preds = %21
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 32
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, 10
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 9
br i1 %33, label %34, label %62
34: ; preds = %31, %28, %25
store i32 1, i32* %2
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = icmp sgt i32 %35, %36
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32, i32* %3
store i32 %39, i32* %4
br label %40
40: ; preds = %38, %34
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = add nsw i32 %47, 1
store i32 %48, i32* %46
br label %49
49: ; preds = %43, %40
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %5
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %61
56: ; preds = %49
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %58
%60 = load i32, i32* %59
store i32 %60, i32* %5
br label %61
61: ; preds = %56, %49
store i32 0, i32* %3
br label %72
62: ; preds = %31
%63 = load i32, i32* %2
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %68
65: ; preds = %62
store i32 0, i32* %2
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %71
68: ; preds = %62
%69 = load i32, i32* %3
%70 = add nsw i32 %69, 1
store i32 %70, i32* %3
br label %71
71: ; preds = %68, %65
br label %72
72: ; preds = %71, %61
br label %21
73: ; preds = %21
%74 = load i32, i32* %5
store i32 %74, i32* %7
br label %75
75: ; preds = %104, %73
%76 = load i32, i32* %7
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %107
78: ; preds = %75
%79 = load i32, i32* %7
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %79)
store i32 1, i32* %9
br label %81
81: ; preds = %99, %78
%82 = load i32, i32* %9
%83 = load i32, i32* %4
%84 = add nsw i32 %83, 1
%85 = icmp slt i32 %82, %84
br i1 %85, label %86, label %102
86: ; preds = %81
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%88 = load i32, i32* %9
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = load i32, i32* %7
%93 = icmp sge i32 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %86
%95 = call i32 @putchar(i8 signext 35)
br label %98
96: ; preds = %86
%97 = call i32 @putchar(i8 signext 32)
br label %98
98: ; preds = %96, %94
br label %99
99: ; preds = %98
%100 = load i32, i32* %9
%101 = add nsw i32 %100, 1
store i32 %101, i32* %9
br label %81
102: ; preds = %81
%103 = call i32 @putchar(i8 signext 10)
br label %104
104: ; preds = %102
%105 = load i32, i32* %7
%106 = add nsw i32 %105, -1
store i32 %106, i32* %7
br label %75
107: ; preds = %75
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %7
br label %109
109: ; preds = %117, %107
%110 = load i32, i32* %7
%111 = load i32, i32* %4
%112 = add nsw i32 %111, 1
%113 = icmp slt i32 %110, %112
br i1 %113, label %114, label %120
114: ; preds = %109
%115 = load i32, i32* %7
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %115)
br label %117
117: ; preds = %114
%118 = load i32, i32* %7
%119 = add nsw i32 %118, 1
store i32 %119, i32* %7
br label %109
120: ; preds = %109
%121 = load i32, i32* %1
ret i32 %121
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"%2d: \00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [5 x i8] c" \00"
@.str.3 = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca [999 x i32]
%2 = bitcast [999 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 %6, label %14
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %66
8: ; preds = %34
%9 = icmp sgt i32 %37, 0
br i1 %9, label %10, label %58
10: ; preds = %8
%11 = icmp slt i32 %36, 1
%12 = add i32 %36, 1
%13 = zext i32 %12 to i64
br label %41
14: ; preds = %0, %34
%15 = phi i32 [ %38, %34 ], [ %3, %0 ]
%16 = phi i32 [ %37, %34 ], [ 0, %0 ]
%17 = phi i32 [ %36, %34 ], [ 0, %0 ]
%18 = phi i32 [ %35, %34 ], [ 0, %0 ]
switch i32 %15, label %32 [
i32 32, label %19
i32 10, label %19
i32 9, label %19
]
19: ; preds = %14, %14, %14
%20 = icmp sgt i32 %18, %17
%21 = select i1 %20, i32 %18, i32 %17
%22 = icmp eq i32 %18, 0
br i1 %22, label %28, label %23
23: ; preds = %19
%24 = sext i32 %18 to i64
%25 = getelementptr inbounds [999 x i32], [999 x i32]* %1, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1
store i32 %27, i32* %25
br label %28
28: ; preds = %19, %23
%29 = phi i32 [ %27, %23 ], [ 0, %19 ]
%30 = icmp sgt i32 %29, %16
%31 = select i1 %30, i32 %29, i32 %16
br label %34
32: ; preds = %14
%33 = add nsw i32 %18, 1
br label %34
34: ; preds = %32, %28
%35 = phi i32 [ 0, %28 ], [ %33, %32 ]
%36 = phi i32 [ %21, %28 ], [ %17, %32 ]
%37 = phi i32 [ %31, %28 ], [ %16, %32 ]
%38 = tail call i32 (...) @getchar()
%39 = load i32, i32* @EOF
%40 = icmp eq i32 %38, %39
br i1 %40, label %8, label %14
41: ; preds = %10, %54
%42 = phi i32 [ %37, %10 ], [ %56, %54 ]
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %42)
br i1 %11, label %54, label %44
44: ; preds = %41, %44
%45 = phi i64 [ %52, %44 ], [ 1, %41 ]
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%47 = getelementptr inbounds [999 x i32], [999 x i32]* %1, i64 0, i64 %45
%48 = load i32, i32* %47
%49 = icmp slt i32 %48, %42
%50 = select i1 %49, i8 32, i8 35
%51 = tail call i32 @putchar(i8 signext %50)
%52 = add nuw nsw i64 %45, 1
%53 = icmp eq i64 %52, %13
br i1 %53, label %54, label %44
54: ; preds = %44, %41
%55 = tail call i32 @putchar(i8 signext 10)
%56 = add nsw i32 %42, -1
%57 = icmp sgt i32 %42, 1
br i1 %57, label %41, label %58
58: ; preds = %54, %8
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%60 = icmp slt i32 %36, 1
br i1 %60, label %66, label %61
61: ; preds = %58, %61
%62 = phi i32 [ %64, %61 ], [ 1, %58 ]
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = add nuw i32 %62, 1
%65 = icmp eq i32 %62, %36
br i1 %65, label %66, label %61
66: ; preds = %61, %6, %58
ret i32 0
}