#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 *, ...);
main() {
  int c, wordlength, state, pos, innerpos;
  int lengths[100];
  for (pos = 0; pos < 100; pos++)
    lengths[pos] = 0;
  state = 0;
  wordlength = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (state == 1)
        lengths[wordlength]++;
      state = 0;
    } else if (state == 0) {
      state = 1;
      wordlength = 1;
    } else {
      wordlength++;
    }
  }
  for (pos = 0; pos < 100; pos++) {
    printf("%3d|", pos);
    for (innerpos = 0; innerpos < lengths[pos]; innerpos++)
      printf("=");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1160 <main+0x40>
movslq -0x14(%rbp),%rax
movl   $0x0,-0x1b0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <main+0x19>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
je     1200 <main+0xe0>
cmpl   $0x20,-0x8(%rbp)
je     11a5 <main+0x85>
cmpl   $0x9,-0x8(%rbp)
je     11a5 <main+0x85>
cmpl   $0xa,-0x8(%rbp)
jne    11d0 <main+0xb0>
cmpl   $0x1,-0x10(%rbp)
jne    11c4 <main+0xa4>
movslq -0xc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
movl   $0x0,-0x10(%rbp)
jmp    11fb <main+0xdb>
cmpl   $0x0,-0x10(%rbp)
jne    11ed <main+0xcd>
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
jmp    11f6 <main+0xd6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fb <main+0xdb>
jmp    116e <main+0x4e>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1275 <main+0x155>
mov    -0x14(%rbp),%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movslq -0x14(%rbp),%rcx
cmp    -0x1b0(%rbp,%rcx,4),%eax
jge    1259 <main+0x139>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1229 <main+0x109>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1207 <main+0xe7>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %rsp,%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7e(%rip),%r15
cmp    (%r15),%eax
jne    11d1 <main+0x91>
lea    0xe8a(%rip),%r14
xor    %ebx,%ebx
jmp    1194 <main+0x54>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
je     11c1 <main+0x81>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1180 <main+0x40>
nopw   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x70>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
xor    %ebp,%ebp
jmp    120f <main+0xcf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
test   %ecx,%ecx
mov    $0x1,%ebx
cmove  %ebx,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %ebx,%ecx
cmp    (%r15),%eax
je     116f <main+0x2f>
cmp    $0x20,%eax
ja     11f0 <main+0xb0>
mov    %eax,%eax
bt     %rax,%r14
jae    11f0 <main+0xb0>
xor    %ebx,%ebx
cmp    $0x1,%ecx
jne    11fd <main+0xbd>
movslq %ebp,%rax
addl   $0x1,(%rsp,%rax,4)
jmp    11fd <main+0xbd>

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

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