#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*/ print_bar(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int character, state, length, i;
  int wordsize[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  state = 0;
  length = 0;
  while ((character = getchar()) != EOF) {
    if (state == 0) {
      if (character != ' ' && character != '\t' && character != '\n') {
        state = 1;
        length++;
      }
    } else if (state == 1) {
      if (character == ' ' || character == '\t' || character == '\n') {
        wordsize[length - 1]++;
        state = 0;
        length = 0;
      } else {
        length++;
      }
    }
  }
  for (i = 0; i < 20; i++) {
    printf("%d: ", i + 1);
    if (i + 1 < 10) {
      printf(" ");
    }
    print_bar(wordsize[i]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
je     1229 <main+0xe9>
cmpl   $0x0,-0xc(%rbp)
jne    11c3 <main+0x83>
cmpl   $0x20,-0x8(%rbp)
je     11be <main+0x7e>
cmpl   $0x9,-0x8(%rbp)
je     11be <main+0x7e>
cmpl   $0xa,-0x8(%rbp)
je     11be <main+0x7e>
movl   $0x1,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1224 <main+0xe4>
cmpl   $0x1,-0xc(%rbp)
jne    121f <main+0xdf>
cmpl   $0x20,-0x8(%rbp)
je     11eb <main+0xab>
cmpl   $0x9,-0x8(%rbp)
je     11eb <main+0xab>
cmpl   $0xa,-0x8(%rbp)
jne    1211 <main+0xd1>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    121a <main+0xda>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    121f <main+0xdf>
jmp    1224 <main+0xe4>
jmp    116d <main+0x2d>
movl   $0x0,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    1294 <main+0x154>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    $0xa,%eax
jge    126b <main+0x12b>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%edi
call   1060 <print_bar@plt>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1230 <main+0xf0>
xor    %eax,%eax
add    $0x70,%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    0x2e75(%rip),%r15
cmp    (%r15),%eax
jne    11da <main+0x9a>
lea    0xe81(%rip),%r14
xor    %ebx,%ebx
jmp    11ab <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%rbx,4),%edi
call   1060 <print_bar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbp,%rbx
cmp    $0x14,%rbp
je     11cd <main+0x8d>
lea    0x1(%rbx),%rbp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x8,%rbx
ja     1190 <main+0x50>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1208 <main+0xc8>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x1,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%eax
je     1178 <main+0x38>
test   %ebx,%ebx
je     1230 <main+0xf0>
cmp    $0x20,%eax
ja     11f0 <main+0xb0>
mov    %eax,%eax
bt     %rax,%r14
jae    11f0 <main+0xb0>
movslq %ebp,%rax
addl   $0x1,-0x4(%rsp,%rax,4)
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11f8 <main+0xb8>
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%eax
ja     11f0 <main+0xb0>
xor    %ebx,%ebx
mov    %eax,%eax
bt     %rax,%r14
jb     11f8 <main+0xb8>
jmp    11f0 <main+0xb0>

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

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