#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 main() {
  int lines = 0;
  int words = 0;
  int characters = 0;
  int c;
  while ((c = getchar()) != EOF) {
    characters++;
    if (c == '\n') {
      lines++;
      words++;
    }
    if (c == ' ' || c == '\t' || c == '\r' || c == '\f' || c == '\v') {
      words++;
    }
  }
  printf("%d,  ", lines);
  printf("%d,  ", words);
  printf("%d\n", characters);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     11c2 <main+0xa2>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    1182 <main+0x62>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x14(%rbp)
je     11b4 <main+0x94>
cmpl   $0x9,-0x14(%rbp)
je     11b4 <main+0x94>
cmpl   $0xd,-0x14(%rbp)
je     11b4 <main+0x94>
cmpl   $0xc,-0x14(%rbp)
je     11b4 <main+0x94>
cmpl   $0xb,-0x14(%rbp)
jne    11bd <main+0x9d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe1c(%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   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb1(%rip),%r15
mov    $0x0,%r14d
mov    $0x0,%ebp
cmp    (%r15),%eax
je     118f <main+0x6f>
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
xchg   %ax,%ax
add    $0x1,%r14d
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
add    %ecx,%ebp
cmp    $0x20,%eax
sete   %cl
mov    %eax,%edx
and    $0xfffffffb,%edx
cmp    $0x9,%edx
sete   %dl
or     %cl,%dl
add    $0xfffffff5,%eax
cmp    $0x2,%eax
setb   %al
or     %dl,%al
movzbl %al,%eax
add    %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%eax
jne    1150 <main+0x30>
lea    0xe6a(%rip),%r15
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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