#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 *argv[]) {
  int c;
  int wlengths[100];
  int i, j;
  int curlength = 0;
  for (i = 0; i < 100; ++i)
    wlengths[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c < '!' || c > '~') {
      if (curlength && curlength < 100)
        ++wlengths[curlength];
      curlength = 0;
    } else {
      ++curlength;
    }
  }
  printf("Word length frequency:");
  for (i = 0; i < 100; ++i)
    if (wlengths[i]) {
      printf("\n%03d:", i);
      for (j = 0; j < wlengths[i]; j++)
        printf(".");
    }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1bc(%rbp)
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    1180 <main+0x60>
movslq -0x1b4(%rbp),%rax
movl   $0x0,-0x1b0(%rbp,%rax,4)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    114d <main+0x2d>
jmp    1185 <main+0x65>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%eax
je     1207 <main+0xe7>
cmpl   $0x21,-0x14(%rbp)
jl     11b2 <main+0x92>
cmpl   $0x7e,-0x14(%rbp)
jle    11f3 <main+0xd3>
cmpl   $0x0,-0x1bc(%rbp)
je     11e4 <main+0xc4>
cmpl   $0x64,-0x1bc(%rbp)
jge    11e4 <main+0xc4>
movslq -0x1bc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
movl   $0x0,-0x1bc(%rbp)
jmp    1202 <main+0xe2>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    1185 <main+0x65>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    12b9 <main+0x199>
movslq -0x1b4(%rbp),%rax
cmpl   $0x0,-0x1b0(%rbp,%rax,4)
je     12a0 <main+0x180>
mov    -0x1b4(%rbp),%esi
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
movslq -0x1b4(%rbp),%rcx
cmp    -0x1b0(%rbp,%rcx,4),%eax
jge    129b <main+0x17b>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
jmp    125f <main+0x13f>
jmp    12a0 <main+0x180>
jmp    12a5 <main+0x185>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    121f <main+0xff>
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%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   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e80(%rip),%rbx
cmp    (%rbx),%eax
jne    11e9 <main+0xa9>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe96(%rip),%r14
xor    %ebx,%ebx
jmp    119a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    $0x64,%rbx
je     11d1 <main+0x91>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     1190 <main+0x50>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1190 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x80>
jmp    1190 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ecx,%ecx
jmp    1206 <main+0xc6>
nopl   (%rax)
add    $0x1,%ecx
mov    %ecx,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     116c <main+0x2c>
add    $0xffffff81,%eax
cmp    $0xffffffa1,%eax
ja     11f0 <main+0xb0>
xor    %ebp,%ebp
test   %ecx,%ecx
je     11f5 <main+0xb5>
cmp    $0x63,%ecx
jg     11f5 <main+0xb5>
movslq %ecx,%rax
addl   $0x1,(%rsp,%rax,4)
jmp    11f5 <main+0xb5>

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

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