#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 WORDSIZE = 50;
  int NUMWORDS = 50;
  int i, c, position;
  int histogram[NUMWORDS];
  for (i = 0; i < NUMWORDS; i++)
    histogram[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n')
      position++;
    else
      histogram[position] += 1;
  }
  for (i = WORDSIZE; i > 0; i--) {
    for (position = 0; position < NUMWORDS; position++) {
      if (histogram[position] >= i)
        printf("_");
      else
        printf(" ");
    }
    printf("\n");
  }
  for (i = 0; i < NUMWORDS; i++)
    printf("%d ", histogram[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
movl   $0x32,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1194 <main+0x74>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116b <main+0x4b>
jmp    1199 <main+0x79>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%eax
je     11f4 <main+0xd4>
cmpl   $0x20,-0x14(%rbp)
je     11d0 <main+0xb0>
cmpl   $0x9,-0x14(%rbp)
je     11d0 <main+0xb0>
cmpl   $0xa,-0x14(%rbp)
jne    11de <main+0xbe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ef <main+0xcf>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    1199 <main+0x79>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    127b <main+0x15b>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    125f <main+0x13f>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x10(%rbp),%eax
jl     123e <main+0x11e>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124c <main+0x12c>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1251 <main+0x131>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    120b <main+0xeb>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11fa <main+0xda>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12b5 <main+0x195>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1282 <main+0x162>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
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,0xc0(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e49(%rip),%rbx
cmp    (%rbx),%eax
jne    1225 <main+0xf5>
mov    $0x32,%ebx
jmp    11c4 <main+0x94>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jbe    11f0 <main+0xc0>
xor    %ebp,%ebp
jmp    11df <main+0xaf>
nopl   0x0(%rax,%rax,1)
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x32,%rbp
je     11b0 <main+0x80>
mov    $0x20,%edi
cmp    %ebx,(%rsp,%rbp,4)
jl     11d0 <main+0xa0>
mov    $0x5f,%edi
jmp    11d0 <main+0xa0>
lea    0xe09(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rsp,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    $0x32,%rbp
jne    1200 <main+0xd0>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
jmp    1256 <main+0x126>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %ebp,%rax
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11a7 <main+0x77>
cmp    $0x20,%eax
ja     1240 <main+0x110>
mov    %eax,%eax
bt     %rax,%r14
jae    1240 <main+0x110>
add    $0x1,%ebp
jmp    1247 <main+0x117>

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

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