#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char ch;
  int i, nwhite, nother;
  int ndigit[10];
  nwhite = nother = 0;
  for (i = 0; i < 10; i++) {
    ndigit[i] = 0;
  }
  while ((ch = getchar()) != EOF) {
    if (ch >= '0' && ch <= '9') {
      ++ndigit[ch - '0'];
      printf("%c : %d\n", ch, ch);
    } else if (ch == ' ' || ch == '\n' || ch == '\t') {
      ++nwhite;
    } else {
      ++nother;
    }
  }
  printf("digits =");
  for (i = 0; i < 10; i++) {
    printf(" %d", ndigit[i]);
  }
  printf(", white space = %d, other = %d\n", nwhite, nother);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1168 <main+0x48>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
jmp    116d <main+0x4d>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e67(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     121d <main+0xfd>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11d5 <main+0xb5>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11d5 <main+0xb5>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
movsbl -0x5(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1218 <main+0xf8>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     11fc <main+0xdc>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     11fc <main+0xdc>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    120a <main+0xea>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1213 <main+0xf3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1218 <main+0xf8>
jmp    116d <main+0x4d>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1260 <main+0x140>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1232 <main+0x112>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%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    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e93(%rip),%rbx
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%r9d
mov    $0x0,%edi
mov    $0x0,%r8d
mov    $0x0,%r14d
mov    $0x0,%r12d
mov    $0x0,%r13d
mov    $0x0,%r10d
mov    $0x0,%ebp
mov    $0x0,%esi
cmp    (%rbx),%al
je     1234 <main+0x114>
lea    0xe5f(%rip),%r14
movabs $0x100000600,%r15
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    11df <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x30(%rdx),%eax
addl   $0x1,0x20(%rsp,%rax,4)
mov    %r14,%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
je     1202 <main+0xe2>
movsbl %al,%edx
lea    -0x30(%rdx),%ecx
cmp    $0x9,%cl
jbe    11c0 <main+0xa0>
cmp    $0x20,%al
ja     11fc <main+0xdc>
movzbl %dl,%eax
bt     %rax,%r15
jae    11fc <main+0xdc>
add    $0x1,%ebp
jmp    11d4 <main+0xb4>
add    $0x1,%r12d
jmp    11d4 <main+0xb4>
mov    0x20(%rsp),%r10d
mov    0x24(%rsp),%r13d
mov    %r12d,%esi
mov    0x28(%rsp),%r12d
mov    0x2c(%rsp),%r14d
mov    0x30(%rsp),%r8d
mov    0x34(%rsp),%edi
mov    0x38(%rsp),%r9d
mov    0x3c(%rsp),%edx
mov    0x40(%rsp),%ecx
mov    0x44(%rsp),%r15d
mov    %r8d,0x4(%rsp)
mov    %edi,0x8(%rsp)
mov    %r9d,0xc(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0x14(%rsp)
mov    %r15d,0x18(%rsp)
mov    %esi,0x1c(%rsp)
lea    0xdaf(%rip),%rdi
xor    %eax,%eax
mov    %r10d,%ebx
call   1030 <printf@plt>
lea    0xda7(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd1d(%rip),%rdi
mov    %ebp,%esi
mov    0x1c(%rsp),%edx
xor    %eax,%eax
call   1030 <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 i8 0
@.str = [9 x i8] c"%c : %d\0A\00"
@.str.1 = [9 x i8] c"digits =\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [32 x i8] c", white space = %d, other = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%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* %4
store i32 0, i32* %3
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %3
%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* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
br label %18
18: ; preds = %64, %17
%19 = call signext i8 (...) @getchar()
store i8 %19, i8* %2
%20 = sext i8 %19 to i32
%21 = load i8, i8* @EOF
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %20, %22
br i1 %23, label %24, label %65
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 48
br i1 %27, label %28, label %45
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = add nsw i32 %38, 1
store i32 %39, i32* %37
%40 = load i8, i8* %2
%41 = sext i8 %40 to i32
%42 = load i8, i8* %2
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %41, i32 %43)
br label %64
45: ; preds = %28, %24
%46 = load i8, i8* %2
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 32
br i1 %48, label %57, label %49
49: ; preds = %45
%50 = load i8, i8* %2
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 10
br i1 %52, label %57, label %53
53: ; preds = %49
%54 = load i8, i8* %2
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 9
br i1 %56, label %57, label %60
57: ; preds = %53, %49, %45
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %63
60: ; preds = %53
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %63
63: ; preds = %60, %57
br label %64
64: ; preds = %63, %32
br label %18
65: ; preds = %18
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %67
67: ; preds = %76, %65
%68 = load i32, i32* %3
%69 = icmp slt i32 %68, 10
br i1 %69, label %70, label %79
70: ; preds = %67
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %70
%77 = load i32, i32* %3
%78 = add nsw i32 %77, 1
store i32 %78, i32* %3
br label %67
79: ; preds = %67
%80 = load i32, i32* %4
%81 = load i32, i32* %5
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %80, i32 %81)
%83 = load i32, i32* %1
ret i32 %83
}

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