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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x4c(%rbp)
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
je     11e8 <main+0xb8>
cmpl   $0x30,-0x4c(%rbp)
jl     11a9 <main+0x79>
cmpl   $0x39,-0x4c(%rbp)
jg     11a9 <main+0x79>
mov    -0x4c(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11e3 <main+0xb3>
cmpl   $0x20,-0x4c(%rbp)
je     11c7 <main+0x97>
cmpl   $0x9,-0x4c(%rbp)
je     11c7 <main+0x97>
cmpl   $0xa,-0x4c(%rbp)
jne    11d5 <main+0xa5>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11de <main+0xae>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11e3 <main+0xb3>
jmp    1164 <main+0x34>
movl   $0x0,-0x50(%rbp)
cmpl   $0xa,-0x50(%rbp)
jge    1220 <main+0xf0>
mov    -0x50(%rbp),%esi
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11ef <main+0xbf>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e83(%rip),%rbx
mov    $0x0,%ecx
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%r8d
mov    $0x0,%r14d
mov    $0x0,%r13d
mov    $0x0,%r10d
mov    $0x0,%r15d
mov    $0x0,%edx
mov    $0x0,%r9d
mov    $0x0,%ebp
cmp    (%rbx),%eax
je     1223 <main+0xf3>
movabs $0x100000600,%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    11d2 <main+0xa2>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
addl   $0x1,0x20(%rsp,%rax,4)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     11f2 <main+0xc2>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
jbe    11c0 <main+0x90>
cmp    $0x20,%eax
ja     11ec <main+0xbc>
mov    %eax,%eax
bt     %rax,%r14
jae    11ec <main+0xbc>
add    $0x1,%ebp
jmp    11c7 <main+0x97>
add    $0x1,%r15d
jmp    11c7 <main+0x97>
mov    0x20(%rsp),%edx
mov    %r15d,%r9d
mov    0x24(%rsp),%r15d
mov    0x28(%rsp),%r10d
mov    0x2c(%rsp),%r13d
mov    0x30(%rsp),%r14d
mov    0x34(%rsp),%r8d
mov    0x38(%rsp),%edi
mov    0x3c(%rsp),%esi
mov    0x40(%rsp),%ecx
mov    0x44(%rsp),%r12d
mov    %r8d,0x8(%rsp)
mov    %edi,0xc(%rsp)
mov    %esi,0x10(%rsp)
mov    %ecx,0x14(%rsp)
mov    %r9d,0x18(%rsp)
mov    %r12d,0x1c(%rsp)
lea    0xdbb(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
mov    %r10d,%ebx
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x5,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x6,%esi
mov    0xc(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x7,%esi
mov    0x10(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x8,%esi
mov    0x14(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x9,%esi
mov    0x1c(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcfd(%rip),%rdi
mov    %ebp,%esi
mov    0x18(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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