#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 /*<<< orphan*/ printnl();
int main() {
  printnl();
  printf("test\n");
  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):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <printnl@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
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)
mov    0x2e67(%rip),%rcx
cmp    (%rcx),%eax
je     11f3 <main+0xc3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    11a5 <main+0x75>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     11c3 <main+0x93>
cmpl   $0xa,-0x8(%rbp)
je     11c3 <main+0x93>
cmpl   $0x9,-0x8(%rbp)
jne    11cf <main+0x9f>
movl   $0x0,-0x18(%rbp)
jmp    11ee <main+0xbe>
cmpl   $0x0,-0x18(%rbp)
jne    11e9 <main+0xb9>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ee <main+0xbe>
jmp    1170 <main+0x40>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe03(%rip),%rdi
mov    $0x0,%al
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    %ebx,%ebx
xor    %eax,%eax
call   1040 <printnl@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7a(%rip),%r15
mov    $0x0,%r14d
mov    $0x0,%ebp
cmp    (%r15),%eax
jne    11a4 <main+0x64>
lea    0xe7b(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <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    %r13d,%r13d
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    11e1 <main+0xa1>
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%r13d
adc    $0x0,%r14d
mov    $0x1,%r13d
mov    %dl,%cl
add    %ecx,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
add    $0x1,%ebp
cmp    (%r15),%eax
je     117e <main+0x3e>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %dl
cmp    $0x20,%eax
ja     11c0 <main+0x80>
mov    %eax,%eax
bt     %rax,%r12
jae    11c0 <main+0x80>
xor    %r13d,%r13d
jmp    11ce <main+0x8e>

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

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