#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 EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int c, i, nwhite, nother;
  int ndigit[10];
  nwhite = nother = 0;
  for (i = 0; i < 10; i++)
    ndigit[i] = 0;
  while ((c = getchar()) != EOF) {
    if (c >= '0' && c <= '9')
      ndigit[c - '0'] += 1;
    else if (c == ' ' || c == '\n' || c == '\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);
  return EXIT_SUCCESS;
}


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)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    116f <main+0x4f>
movslq -0x18(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
jmp    1174 <main+0x54>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e63(%rip),%rcx
cmp    (%rcx),%eax
je     11f8 <main+0xd8>
cmpl   $0x30,-0x14(%rbp)
jl     11b9 <main+0x99>
cmpl   $0x39,-0x14(%rbp)
jg     11b9 <main+0x99>
mov    -0x14(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x50(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
jmp    11f3 <main+0xd3>
cmpl   $0x20,-0x14(%rbp)
je     11d7 <main+0xb7>
cmpl   $0xa,-0x14(%rbp)
je     11d7 <main+0xb7>
cmpl   $0x9,-0x14(%rbp)
jne    11e5 <main+0xc5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ee <main+0xce>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f3 <main+0xd3>
jmp    1174 <main+0x54>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    123b <main+0x11b>
movslq -0x18(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    120d <main+0xed>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%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    %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),%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),%r10d
mov    0x24(%rsp),%r13d
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    %r15d,%esi
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    0xdc6(%rip),%rdi
xor    %eax,%eax
mov    %r10d,%ebx
call   1030 <printf@plt>
lea    0xdbe(%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    0xd34(%rip),%rdi
mov    %ebp,%esi
mov    0x1c(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%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 = [32 x i8] c", white space = %d, other = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %8
store i32 0, i32* %7
br label %11
11: ; preds = %18, %2
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 %16
store i32 0, i32* %17
br label %18
18: ; preds = %14
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %11
21: ; preds = %11
br label %22
22: ; preds = %55, %21
%23 = call i32 (...) @getchar()
store i32 %23, i32* %6
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %56
26: ; preds = %22
%27 = load i32, i32* %6
%28 = icmp sge i32 %27, 48
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %6
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %39
32: ; preds = %29
%33 = load i32, i32* %6
%34 = sub nsw i32 %33, 48
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = add nsw i32 %37, 1
store i32 %38, i32* %36
br label %55
39: ; preds = %29, %26
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 32
br i1 %41, label %48, label %42
42: ; preds = %39
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, 10
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 9
br i1 %47, label %48, label %51
48: ; preds = %45, %42, %39
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %54
51: ; preds = %45
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %54
54: ; preds = %51, %48
br label %55
55: ; preds = %54, %32
br label %22
56: ; preds = %22
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %58
58: ; preds = %67, %56
%59 = load i32, i32* %7
%60 = icmp slt i32 %59, 10
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %58
70: ; preds = %58
%71 = load i32, i32* %8
%72 = load i32, i32* %9
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %71, i32 %72)
%74 = load i32, i32* @EXIT_SUCCESS
ret i32 %74
}

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