#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, j, length;
  int histogram[16];
  for (i = 0; i < 16; i++)
    histogram[i] = 0;
  length = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      histogram[length]++;
      length = 0;
    } else {
      length++;
    }
  }
  for (i = 0; i < 16; i++) {
    printf("%2d: ", i);
    for (j = 0; j < histogram[i]; j++)
      printf("#");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    115a <main+0x3a>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%eax
je     11c1 <main+0xa1>
cmpl   $0x20,-0x8(%rbp)
je     1198 <main+0x78>
cmpl   $0xa,-0x8(%rbp)
je     1198 <main+0x78>
cmpl   $0x9,-0x8(%rbp)
jne    11b3 <main+0x93>
movslq -0x14(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x60(%rbp,%rax,4)
movl   $0x0,-0x14(%rbp)
jmp    11bc <main+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x41>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1233 <main+0x113>
mov    -0xc(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
jge    1217 <main+0xf7>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ea <main+0xca>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <main+0xa8>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e8c(%rip),%rbx
cmp    (%rbx),%eax
jne    11bc <main+0x8c>
lea    0xe99(%rip),%r14
xor    %ebx,%ebx
jmp    1184 <main+0x54>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     11b1 <main+0x81>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1170 <main+0x40>
nopw   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    11de <main+0xae>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     1160 <main+0x30>
cmp    $0x20,%eax
ja     11d0 <main+0xa0>
mov    %eax,%eax
bt     %rax,%r14
jae    11d0 <main+0xa0>
movslq %ebp,%rax
addl   $0x1,(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11d3 <main+0xa3>

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

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