#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i, a, invoer;
  int letters[127];
  printf("geef invoer: ");
  for (i = 0; i < 127; ++i)
    letters[i] = 0;
  while ((invoer = getchar()) != '\n') {
    if ((invoer >= 0) && (invoer < 127))
      letters[invoer]++;
  }
  for (i = 0; i < 127; ++i) {
    if (letters[i] != 0) {
      printf("%c ", i);
      for (a = 0; a < letters[i]; a++) {
        printf("*");
      }
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7f,-0x8(%rbp)
jge    116e <main+0x4e>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
jmp    1173 <main+0x53>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xa,%eax
je     11b4 <main+0x94>
cmpl   $0x0,-0x10(%rbp)
jl     11af <main+0x8f>
cmpl   $0x7f,-0x10(%rbp)
jge    11af <main+0x8f>
movslq -0x10(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x210(%rbp,%rax,4)
jmp    1173 <main+0x53>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7f,-0x8(%rbp)
jge    1240 <main+0x120>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
je     122d <main+0x10d>
mov    -0x8(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x210(%rbp,%rcx,4),%eax
jge    121f <main+0xff>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ef <main+0xcf>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x9b>
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x1fc,%edx
xor    %esi,%esi
call   1050 <memset@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%eax
je     1189 <main+0x49>
cmp    $0x7e,%eax
ja     1170 <main+0x30>
mov    %eax,%eax
addl   $0x1,(%rsp,%rax,4)
jmp    1170 <main+0x30>
lea    0xe7e(%rip),%r14
xor    %ebx,%ebx
jmp    11b4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x7f,%rbx
je     11e1 <main+0xa1>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
je     11aa <main+0x6a>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    11a0 <main+0x60>
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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