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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
je     11d3 <main+0xa3>
cmpl   $0x30,-0x10(%rbp)
jl     1194 <main+0x64>
cmpl   $0x39,-0x10(%rbp)
jg     1194 <main+0x64>
mov    -0x10(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11ce <main+0x9e>
cmpl   $0x20,-0x10(%rbp)
je     11b2 <main+0x82>
cmpl   $0x9,-0x10(%rbp)
je     11b2 <main+0x82>
cmpl   $0xa,-0x10(%rbp)
jne    11c0 <main+0x90>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c9 <main+0x99>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ce <main+0x9e>
jmp    114f <main+0x1f>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1216 <main+0xe6>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e8 <main+0xb8>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xdea(%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    $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,%edx
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%r8d
mov    $0x0,%r11d
mov    $0x0,%r14d
mov    $0x0,%r12d
mov    $0x0,%r9d
mov    $0x0,%r13d
cmp    (%rbx),%eax
je     1206 <main+0xe6>
movabs $0x100000600,%r14
jmp    11b2 <main+0x92>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
addl   $0x1,0x20(%rsp,%rax,4)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     11d2 <main+0xb2>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
jbe    11a0 <main+0x80>
cmp    $0x20,%eax
ja     11cc <main+0xac>
mov    %eax,%eax
bt     %rax,%r14
jae    11cc <main+0xac>
add    $0x1,%ebp
jmp    11a7 <main+0x87>
add    $0x1,%r15d
jmp    11a7 <main+0x87>
mov    %r15d,0x4(%rsp)
mov    0x20(%rsp),%r13d
mov    0x24(%rsp),%r9d
mov    0x28(%rsp),%r12d
mov    0x2c(%rsp),%r14d
mov    0x30(%rsp),%r11d
mov    0x34(%rsp),%r8d
mov    0x38(%rsp),%edi
mov    0x3c(%rsp),%esi
mov    0x40(%rsp),%edx
mov    0x44(%rsp),%r15d
mov    %r11d,0x8(%rsp)
mov    %r8d,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %esi,0x14(%rsp)
mov    %edx,0x18(%rsp)
mov    %r15d,0x1c(%rsp)
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
mov    %r9d,%ebx
call   1030 <printf@plt>
lea    0xdd0(%rip),%r15
mov    %r15,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%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    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>
mov    %r15,%rdi
mov    0x1c(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd46(%rip),%rdi
mov    %ebp,%esi
mov    0x4(%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 = [9 x i8] c"digits =\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [31 x i8] c", whitespace = %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
%7 = bitcast [10 x i32]* %6 to i8*
br label %8
8: ; preds = %41, %0
%9 = call i32 (...) @getchar()
store i32 %9, i32* %4
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %42
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, 48
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 57
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 48
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
br label %41
25: ; preds = %15, %12
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 32
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 9
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %37
34: ; preds = %31, %28, %25
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %40
37: ; preds = %31
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %40
40: ; preds = %37, %34
br label %41
41: ; preds = %40, %18
br label %8
42: ; preds = %8
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %44
44: ; preds = %53, %42
%45 = load i32, i32* %5
%46 = icmp slt i32 %45, 10
br i1 %46, label %47, label %56
47: ; preds = %44
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %44
56: ; preds = %44
%57 = load i32, i32* %3
%58 = load i32, i32* %2
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %57, i32 %58)
ret i32 0
}

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