#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 argc, char const *argv[]) {
  int state, char_counter, c;
  int histogram[30];
  for (int i = 0; i < 30; ++i)
    histogram[i] = 0;
  state = 0;
  char_counter = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      if (state == 1) {
        ++histogram[char_counter - 1];
      }
      char_counter = 0;
      state = 0;
    } else {
      ++char_counter;
      state = 1;
    }
  }
  for (int i = 0; i < 30; ++i) {
    int bar_size = histogram[i];
    printf("%d\t", i + 1);
    for (int k = 0; k < bar_size; ++k)
      printf("#");
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xa4(%rbp)
cmpl   $0x1e,-0xa4(%rbp)
jge    1176 <main+0x56>
movslq -0xa4(%rbp),%rax
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1143 <main+0x23>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e53(%rip),%rcx
cmp    (%rcx),%eax
je     1206 <main+0xe6>
cmpl   $0x20,-0x1c(%rbp)
je     11bb <main+0x9b>
cmpl   $0xa,-0x1c(%rbp)
je     11bb <main+0x9b>
cmpl   $0x9,-0x1c(%rbp)
jne    11f1 <main+0xd1>
cmpl   $0x1,-0x14(%rbp)
jne    11de <main+0xbe>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0xa0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xa0(%rbp,%rax,4)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    1201 <main+0xe1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
jmp    1184 <main+0x64>
movl   $0x0,-0xa8(%rbp)
cmpl   $0x1e,-0xa8(%rbp)
jge    12a8 <main+0x188>
movslq -0xa8(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    %eax,-0xac(%rbp)
mov    -0xa8(%rbp),%esi
add    $0x1,%esi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0xac(%rbp),%eax
jge    1286 <main+0x166>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    1252 <main+0x132>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    1210 <main+0xf0>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x70(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e72(%rip),%r15
cmp    (%r15),%eax
jne    11de <main+0xae>
lea    0xe7e(%rip),%r14
xor    %ebx,%ebx
jmp    11a0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x1e,%rbx
je     11d1 <main+0xa1>
mov    (%rsp,%rbx,4),%ebp
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1190 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x90>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
xor    %ecx,%ecx
jmp    120c <main+0xdc>
xchg   %ax,%ax
add    $0x1,%ecx
mov    $0x1,%ebp
mov    %ecx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebx,%ecx
cmp    (%r15),%eax
je     117b <main+0x4b>
cmp    $0x20,%eax
ja     11f0 <main+0xc0>
mov    %eax,%eax
bt     %rax,%r14
jae    11f0 <main+0xc0>
xor    %ebx,%ebx
cmp    $0x1,%ebp
je     1230 <main+0x100>
xor    %ebp,%ebp
jmp    11fa <main+0xca>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ecx,%rax
addl   $0x1,-0x4(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11fa <main+0xca>

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

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