#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, i, wl;
  int wordlen[11];
  wl = 0;
  for (i = 0; i <= 10; ++i)
    wordlen[i] = 0;
  while ((c = getchar()) != EOF) {
    if ((c == ' ' || c == '\n' || c == '\t')) {
      if (wl > 0) {
        if (wl >= 10)
          wordlen[10]++;
        else
          wordlen[wl]++;
        wl = 0;
      }
    } else {
      wl++;
    }
  }
  printf("\n\n\t\tHistogram\n");
  for (i = 0; i <= 10; ++i) {
    printf("%d: ", i);
    while (wordlen[i] > 0) {
      printf("|");
      wordlen[i]--;
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1161 <main+0x41>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
jmp    1166 <main+0x46>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%eax
je     11e8 <main+0xc8>
cmpl   $0x20,-0x8(%rbp)
je     119d <main+0x7d>
cmpl   $0xa,-0x8(%rbp)
je     119d <main+0x7d>
cmpl   $0x9,-0x8(%rbp)
jne    11da <main+0xba>
cmpl   $0x0,-0x10(%rbp)
jle    11d5 <main+0xb5>
cmpl   $0xa,-0x10(%rbp)
jl     11bf <main+0x9f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ce <main+0xae>
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
movl   $0x0,-0x10(%rbp)
jmp    11e3 <main+0xc3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1166 <main+0x46>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1265 <main+0x145>
mov    -0xc(%rbp),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
jle    1249 <main+0x129>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    1218 <main+0xf8>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fd <main+0xdd>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x1c(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e81(%rip),%rbx
cmp    (%rbx),%eax
jne    11e1 <main+0xa1>
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
lea    0xe82(%rip),%r14
xor    %ebx,%ebx
jmp    11a7 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,(%rsp,%rbx,4)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0xb,%rbx
je     11d6 <main+0x96>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1190 <main+0x50>
add    $0x1,%ebp
nopl   (%rax)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11c0 <main+0x80>
xor    %ebp,%ebp
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    1202 <main+0xc2>
nop
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     116b <main+0x2b>
cmp    $0x20,%eax
ja     11f0 <main+0xb0>
mov    %eax,%eax
bt     %rax,%r14
jae    11f0 <main+0xb0>
test   %ebp,%ebp
jle    11f3 <main+0xb3>
cmp    $0xa,%ebp
jae    1222 <main+0xe2>
mov    %ebp,%eax
addl   $0x1,(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11f3 <main+0xb3>
addl   $0x1,0x28(%rsp)
xor    %ebp,%ebp
jmp    11f3 <main+0xb3>

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

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