#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 digits[10];
  int c, i;
  for (i = 0; i < 10; ++i) {
    digits[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    if ('0' <= c && c <= '9') {
      ++digits[c - '0'];
    }
  }
  for (i = 0; i < 10; ++i) {
    printf("%d ", digits[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    115a <main+0x3a>
movslq -0x38(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1136 <main+0x16>
jmp    115f <main+0x3f>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x34(%rbp)
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%eax
je     11a8 <main+0x88>
mov    $0x30,%eax
cmp    -0x34(%rbp),%eax
jg     11a3 <main+0x83>
cmpl   $0x39,-0x34(%rbp)
jg     11a3 <main+0x83>
mov    -0x34(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    115f <main+0x3f>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11dd <main+0xbd>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11af <main+0x8f>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e83(%rip),%rbx
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%edi
mov    $0x0,%ebp
mov    $0x0,%r8d
mov    $0x0,%r15d
mov    $0x0,%r12d
mov    $0x0,%r13d
mov    $0x0,%esi
cmp    (%rbx),%eax
jne    11ab <main+0x7b>
jmp    11e9 <main+0xb9>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11bc <main+0x8c>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11a0 <main+0x70>
mov    %eax,%eax
addl   $0x1,0x10(%rsp,%rax,4)
jmp    11a0 <main+0x70>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%r13d
mov    0x18(%rsp),%r12d
mov    0x1c(%rsp),%r15d
mov    0x20(%rsp),%r8d
mov    0x24(%rsp),%ebp
mov    0x28(%rsp),%edi
mov    0x2c(%rsp),%edx
mov    0x30(%rsp),%ecx
mov    0x34(%rsp),%r14d
mov    %edi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r14d,0xc(%rsp)
lea    0xe00(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
mov    %ebp,%ebx
mov    %r8d,%ebp
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    (%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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