#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() {
  int c, i, licznik, tabelka[256];
  for (i = 0; i <= 255; i++) {
    tabelka[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    tabelka[c]++;
  }
  printf("\nznak\tliczba znakow\n-----------------------\n");
  for (i = 32; i <= 255; i++) {
    if (tabelka[i] > 0) {
      printf("%c\t%d\t", i, tabelka[i]);
      for (licznik = 1; licznik <= tabelka[i]; licznik++) {
        printf("*");
      }
      printf("\n");
    }
  }
  printf("-----------------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jg     1163 <main+0x43>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x410(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <main+0x19>
jmp    1168 <main+0x48>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
je     119b <main+0x7b>
movslq -0x8(%rbp),%rax
mov    -0x410(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x410(%rbp,%rax,4)
jmp    1168 <main+0x48>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x20,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jg     1243 <main+0x123>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x410(%rbp,%rax,4)
jle    1230 <main+0x110>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x410(%rbp,%rax,4),%edx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x410(%rbp,%rcx,4),%eax
jg     1222 <main+0x102>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f2 <main+0xd2>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <main+0x90>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1060 <memset@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x2e70(%rip),%rbx
cmp    (%rbx),%eax
je     1191 <main+0x41>
nopl   0x0(%rax)
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    (%rbx),%eax
jne    1180 <main+0x30>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
mov    $0x20,%ebx
lea    0xe57(%rip),%r14
jmp    11bd <main+0x6d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x100,%rbx
je     11fb <main+0xab>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11b0 <main+0x60>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x60>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [7 x i8] c"%c\09%d\09\00"
@str = [44 x i8] c"\0Aznak\09liczba znakow\0A-----------------------\00"
@str.5 = [24 x i8] c"-----------------------\00"
define i32 @main() {
%1 = alloca [256 x i32]
%2 = bitcast [256 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 [256 x i32], [256 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
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %32
%18 = phi i64 [ 32, %15 ], [ %33, %32 ]
%19 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = trunc i64 %18 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %20)
br label %25
25: ; preds = %22, %25
%26 = phi i32 [ %28, %25 ], [ 1, %22 ]
%27 = tail call i32 @putchar(i32 42)
%28 = add nuw i32 %26, 1
%29 = icmp eq i32 %26, %20
br i1 %29, label %30, label %25
30: ; preds = %25
%31 = tail call i32 @putchar(i32 10)
br label %32
32: ; preds = %17, %30
%33 = add nuw nsw i64 %18, 1
%34 = icmp eq i64 %33, 256
br i1 %34, label %35, label %17
35: ; preds = %32
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}