#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, int, int);
void count() {
  int c, nl, nw, nc, state;
  state = 0;
  nl = nw = nc = 0;
  while ((c = getchar()) != EOF) {
    ++nc;
    if (c == '\n')
      ++nl;
    if (c == ' ' || c == '\n' || c == '\t')
      state = 0;
    else if (state == 0) {
      state = 1;
      ++nw;
    }
  }
  printf("%d %d %d\n", nl, nw, nc);
}


x86 assembly (clang, -O0):
<count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     11c7 <count+0xa7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x4(%rbp)
jne    1179 <count+0x59>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x20,-0x4(%rbp)
je     1197 <count+0x77>
cmpl   $0xa,-0x4(%rbp)
je     1197 <count+0x77>
cmpl   $0x9,-0x4(%rbp)
jne    11a3 <count+0x83>
movl   $0x0,-0x14(%rbp)
jmp    11c2 <count+0xa2>
cmpl   $0x0,-0x14(%rbp)
jne    11bd <count+0x9d>
movl   $0x1,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c2 <count+0xa2>
jmp    1144 <count+0x24>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ead(%rip),%r15
mov    $0x0,%r14d
mov    $0x0,%ebp
cmp    (%r15),%eax
jne    116c <count+0x4c>
lea    0xeae(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
movabs $0x100000600,%r12
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    11b1 <count+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x1,%r13d
adc    $0x0,%r14d
mov    $0x1,%r13d
mov    %dl,%cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebp
cmp    (%r15),%eax
je     114b <count+0x2b>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %dl
cmp    $0x20,%eax
ja     1190 <count+0x70>
mov    %eax,%eax
bt     %rax,%r12
jae    1190 <count+0x70>
xor    %r13d,%r13d
jmp    119e <count+0x7e>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @count() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
br label %6
6: ; preds = %35, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %1
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %36
10: ; preds = %6
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %10
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 32
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = load i32, i32* %1
%23 = icmp eq i32 %22, 10
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %1
%26 = icmp eq i32 %25, 9
br i1 %26, label %27, label %28
27: ; preds = %24, %21, %18
store i32 0, i32* %5
br label %35
28: ; preds = %24
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
store i32 1, i32* %5
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %34
34: ; preds = %31, %28
br label %35
35: ; preds = %34, %27
br label %6
36: ; preds = %6
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @count() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %24, label %4
4: ; preds = %0, %18
%5 = phi i32 [ %21, %18 ], [ %1, %0 ]
%6 = phi i32 [ %20, %18 ], [ 0, %0 ]
%7 = phi i32 [ %10, %18 ], [ 0, %0 ]
%8 = phi i32 [ %19, %18 ], [ 0, %0 ]
%9 = phi i32 [ %13, %18 ], [ 0, %0 ]
%10 = add nuw nsw i32 %7, 1
%11 = icmp eq i32 %5, 10
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %9, %12
switch i32 %5, label %14 [
i32 32, label %18
i32 10, label %18
i32 9, label %18
]
14: ; preds = %4
%15 = icmp eq i32 %6, 0
%16 = zext i1 %15 to i32
%17 = add nsw i32 %8, %16
br label %18
18: ; preds = %14, %4, %4, %4
%19 = phi i32 [ %8, %4 ], [ %17, %14 ], [ %8, %4 ], [ %8, %4 ]
%20 = phi i32 [ 0, %4 ], [ 1, %14 ], [ 0, %4 ], [ 0, %4 ]
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %4
24: ; preds = %18, %0
%25 = phi i32 [ 0, %0 ], [ %13, %18 ]
%26 = phi i32 [ 0, %0 ], [ %19, %18 ]
%27 = phi i32 [ 0, %0 ], [ %10, %18 ]
%28 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
ret void
}