#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();
scalar_t__ isprint(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int main() {
  char charArray[128];
  int i, n, num;
  int c;
  for (i = 0; i < 128; i++) {
    charArray[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    charArray[c]++;
  }
  for (i = 0; i < 128; i++) {
    if (isprint(i)) {
      printf("%c:", i);
      num = charArray[i];
      for (n = 0; n < num; n++) {
        putchar('=');
      }
      putchar('\n');
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x80,-0x94(%rbp)
jge    118f <main+0x4f>
movslq -0x94(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    115c <main+0x1c>
jmp    1194 <main+0x54>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xa0(%rbp)
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%eax
je     11cd <main+0x8d>
movslq -0xa0(%rbp),%rax
mov    -0x90(%rbp,%rax,1),%cl
add    $0x1,%cl
mov    %cl,-0x90(%rbp,%rax,1)
jmp    1194 <main+0x54>
movl   $0x0,-0x94(%rbp)
cmpl   $0x80,-0x94(%rbp)
jge    1280 <main+0x140>
mov    -0x94(%rbp),%edi
call   1060 <isprint@plt>
cmp    $0x0,%rax
je     1267 <main+0x127>
mov    -0x94(%rbp),%esi
lea    0xdf7(%rip),%rdi
call   1040 <printf@plt>
movslq -0x94(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%eax
ff
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x9c(%rbp),%eax
jge    125d <main+0x11d>
mov    $0x3d,%edi
call   1030 <putchar@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    122d <main+0xed>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    126c <main+0x12c>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11d7 <main+0x97>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
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)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e65(%rip),%rbx
cmp    (%rbx),%eax
je     11a1 <main+0x61>
nopw   0x0(%rax,%rax,1)
cltq
addb   $0x1,(%rsp,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1190 <main+0x50>
xor    %ebx,%ebx
lea    0xe56(%rip),%r14
jmp    11c7 <main+0x87>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x80,%rbx
je     1201 <main+0xc1>
mov    %ebx,%edi
call   1060 <isprint@plt>
test   %rax,%rax
je     11ba <main+0x7a>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%ebp
test   %ebp,%ebp
jle    11b0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xb0>
jmp    11b0 <main+0x70>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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