#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, i, nwhite, nother;
  int ndigit[10];
  nwhite = nother = 0;
  for (i = 0; i < 10; ++i) {
    printf("i = %d\n", i);
    ndigit[i] = 0;
  }
  while ((c = getchar()) != EOF) {
    if (c >= '0' && c <= '9') {
      ++ndigit[c - '0'];
    } 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);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1179 <main+0x59>
mov    -0xc(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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    117e <main+0x5e>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e59(%rip),%rcx
cmp    (%rcx),%eax
je     1202 <main+0xe2>
cmpl   $0x30,-0x8(%rbp)
jl     11c3 <main+0xa3>
cmpl   $0x39,-0x8(%rbp)
jg     11c3 <main+0xa3>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
cltq
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11fd <main+0xdd>
cmpl   $0x20,-0x8(%rbp)
je     11e1 <main+0xc1>
cmpl   $0xa,-0x8(%rbp)
je     11e1 <main+0xc1>
cmpl   $0x9,-0x8(%rbp)
jne    11ef <main+0xcf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f8 <main+0xd8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fd <main+0xdd>
jmp    117e <main+0x5e>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1245 <main+0x125>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1217 <main+0xf7>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%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
lea    0xedb(%rip),%rbx
xor    %r15d,%r15d
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,0x40(%rsp)
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,0x44(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2def(%rip),%rbp
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,%ebx
mov    $0x0,%esi
cmp    0x0(%rbp),%eax
je     12b5 <main+0x195>
movabs $0x100000600,%r14
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    1263 <main+0x143>
nopl   0x0(%rax)
mov    %ecx,%eax
addl   $0x1,0x20(%rsp,%rax,4)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    0x0(%rbp),%eax
je     1283 <main+0x163>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
jbe    1250 <main+0x130>
cmp    $0x20,%eax
ja     127d <main+0x15d>
mov    %eax,%eax
bt     %rax,%r14
jae    127d <main+0x15d>
add    $0x1,%ebx
jmp    1257 <main+0x137>
add    $0x1,%r15d
jmp    1257 <main+0x137>
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    0xd3d(%rip),%rdi
xor    %eax,%eax
mov    %r10d,%ebp
call   1030 <printf@plt>
lea    0xd35(%rip),%r15
mov    %r15,%rdi
mov    %ebp,%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    0xcab(%rip),%rdi
mov    %ebx,%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):
@.str = [8 x i8] c"i = %d\0A\00"
@EOF = global i32 0
@.str.1 = [9 x i8] c"digits =\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [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 = %16, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %14
store i32 0, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %7
19: ; preds = %7
br label %20
20: ; preds = %53, %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 %54
24: ; preds = %20
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 48
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 57
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sub nsw i32 %31, 48
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
br label %53
37: ; preds = %27, %24
%38 = load i32, i32* %2
%39 = icmp eq i32 %38, 32
br i1 %39, label %46, label %40
40: ; preds = %37
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 10
br i1 %42, label %46, label %43
43: ; preds = %40
%44 = load i32, i32* %2
%45 = icmp eq i32 %44, 9
br i1 %45, label %46, label %49
46: ; preds = %43, %40, %37
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %52
49: ; preds = %43
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %52
52: ; preds = %49, %46
br label %53
53: ; preds = %52, %30
br label %20
54: ; preds = %20
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %56
56: ; preds = %65, %54
%57 = load i32, i32* %3
%58 = icmp slt i32 %57, 10
br i1 %58, label %59, label %68
59: ; preds = %56
%60 = load i32, i32* %3
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %59
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %56
68: ; preds = %56
%69 = load i32, i32* %4
%70 = load i32, i32* %5
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %69, i32 %70)
%72 = load i32, i32* %1
ret i32 %72
}

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