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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1176 <main+0x56>
movslq -0x18(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1152 <main+0x32>
jmp    117b <main+0x5b>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%eax
je     1223 <main+0x103>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff7,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x30,%eax
ja     1215 <main+0xf5>
mov    -0x58(%rbp),%rax
lea    0xe43(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    121e <main+0xfe>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    121e <main+0xfe>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x50(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
jmp    121e <main+0xfe>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <main+0x5b>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1266 <main+0x146>
movslq -0x18(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1238 <main+0x118>
mov    -0x1c(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x50(%rsp)
movl   $0x0,0x10(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e8e(%rip),%r12
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%r10d
mov    $0x0,%edi
mov    $0x0,%r8d
mov    $0x0,%r13d
mov    $0x0,%r9d
mov    $0x0,%r15d
mov    $0x0,%r14d
mov    $0x0,%ebp
mov    $0x0,%ebx
movl   $0x0,0xc(%rsp)
mov    $0x0,%esi
cmp    (%r12),%eax
je     1246 <main+0x126>
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   (%rax)
lea    0x1(%rbx),%ecx
lea    -0x30(%rax),%edx
cmp    $0xa,%edx
jae    11e0 <main+0xc0>
addl   $0x1,0x30(%rsp,%rdx,4)
jmp    11fb <main+0xdb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x9,%eax
je     11f4 <main+0xd4>
cmp    $0x20,%eax
je     11f4 <main+0xd4>
cmp    $0xa,%eax
jne    120c <main+0xec>
addl   $0x1,0xc(%rsp)
add    $0x1,%r14d
add    $0x1,%ebp
mov    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r12),%eax
jne    11c0 <main+0xa0>
jmp    1211 <main+0xf1>
add    $0x2,%ebx
jmp    11fd <main+0xdd>
mov    %r14d,%esi
mov    0x30(%rsp),%r14d
mov    0x34(%rsp),%r15d
mov    0x38(%rsp),%r9d
mov    0x3c(%rsp),%r13d
mov    0x40(%rsp),%r8d
mov    0x44(%rsp),%edi
mov    0x48(%rsp),%r10d
mov    0x4c(%rsp),%edx
mov    0x50(%rsp),%ecx
mov    0x54(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %r8d,0x14(%rsp)
mov    %edi,0x18(%rsp)
mov    %r10d,0x1c(%rsp)
mov    %edx,0x20(%rsp)
mov    %ecx,0x24(%rsp)
mov    %esi,0x28(%rsp)
mov    %ebp,0x2c(%rsp)
lea    0xd95(%rip),%rdi
xor    %eax,%eax
mov    %r9d,%ebp
call   1030 <printf@plt>
lea    0xd8d(%rip),%r12
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x1c(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x20(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x24(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd03(%rip),%rdi
mov    0x28(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd04(%rip),%rdi
mov    0xc(%rsp),%esi
mov    0x2c(%rsp),%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%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 = [19 x i8] c",white space = %d\0A\00"
@.str.3 = [58 x i8] c"Number of lines %d Number of words %d Number of chars %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %7
store i32 0, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %14
store i32 0, i32* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %9
19: ; preds = %9
br label %20
20: ; preds = %50, %19
%21 = call i32 (...) @getchar()
store i32 %21, i32* %2
%22 = load i32, i32* @EOF
%23 = icmp ne i32 %21, %22
br i1 %23, label %24, label %51
24: ; preds = %20
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
%27 = load i32, i32* %2
switch i32 %27, label %47 [
i32 10, label %28
i32 9, label %35
i32 32, label %35
i32 48, label %40
i32 49, label %40
i32 50, label %40
i32 51, label %40
i32 52, label %40
i32 53, label %40
i32 54, label %40
i32 55, label %40
i32 56, label %40
i32 57, label %40
]
28: ; preds = %24
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %50
35: ; preds = %24, %24
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %50
40: ; preds = %24, %24, %24, %24, %24, %24, %24, %24, %24, %24
%41 = load i32, i32* %2
%42 = sub nsw i32 %41, 48
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
store i32 %46, i32* %44
br label %50
47: ; preds = %24
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %50
50: ; preds = %47, %40, %35, %28
br label %20
51: ; preds = %20
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %53
53: ; preds = %62, %51
%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]* %8, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, 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* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %5
%69 = load i32, i32* %3
%70 = load i32, i32* %4
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %68, i32 %69, i32 %70)
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 = [19 x i8] c",white space = %d\0A\00"
@.str.3 = [58 x i8] c"Number of lines %d Number of words %d Number of chars %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 %57, label %6
6: ; preds = %0, %28
%7 = phi i32 [ %33, %28 ], [ %3, %0 ]
%8 = phi i32 [ %32, %28 ], [ 0, %0 ]
%9 = phi i32 [ %31, %28 ], [ 0, %0 ]
%10 = phi i32 [ %30, %28 ], [ 0, %0 ]
%11 = phi i32 [ %29, %28 ], [ 0, %0 ]
%12 = add nsw i32 %10, 1
switch i32 %7, label %26 [
i32 10, label %13
i32 9, label %17
i32 32, label %17
i32 48, label %20
i32 49, label %20
i32 50, label %20
i32 51, label %20
i32 52, label %20
i32 53, label %20
i32 54, label %20
i32 55, label %20
i32 56, label %20
i32 57, label %20
]
13: ; preds = %6
%14 = add nsw i32 %9, 1
%15 = add nsw i32 %8, 1
%16 = add nsw i32 %11, 1
br label %28
17: ; preds = %6, %6
%18 = add nsw i32 %8, 1
%19 = add nsw i32 %11, 1
br label %28
20: ; preds = %6, %6, %6, %6, %6, %6, %6, %6, %6, %6
%21 = add nsw i32 %7, -48
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
br label %28
26: ; preds = %6
%27 = add nsw i32 %10, 2
br label %28
28: ; preds = %26, %20, %17, %13
%29 = phi i32 [ %11, %26 ], [ %11, %20 ], [ %19, %17 ], [ %16, %13 ]
%30 = phi i32 [ %27, %26 ], [ %12, %20 ], [ %12, %17 ], [ %12, %13 ]
%31 = phi i32 [ %9, %26 ], [ %9, %20 ], [ %9, %17 ], [ %14, %13 ]
%32 = phi i32 [ %8, %26 ], [ %8, %20 ], [ %18, %17 ], [ %15, %13 ]
%33 = tail call i32 (...) @getchar()
%34 = load i32, i32* @EOF
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %6
36: ; preds = %28
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%38 = load i32, i32* %37
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%40 = load i32, i32* %39
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%42 = load i32, i32* %41
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%44 = load i32, i32* %43
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%46 = load i32, i32* %45
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%48 = load i32, i32* %47
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%50 = load i32, i32* %49
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%52 = load i32, i32* %51
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%54 = load i32, i32* %53
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%56 = load i32, i32* %55
br label %57
57: ; preds = %36, %0
%58 = phi i32 [ 0, %0 ], [ %56, %36 ]
%59 = phi i32 [ 0, %0 ], [ %54, %36 ]
%60 = phi i32 [ 0, %0 ], [ %52, %36 ]
%61 = phi i32 [ 0, %0 ], [ %50, %36 ]
%62 = phi i32 [ 0, %0 ], [ %48, %36 ]
%63 = phi i32 [ 0, %0 ], [ %46, %36 ]
%64 = phi i32 [ 0, %0 ], [ %44, %36 ]
%65 = phi i32 [ 0, %0 ], [ %42, %36 ]
%66 = phi i32 [ 0, %0 ], [ %40, %36 ]
%67 = phi i32 [ 0, %0 ], [ %38, %36 ]
%68 = phi i32 [ 0, %0 ], [ %29, %36 ]
%69 = phi i32 [ 0, %0 ], [ %30, %36 ]
%70 = phi i32 [ 0, %0 ], [ %31, %36 ]
%71 = phi i32 [ 0, %0 ], [ %32, %36 ]
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %71)
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %70, i32 %68, i32 %69)
ret i32 0
}