#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 /*<<< orphan*/ draw_histogram(int *, int);
int getchar();
int /*<<< orphan*/ printf(char *);
main() {
  int i, c, l = 0, n[100];
  for (i = 0; i < 100; i++)
    n[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      n[l]++;
      l = 0;
    } else
      l++;
  }
  printf("\n");
  draw_histogram(n, 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1177 <main+0x47>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x20>
jmp    117c <main+0x4c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e5b(%rip),%rcx
cmp    (%rcx),%eax
je     11e2 <main+0xb2>
cmpl   $0x20,-0xc(%rbp)
je     11b3 <main+0x83>
cmpl   $0x9,-0xc(%rbp)
je     11b3 <main+0x83>
cmpl   $0xa,-0xc(%rbp)
jne    11d4 <main+0xa4>
movslq -0x10(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1a0(%rbp,%rax,4)
movl   $0x0,-0x10(%rbp)
jmp    11dd <main+0xad>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <main+0x4c>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1050 <draw_histogram@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1040 <memset@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e80(%rip),%rbx
cmp    (%rbx),%eax
jne    1191 <main+0x51>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
call   1060 <draw_histogram@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    11ae <main+0x6e>
nop
add    $0x1,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     116c <main+0x2c>
cmp    $0x20,%eax
ja     11a0 <main+0x60>
mov    %eax,%eax
bt     %rax,%r14
jae    11a0 <main+0x60>
movslq %ebp,%rax
addl   $0x1,(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11a3 <main+0x63>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i32]
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
br label %17
17: ; preds = %39, %16
%18 = call i32 (...) @getchar()
store i32 %18, i32* %3
%19 = load i32, i32* @EOF
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 32
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 9
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %36
30: ; preds = %27, %24, %21
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
store i32 0, i32* %4
br label %39
36: ; preds = %27
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %39
39: ; preds = %36, %30
br label %17
40: ; preds = %17
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%43 = call i32 @draw_histogram(i32* %42, i32 100)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
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 %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 [100 x i32], [100 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
%22 = tail call i32 @putchar(i32 10)
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%24 = call i32 @draw_histogram(i32* %23, i32 100)
ret i32 0
}