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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    1161 <main+0x41>
movslq -0x44(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    113d <main+0x1d>
jmp    1166 <main+0x46>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%eax
je     11ea <main+0xca>
cmpl   $0x30,-0x4(%rbp)
jl     11ab <main+0x8b>
cmpl   $0x39,-0x4(%rbp)
jg     11ab <main+0x8b>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11e5 <main+0xc5>
cmpl   $0xa,-0x4(%rbp)
je     11c9 <main+0xa9>
cmpl   $0x9,-0x4(%rbp)
je     11c9 <main+0xa9>
cmpl   $0x20,-0x4(%rbp)
jne    11d7 <main+0xb7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e0 <main+0xc0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e5 <main+0xc5>
jmp    1166 <main+0x46>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    121d <main+0xfd>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11f1 <main+0xd1>
mov    -0x8(%rbp),%esi
lea    0xddd(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xde0(%rip),%rdi
call   1030 <printf@plt>
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    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e93(%rip),%rbx
mov    $0x0,%r11d
mov    $0x0,%r9d
mov    $0x0,%ecx
mov    $0x0,%edi
mov    $0x0,%r14d
mov    $0x0,%r13d
mov    $0x0,%r12d
mov    $0x0,%r10d
mov    $0x0,%esi
mov    $0x0,%ebp
mov    $0x0,%edx
cmp    (%rbx),%eax
je     1214 <main+0xf4>
movabs $0x100000600,%r14
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    11c2 <main+0xa2>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
addl   $0x1,0x20(%rsp,%rax,4)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     11e2 <main+0xc2>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
jbe    11b0 <main+0x90>
cmp    $0x20,%eax
ja     11dc <main+0xbc>
mov    %eax,%eax
bt     %rax,%r14
jae    11dc <main+0xbc>
add    $0x1,%ebp
jmp    11b7 <main+0x97>
add    $0x1,%r15d
jmp    11b7 <main+0x97>
mov    0x20(%rsp),%esi
mov    0x24(%rsp),%r10d
mov    0x28(%rsp),%r12d
mov    0x2c(%rsp),%r13d
mov    0x30(%rsp),%r14d
mov    0x34(%rsp),%edi
mov    0x38(%rsp),%ecx
mov    0x3c(%rsp),%r9d
mov    0x40(%rsp),%r11d
mov    %r15d,%edx
mov    0x44(%rsp),%r15d
mov    %edi,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r9d,0x10(%rsp)
mov    %r11d,0x14(%rsp)
mov    %r15d,0x18(%rsp)
mov    %edx,0x1c(%rsp)
lea    0xdca(%rip),%r15
mov    %r15,%rdi
mov    %r10d,%ebx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x8(%rsp),%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0xc(%rsp),%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x10(%rsp),%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x14(%rsp),%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    0x18(%rsp),%esi
call   1030 <printf@plt>
lea    0xd55(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xd59(%rip),%rdi
mov    0x1c(%rsp),%esi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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