#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);
int /*<<< orphan*/ putchar(int);
main() {
  int c, nl, nw, nc, state;
  int end = getchar();
  state = 0;
  nl = nw = nc = 0;
  while ((c = getchar()) != end) {
    ++nc;
    if (c == '\n') {
      ++nl;
    }
    if (c == ' ' || c == '\t' || c == '\n') {
      state = 0;
      putchar('\n');
    } else if (state == 0) {
      state = 1;
      ++nw;
      putchar(c);
    } else {
      putchar(c);
    }
  }
  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)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    -0x1c(%rbp),%eax
je     1201 <main+0xd1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    1194 <main+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     11b2 <main+0x82>
cmpl   $0x9,-0x8(%rbp)
je     11b2 <main+0x82>
cmpl   $0xa,-0x8(%rbp)
jne    11c8 <main+0x98>
movl   $0x0,-0x18(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11fc <main+0xcc>
cmpl   $0x0,-0x18(%rbp)
jne    11ef <main+0xbf>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11f7 <main+0xc7>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11fc <main+0xcc>
jmp    1165 <main+0x35>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdef(%rip),%rdi
call   1040 <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    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x0,%ebx
mov    $0x0,%ebp
cmp    %r15d,%eax
jne    1182 <main+0x52>
lea    0xe9b(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r12
xor    %ebp,%ebp
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    11c8 <main+0x98>
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%r13d
adc    $0x0,%r14d
mov    $0x1,%r13d
mov    %dl,%cl
add    %ecx,%ebp
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0x1,%ebx
cmp    %r15d,%eax
je     115e <main+0x2e>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %dl
cmp    $0x20,%eax
ja     11a0 <main+0x70>
mov    %eax,%esi
bt     %rsi,%r12
jae    11a0 <main+0x70>
mov    $0xa,%eax
xor    %r13d,%r13d
jmp    11ae <main+0x7e>

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
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (...) @getchar()
store i32 %8, i32* %7
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
br label %9
9: ; preds = %44, %0
%10 = call i32 (...) @getchar()
store i32 %10, i32* %2
%11 = load i32, i32* %7
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %45
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %21
21: ; preds = %18, %13
%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 0, i32* %6
%31 = call i32 @putchar(i32 10)
br label %44
32: ; preds = %27
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %32
store i32 1, i32* %6
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
%38 = load i32, i32* %2
%39 = call i32 @putchar(i32 %38)
br label %43
40: ; preds = %32
%41 = load i32, i32* %2
%42 = call i32 @putchar(i32 %41)
br label %43
43: ; preds = %40, %35
br label %44
44: ; preds = %43, %30
br label %9
45: ; preds = %9
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = load i32, i32* %5
%49 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %46, i32 %47, i32 %48)
%50 = load i32, i32* %1
ret i32 %50
}

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