#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char counts[256] = {0};
  char c;
  int start = 256;
  int end = 0;
  while ((c = getchar()) != EOF) {
    counts[c] += 1;
    if (c < start) {
      start = c;
    }
    if (c > end) {
      end = c;
    }
  }
  int i;
  for (i = start; i <= end; ++i) {
    printf("%c: ", i);
    int j;
    for (j = 0; j < counts[i]; ++j) {
      printf("=");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
movl   $0x100,-0x118(%rbp)
movl   $0x0,-0x11c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x111(%rbp)
movsbl %al,%eax
mov    0x2e68(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ea <main+0xba>
movsbq -0x111(%rbp),%rax
ff
movsbl -0x110(%rbp,%rax,1),%ecx
ff
add    $0x1,%ecx
mov    %cl,-0x110(%rbp,%rax,1)
movsbl -0x111(%rbp),%eax
cmp    -0x118(%rbp),%eax
jge    11c5 <main+0x95>
movsbl -0x111(%rbp),%eax
mov    %eax,-0x118(%rbp)
movsbl -0x111(%rbp),%eax
cmp    -0x11c(%rbp),%eax
jle    11e5 <main+0xb5>
movsbl -0x111(%rbp),%eax
mov    %eax,-0x11c(%rbp)
jmp    1169 <main+0x39>
mov    -0x118(%rbp),%eax
mov    %eax,-0x120(%rbp)
mov    -0x120(%rbp),%eax
cmp    -0x11c(%rbp),%eax
jg     1287 <main+0x157>
mov    -0x120(%rbp),%esi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
movslq -0x120(%rbp),%rcx
movsbl -0x110(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jge    1265 <main+0x135>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    1226 <main+0xf6>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x120(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x120(%rbp)
jmp    11f6 <main+0xc6>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
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)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e33(%rip),%r14
cmp    (%r14),%al
jne    11ca <main+0x9a>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x100,%ebx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%eax
movsbq %al,%rcx
addb   $0x1,(%rsp,%rcx,1)
cmp    %eax,%ebx
cmovg  %eax,%ebx
cmp    %eax,%r15d
cmovl  %eax,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r14),%al
jne    11e0 <main+0xb0>
movslq %ebx,%rbx
add    $0x1,%r15d
lea    0xdef(%rip),%r14
jmp    1233 <main+0x103>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
je     11ba <main+0x8a>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%ebp
test   %ebp,%ebp
jle    1220 <main+0xf0>
nopw   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1250 <main+0x120>
jmp    1220 <main+0xf0>

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

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