#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 *, ...);
main() {
  int c, i, nwhite, nother, ndigit[10];
  nwhite = nother = 0;
  for (i = 0; i < 10; i++) {
    ndigit[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      ndigit[c - '0']++;
      break;
    case ' ':
    case '\n':
    case '\t':
      nwhite++;
      break;
    default:
      nother++;
      break;
    }
  }
  printf("digits = ");
  for (i = 0; i < 10; i++)
    printf(" %d", ndigit[i]);
  printf(", white space = %d, other = %d\n", nwhite, nother);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    %eax,-0x8(%rbp)
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
je     11f6 <main+0xd6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     11da <main+0xba>
jmp    119d <main+0x7d>
mov    -0x44(%rbp),%eax
sub    $0x20,%eax
je     11da <main+0xba>
jmp    11ae <main+0x8e>
mov    -0x44(%rbp),%eax
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     11e8 <main+0xc8>
jmp    11c2 <main+0xa2>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11f1 <main+0xd1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f1 <main+0xd1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x4d>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1239 <main+0x119>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    120b <main+0xeb>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdc8(%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)
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e8e(%rip),%rbx
mov    $0x0,%edx
mov    $0x0,%r11d
mov    $0x0,%r10d
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%r12d
mov    $0x0,%r14d
mov    $0x0,%r15d
mov    $0x0,%r13d
mov    $0x0,%ebp
mov    $0x0,%ecx
cmp    (%rbx),%eax
je     1215 <main+0xf5>
movabs $0x100000600,%r14
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    11c0 <main+0xa0>
nopl   0x0(%rax)
addl   $0x1,0x20(%rsp,%rcx,4)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     11e0 <main+0xc0>
lea    -0x30(%rax),%ecx
cmp    $0xa,%ecx
jb     11b0 <main+0x90>
cmp    $0x20,%eax
ja     11da <main+0xba>
mov    %eax,%eax
bt     %rax,%r14
jae    11da <main+0xba>
add    $0x1,%ebp
jmp    11b5 <main+0x95>
add    $0x1,%r15d
jmp    11b5 <main+0x95>
mov    %r15d,%ecx
mov    0x20(%rsp),%r13d
mov    0x24(%rsp),%r15d
mov    0x28(%rsp),%r14d
mov    0x2c(%rsp),%r12d
mov    0x30(%rsp),%edi
mov    0x34(%rsp),%esi
mov    0x38(%rsp),%r10d
mov    0x3c(%rsp),%r11d
mov    0x40(%rsp),%edx
mov    0x44(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    %edi,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    %r10d,0x10(%rsp)
mov    %r11d,0x14(%rsp)
mov    %edx,0x18(%rsp)
mov    %ecx,0x1c(%rsp)
lea    0xdca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdc6(%rip),%rbx
mov    %rbx,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd3b(%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 i32 0
@.str = [10 x i8] c"digits = \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [32 x i8] c", white space = %d, other = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%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 = %37, %17
%19 = call i32 (...) @getchar()
store i32 %19, i32* %2
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i32, i32* %2
switch i32 %23, label %34 [
i32 48, label %24
i32 49, label %24
i32 50, label %24
i32 51, label %24
i32 52, label %24
i32 53, label %24
i32 54, label %24
i32 55, label %24
i32 56, label %24
i32 57, label %24
i32 32, label %31
i32 10, label %31
i32 9, label %31
]
24: ; preds = %22, %22, %22, %22, %22, %22, %22, %22, %22, %22
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 48
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1
store i32 %30, i32* %28
br label %37
31: ; preds = %22, %22, %22
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %37
34: ; preds = %22
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %37
37: ; preds = %34, %31, %24
br label %18
38: ; preds = %18
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %40
40: ; preds = %49, %38
%41 = load i32, i32* %3
%42 = icmp slt i32 %41, 10
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %40
52: ; preds = %40
%53 = load i32, i32* %4
%54 = load i32, i32* %5
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %53, i32 %54)
ret i32 0
}

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