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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    116c <main+0x4c>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <main+0x25>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e5d(%rip),%rcx
cmp    (%rcx),%eax
je     11c8 <main+0xa8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x10(%rbp)
jne    11c3 <main+0xa3>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x14(%rbp)
jmp    117a <main+0x5a>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1240 <main+0x120>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%rcx
movslq -0x8(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1224 <main+0x104>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f4 <main+0xd4>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cf <main+0xaf>
mov    -0x4(%rbp),%eax
add    $0x50,%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 i32*
%7 = alloca [10 x i32]
store i32 0, i32* %1
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
store i32* %8, i32** %6
store i32 0, i32* %5
store i32 0, i32* %2
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32*, i32** %6
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
store i32 0, i32* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %9
20: ; preds = %9
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %39, %20
%23 = call i32 (...) @getchar()
store i32 %23, i32* %4
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %40
26: ; preds = %22
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 10
br i1 %30, label %31, label %39
31: ; preds = %26
%32 = load i32*, i32** %6
%33 = load i32, i32* %5
%34 = sub nsw i32 %33, 2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %32, i64 %35
%37 = load i32, i32* %36
%38 = add nsw i32 %37, 1
store i32 %38, i32* %36
store i32 0, i32* %5
br label %39
39: ; preds = %31, %26
br label %22
40: ; preds = %22
store i32 0, i32* %2
br label %41
41: ; preds = %63, %40
%42 = load i32, i32* %2
%43 = icmp slt i32 %42, 10
br i1 %43, label %44, label %66
44: ; preds = %41
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %46)
store i32 0, i32* %3
br label %48
48: ; preds = %58, %44
%49 = load i32, i32* %3
%50 = load i32*, i32** %6
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = icmp slt i32 %49, %54
br i1 %55, label %56, label %61
56: ; preds = %48
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %48
61: ; preds = %48
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61
%64 = load i32, i32* %2
%65 = add nsw i32 %64, 1
store i32 %65, i32* %2
br label %41
66: ; preds = %41
%67 = load i32, i32* %1
ret i32 %67
}

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
}