#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 main() {
  int ii, jj, c, nc, state;
  int len_freqs[20];
  for (ii = 0; ii < 20; ii++)
    len_freqs[ii] = 0;
  state = 0;
  nc = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      len_freqs[nc]++;
      nc = 0;
      state = 0;
    } else if (state == 0) {
      state = 1;
      nc++;
    } else
      nc++;
  }
  for (ii = 0; ii < 20; ii++) {
    printf("\n %d:\t", ii);
    for (jj = 0; jj < len_freqs[ii]; jj++) {
      printf("#");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    115a <main+0x3a>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x70(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
je     11f3 <main+0xd3>
cmpl   $0x20,-0x10(%rbp)
je     119f <main+0x7f>
cmpl   $0xa,-0x10(%rbp)
je     119f <main+0x7f>
cmpl   $0x9,-0x10(%rbp)
jne    11c1 <main+0xa1>
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11ee <main+0xce>
cmpl   $0x0,-0x18(%rbp)
jne    11e0 <main+0xc0>
movl   $0x1,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e9 <main+0xc9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ee <main+0xce>
jmp    1168 <main+0x48>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    125c <main+0x13c>
mov    -0x8(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    1249 <main+0x129>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    121c <main+0xfc>
jmp    124e <main+0x12e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11fa <main+0xda>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e87(%rip),%rbx
cmp    (%rbx),%eax
jne    11b6 <main+0x86>
lea    0xe94(%rip),%r14
xor    %ebx,%ebx
jmp    117a <main+0x4a>
add    $0x1,%rbx
cmp    $0x14,%rbx
je     11a1 <main+0x71>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1170 <main+0x40>
nopl   (%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x60>
jmp    1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    11de <main+0xae>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     1165 <main+0x35>
cmp    $0x20,%eax
ja     11d0 <main+0xa0>
mov    %eax,%eax
bt     %rax,%r14
jae    11d0 <main+0xa0>
movslq %ebp,%rax
addl   $0x1,(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11d3 <main+0xa3>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [7 x i8] c"\0A %d:\09\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 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 %21, label %6
6: ; preds = %0, %16
%7 = phi i32 [ %18, %16 ], [ %3, %0 ]
%8 = phi i32 [ %17, %16 ], [ 0, %0 ]
switch i32 %7, label %14 [
i32 32, label %9
i32 10, label %9
i32 9, label %9
]
9: ; preds = %6, %6, %6
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
br label %16
14: ; preds = %6
%15 = add nsw i32 %8, 1
br label %16
16: ; preds = %14, %9
%17 = phi i32 [ 0, %9 ], [ %15, %14 ]
%18 = tail call i32 (...) @getchar()
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16, %0
br label %22
22: ; preds = %21, %34
%23 = phi i64 [ %35, %34 ], [ 0, %21 ]
%24 = trunc i64 %23 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %23
%27 = load i32, i32* %26
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %22, %29
%30 = phi i32 [ %32, %29 ], [ 0, %22 ]
%31 = tail call i32 @putchar(i32 35)
%32 = add nuw nsw i32 %30, 1
%33 = icmp eq i32 %32, %27
br i1 %33, label %34, label %29
34: ; preds = %29, %22
%35 = add nuw nsw i64 %23, 1
%36 = icmp eq i64 %35, 20
br i1 %36, label %37, label %22
37: ; preds = %34
%38 = tail call i32 @putchar(i32 10)
ret i32 0
}