#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 /*<<< orphan*/ putchar(char);
int main(int argc, char *argv[]) {
  int c;
  unsigned short int range = '~' - '!';
  int cfreq[range];
  int i, j;
  for (i = 0; i < range; ++i)
    cfreq[i] = 0;
  while ((c = getchar()) != EOF) {
    c -= '!';
    if (c <= range) {
      ++cfreq[c];
    }
  }
  printf("character frequency:");
  for (i = 0; i < range; ++i)
    if (cfreq[i]) {
      putchar(i + '!');
      for (j = 0; j < cfreq[i]; j++)
        putchar('.');
      putchar('\n');
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x5d,-0x16(%rbp)
movzwl -0x16(%rbp),%edx
mov    %edx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %edx,%ecx
lea    0xf(,%rcx,4),%edx
mov    %edx,%ecx
and    $0xfffffff0,%ecx
mov    %ecx,%edx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
movzwl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jge    11ad <main+0x7d>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1181 <main+0x51>
jmp    11b2 <main+0x82>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%eax
je     11f9 <main+0xc9>
mov    -0x14(%rbp),%eax
sub    $0x21,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movzwl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jg     11f4 <main+0xc4>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
jmp    11b2 <main+0x82>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
movzwl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jge    128b <main+0x15b>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1278 <main+0x148>
mov    -0x2c(%rbp),%eax
add    $0x21,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%eax
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    126e <main+0x13e>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1242 <main+0x112>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    127d <main+0x14d>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120c <main+0xdc>
movl   $0x0,-0x4(%rbp)
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   %rbx
sub    $0x178,%rsp
mov    %rsp,%rdi
mov    $0x174,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e82(%rip),%rbx
jmp    1177 <main+0x37>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     118c <main+0x4c>
cmp    $0x7e,%eax
jg     1170 <main+0x30>
cltq
addl   $0x1,-0x84(%rsp,%rax,4)
01
jmp    1170 <main+0x30>
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
jmp    11b4 <main+0x74>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x5d,%rbx
je     11e1 <main+0xa1>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     11aa <main+0x6a>
lea    0x21(%rbx),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    11a0 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x178,%rsp
pop    %rbx
pop    %rbp
ret

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

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