#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 count[20] = {0};
  int c, len = 0;
  int state = 0;
  int i = 0, j = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (state == 1 && len >= 1 && len < 20) {
        count[len]++;
      }
      len = 0;
      state = 0;
    } else if (state == 0) {
      state = 1;
      len++;
    } else {
      len++;
    }
  }
  printf("\n");
  for (i = 1; i < 20; i++) {
    printf("%2d | ", i);
    for (j = 0; j < count[i]; j++)
      printf("*");
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x64(%rbp)
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
je     1217 <main+0xe7>
cmpl   $0x20,-0x64(%rbp)
je     11a5 <main+0x75>
cmpl   $0x9,-0x64(%rbp)
je     11a5 <main+0x75>
cmpl   $0xa,-0x64(%rbp)
jne    11e5 <main+0xb5>
cmpl   $0x1,-0x6c(%rbp)
jne    11d2 <main+0xa2>
cmpl   $0x1,-0x68(%rbp)
jl     11d2 <main+0xa2>
cmpl   $0x14,-0x68(%rbp)
jge    11d2 <main+0xa2>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x60(%rbp,%rax,4)
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
jmp    1212 <main+0xe2>
cmpl   $0x0,-0x6c(%rbp)
jne    1204 <main+0xd4>
movl   $0x1,-0x6c(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    120d <main+0xdd>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1212 <main+0xe2>
jmp    116e <main+0x3e>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x70(%rbp)
cmpl   $0x14,-0x70(%rbp)
jge    1297 <main+0x167>
mov    -0x70(%rbp),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
movslq -0x70(%rbp),%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
jge    127b <main+0x14b>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    124e <main+0x11e>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    122c <main+0xfc>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%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    0x2e85(%rip),%r15
cmp    (%r15),%eax
jne    11ce <main+0x9e>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
lea    0xe82(%rip),%r14
jmp    1194 <main+0x64>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x14,%rbx
je     11c1 <main+0x91>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1180 <main+0x50>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebx,%ebx
xor    %ecx,%ecx
jmp    11f4 <main+0xc4>
xchg   %ax,%ax
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebp,%ecx
cmp    (%r15),%eax
je     1168 <main+0x38>
cmp    $0x20,%eax
ja     1220 <main+0xf0>
mov    %eax,%eax
bt     %rax,%r14
jae    1220 <main+0xf0>
xor    %ebp,%ebp
cmp    $0x1,%ebx
jne    11e0 <main+0xb0>
test   %ecx,%ecx
jle    11e0 <main+0xb0>
cmp    $0x13,%ecx
jg     11e0 <main+0xb0>
mov    %ecx,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    11e0 <main+0xb0>
nopl   0x0(%rax)
add    $0x1,%ecx
mov    $0x1,%ebx
mov    %ecx,%ebp
jmp    11e2 <main+0xb2>

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

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