#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 getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
main() {
  int c, nl, nw, nc, state;
  state = 2;
  nl = nw = nc = 0;
  while ((c = getchar()) != 'q') {
    nc++;
    if (c == '\n')
      nl++;
    if (c == ' ' || c == '\n' || c == '\t')
      state = 2;
    else if (state == 2) {
      state = 1;
      nw++;
    }
  }
  printf("%d %d %d\n", nl, nw, nc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x71,%eax
je     11c8 <main+0xa8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    117a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     1198 <main+0x78>
cmpl   $0xa,-0x8(%rbp)
je     1198 <main+0x78>
cmpl   $0x9,-0x8(%rbp)
jne    11a4 <main+0x84>
movl   $0x2,-0x18(%rbp)
jmp    11c3 <main+0xa3>
cmpl   $0x2,-0x18(%rbp)
jne    11be <main+0x9e>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c3 <main+0xa3>
jmp    114b <main+0x2b>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x0,%r14d
mov    $0x0,%ebp
cmp    $0x71,%eax
jne    115f <main+0x3f>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x2,%r12d
movabs $0x100000600,%r15
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    11a5 <main+0x85>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmp    $0x2,%r12d
sete   %al
add    %eax,%r14d
mov    $0x1,%r12d
mov    %dl,%cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebp
cmp    $0x71,%eax
je     1141 <main+0x21>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %dl
cmp    $0x20,%eax
ja     1180 <main+0x60>
mov    %eax,%eax
bt     %rax,%r15
jae    1180 <main+0x60>
mov    $0x2,%r12d
jmp    1192 <main+0x72>

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

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