#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(void) {
  int ret = 1;
  int c = 0;
  int i = 0;
  int histogram[128];
  for (i = 0; i < 128; i++)
    histogram[i] = 0;
  while ((c = getchar()) != EOF) {
    histogram[c]++;
  }
  for (i = 1; i <= 128; i++) {
    if (histogram[i]) {
      if (i == ' ') {
        printf("\n ' '.");
      } else if (i == '\t') {
        printf("\n \\t.");
      } else if (i == '\n') {
        printf("\n \\n.");
      } else
        printf("\n  %c.", i);
    }
    while (histogram[i]) {
      printf("*");
      histogram[i]--;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x80,-0x10(%rbp)
jge    1178 <main+0x58>
movslq -0x10(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <main+0x2e>
jmp    117d <main+0x5d>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
je     11b0 <main+0x90>
movslq -0xc(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    117d <main+0x5d>
movl   $0x1,-0x10(%rbp)
cmpl   $0x80,-0x10(%rbp)
jg     129f <main+0x17f>
movslq -0x10(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
je     124d <main+0x12d>
cmpl   $0x20,-0x10(%rbp)
jne    11f3 <main+0xd3>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1248 <main+0x128>
cmpl   $0x9,-0x10(%rbp)
jne    1210 <main+0xf0>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1243 <main+0x123>
cmpl   $0xa,-0x10(%rbp)
jne    122d <main+0x10d>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0x11e>
mov    -0x10(%rbp),%esi
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1243 <main+0x123>
jmp    1248 <main+0x128>
jmp    124d <main+0x12d>
jmp    1252 <main+0x132>
movslq -0x10(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
je     128c <main+0x16c>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x10(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1252 <main+0x132>
jmp    1291 <main+0x171>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7a(%rip),%rbx
cmp    (%rbx),%eax
je     1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x40>
mov    $0x1,%ebx
lea    0xe6a(%rip),%r14
lea    0xe69(%rip),%r15
lea    0xe55(%rip),%r12
lea    0xe61(%rip),%r13
jmp    11cd <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    $0x81,%rbx
je     1224 <main+0xe4>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     11c0 <main+0x80>
cmp    $0x9,%ebx
je     11ed <main+0xad>
cmp    $0xa,%ebx
je     11e8 <main+0xa8>
cmp    $0x20,%ebx
jne    11f9 <main+0xb9>
mov    %r12,%rdi
jmp    11f0 <main+0xb0>
mov    %r15,%rdi
jmp    11f0 <main+0xb0>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1205 <main+0xc5>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %ebp,(%rsp,%rbx,4)
add    $0xffffffff,%ebp
jb     1210 <main+0xd0>
jmp    11c0 <main+0x80>
mov    $0x1,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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