#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, ...);
int main(void) {
  long digits_count[10];
  long blank_count;
  int digit_index;
  int cur_char;
  blank_count = 0;
  for (digit_index = 0; digit_index < 10; digit_index++) {
    digits_count[digit_index] = 0;
  }
  while ((cur_char = getchar()) != EOF) {
    if (cur_char == ' ') {
      blank_count++;
    }
    if (cur_char >= '0' && cur_char <= '9') {
      digits_count[cur_char - '0']++;
    }
  }
  printf("count of blank is %ld.\n", blank_count);
  for (digit_index = 0; digit_index < 10; digit_index++) {
    printf("count of %d is %ld\n", digit_index, digits_count[digit_index]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0xa,-0x6c(%rbp)
jge    1163 <main+0x43>
movslq -0x6c(%rbp),%rax
movq   $0x0,-0x60(%rbp,%rax,8)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    113e <main+0x1e>
jmp    1168 <main+0x48>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x70(%rbp)
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
je     11c6 <main+0xa6>
cmpl   $0x20,-0x70(%rbp)
jne    1197 <main+0x77>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
cmpl   $0x30,-0x70(%rbp)
jl     11c1 <main+0xa1>
cmpl   $0x39,-0x70(%rbp)
jg     11c1 <main+0xa1>
mov    -0x70(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x60(%rbp,%rax,8),%rcx
add    $0x1,%rcx
mov    %rcx,-0x60(%rbp,%rax,8)
jmp    1168 <main+0x48>
mov    -0x68(%rbp),%rax
mov    %eax,%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x6c(%rbp)
cmpl   $0xa,-0x6c(%rbp)
jge    1213 <main+0xf3>
mov    -0x6c(%rbp),%esi
movslq -0x6c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdx
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11e1 <main+0xc1>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e8b(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    1198 <main+0x78>
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1216 <main+0xf6>
xor    %ebx,%ebx
jmp    11b1 <main+0x91>
nopl   0x0(%rax)
mov    %dl,%cl
add    %rcx,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    0x0(%rbp),%eax
je     11cb <main+0xab>
xor    %ecx,%ecx
cmp    $0x20,%eax
sete   %dl
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11a0 <main+0x80>
mov    %eax,%eax
addq   $0x1,0x30(%rsp,%rax,8)
jmp    11a0 <main+0x80>
mov    0x30(%rsp),%rbp
mov    0x38(%rsp),%r13
mov    0x40(%rsp),%r12
mov    0x48(%rsp),%r15
mov    0x50(%rsp),%r14
mov    0x58(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x68(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x70(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x78(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0xde3(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdeb(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    0x20(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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