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


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)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11ed <main+0xcd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x8(%rbp)
jne    1191 <main+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     11af <main+0x8f>
cmpl   $0x9,-0x8(%rbp)
je     11af <main+0x8f>
cmpl   $0xa,-0x8(%rbp)
jne    11c9 <main+0xa9>
movl   $0x2,-0x18(%rbp)
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
cmpl   $0x2,-0x18(%rbp)
jne    11e3 <main+0xc3>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e8 <main+0xc8>
jmp    114b <main+0x2b>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe03(%rip),%rdi
mov    $0x0,%al
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   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
mov    0x2e9b(%rip),%rax
mov    $0xffffffff,%r15d
movl   $0x0,0x4(%rsp)
cmp    (%rax),%ebx
jne    1187 <main+0x57>
lea    0xe9a(%rip),%rdi
mov    %ebp,%esi
mov    0x4(%rsp),%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x2,%r13d
mov    $0xffffffff,%r15d
movl   $0x0,0x4(%rsp)
xor    %ebp,%ebp
jmp    11d1 <main+0xa1>
nop
xor    %eax,%eax
cmp    $0x2,%r13d
sete   %al
add    %eax,0x4(%rsp)
mov    $0x1,%r13d
mov    %r14b,%r12b
add    %r12d,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
add    $0x1,%r15d
mov    0x2e1b(%rip),%rax
cmp    (%rax),%ebx
je     115f <main+0x2f>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %r12d,%r12d
cmp    $0xa,%ebx
sete   %r14b
cmp    $0x20,%ebx
ja     11a0 <main+0x70>
mov    %ebx,%eax
movabs $0x100000600,%rcx
bt     %rax,%rcx
jae    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%r13d
jmp    11b3 <main+0x83>

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

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