#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 *, ...);
void get_char_frequencies() {
  const int LAST = '~';
  int c, i, characters[LAST];
  for (i = 0; i < LAST; ++i)
    characters[i] = 0;
  while ((c = getchar()) != EOF)
    if (c > ' ' && c <= '~')
      ++characters[c];
  printf("|-----------|--------|\n");
  printf("| Character | Number |\n");
  printf("|-----------|--------|\n");
  for (i = 0; i < LAST; ++i)
    if (characters[i] > 0)
      printf("| %9c | %6d |\n", i, characters[i]);
}


x86 assembly (clang, -O0):
<get_char_frequencies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x7e,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7e,-0xc(%rbp)
jge    1167 <get_char_frequencies+0x47>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <get_char_frequencies+0x20>
jmp    116c <get_char_frequencies+0x4c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%eax
je     11b3 <get_char_frequencies+0x93>
cmpl   $0x20,-0x8(%rbp)
jle    11ae <get_char_frequencies+0x8e>
cmpl   $0x7e,-0x8(%rbp)
jg     11ae <get_char_frequencies+0x8e>
movslq -0x8(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    116c <get_char_frequencies+0x4c>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x7e,-0xc(%rbp)
jge    122f <get_char_frequencies+0x10f>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
jle    121c <get_char_frequencies+0xfc>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%edx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <get_char_frequencies+0x101>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e4 <get_char_frequencies+0xc4>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_char_frequencies>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
mov    %rsp,%rdi
mov    $0x1f8,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e81(%rip),%rbx
jmp    1177 <get_char_frequencies+0x37>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     118b <get_char_frequencies+0x4b>
lea    -0x21(%rax),%ecx
cmp    $0x5d,%ecx
ja     1170 <get_char_frequencies+0x30>
mov    %eax,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    1170 <get_char_frequencies+0x30>
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%r14
xor    %ebx,%ebx
jmp    11ca <get_char_frequencies+0x8a>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x7e,%rbx
je     11df <get_char_frequencies+0x9f>
mov    (%rsp,%rbx,4),%edx
test   %edx,%edx
jle    11c0 <get_char_frequencies+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c0 <get_char_frequencies+0x80>
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str.2 = [15 x i8] c"| %9c | %6d |\0A\00"
@str.3 = [23 x i8] c"| Character | Number |\00"
@str.4 = [23 x i8] c"|-----------|--------|\00"
define void @get_char_frequencies() {
%1 = alloca [126 x i32]
%2 = bitcast [126 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 %19, label %6
6: ; preds = %0, %15
%7 = phi i32 [ %16, %15 ], [ %3, %0 ]
%8 = add i32 %7, -33
%9 = icmp ult i32 %8, 94
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = zext i32 %7 to i64
%12 = getelementptr inbounds [126 x i32], [126 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
br label %15
15: ; preds = %10, %6
%16 = tail call i32 (...) @getchar()
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %6
19: ; preds = %15, %0
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.4, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.4, i64 0, i64 0))
br label %23
23: ; preds = %19, %31
%24 = phi i64 [ 0, %19 ], [ %32, %31 ]
%25 = getelementptr inbounds [126 x i32], [126 x i32]* %1, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = trunc i64 %24 to i32
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %26)
br label %31
31: ; preds = %23, %28
%32 = add nuw nsw i64 %24, 1
%33 = icmp eq i64 %32, 126
br i1 %33, label %34, label %23
34: ; preds = %31
ret void
}