#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(void) {
  int i, a, c, teller;
  int s[10];
  teller = 0;
  for (i = 0; i < 10; i++)
    s[i] = 0;
  printf("^d voor stoppen:\n");
  while ((c = getchar()) != EOF) {
    teller++;
    if (c == '\n') {
      s[(teller - 2)]++;
      teller = 0;
    }
  }
  for (i = 0; i < 10; i++) {
    printf("%2d ", (i + 1));
    for (a = 0; a < s[i]; a++) {
      printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1161 <main+0x41>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e68(%rip),%rcx
cmp    (%rcx),%eax
je     11ba <main+0x9a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x10(%rbp)
jne    11b5 <main+0x95>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
movl   $0x0,-0x14(%rbp)
jmp    116f <main+0x4f>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    122f <main+0x10f>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x40(%rbp,%rcx,4),%eax
jge    1213 <main+0xf3>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e6 <main+0xc6>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c1 <main+0xa1>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e6f(%rip),%rbx
cmp    (%rbx),%eax
jne    11de <main+0x9e>
lea    0xe7c(%rip),%r14
xor    %r15d,%r15d
jmp    11a0 <main+0x60>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0xa,%r15
je     11d1 <main+0x91>
mov    %r15,%rbx
add    $0x1,%r15
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    1190 <main+0x50>
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x80>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1209 <main+0xc9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %ebp,%rax
addl   $0x1,-0x4(%rsp,%rax,4)
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     117d <main+0x3d>
cmp    $0xa,%eax
je     11f0 <main+0xb0>
add    $0x1,%ebp
jmp    11fa <main+0xba>

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

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