#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 main() {
  long nc;
  nc = 0;
  int c, bl, t, nl;
  int character;
  while ((character = getchar()) != EOF) {
    if (character == ' ')
      bl++;
    else if (character == '\n')
      nl++;
    else if (character == '\t')
      t++;
    else {
      ++nc;
    }
  }
  printf("spc\tline\ttabs\tchars\tblank\n");
  printf("\t%d\t%d\t%ld\t%d\n", nl, t, nc, bl);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x24(%rbp)
mov    0x2ea0(%rip),%rcx
cmp    (%rcx),%eax
je     11b3 <main+0x93>
cmpl   $0x20,-0x24(%rbp)
jne    1168 <main+0x48>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ae <main+0x8e>
cmpl   $0xa,-0x24(%rbp)
jne    1180 <main+0x60>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a9 <main+0x89>
cmpl   $0x9,-0x24(%rbp)
jne    1198 <main+0x78>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a4 <main+0x84>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <main+0x89>
jmp    11ae <main+0x8e>
jmp    1137 <main+0x17>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8d
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%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   1050 <getchar@plt>
mov    0x2ea0(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    117e <main+0x4e>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    %r14d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    11a0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    0x0(%rbp),%eax
je     114d <main+0x1d>
cmp    $0x9,%eax
je     11c0 <main+0x90>
cmp    $0xa,%eax
je     1190 <main+0x60>
cmp    $0x20,%eax
jne    11d0 <main+0xa0>
add    $0x1,%r14d
jmp    1194 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
jmp    1194 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
jmp    1194 <main+0x64>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [15 x i8] c"\09%d\09%d\09%ld\09%d\0A\00"
@str = [26 x i8] c"spc\09line\09tabs\09chars\09blank\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, %18
%5 = phi i32 [ %23, %18 ], [ %1, %0 ]
%6 = phi i64 [ %22, %18 ], [ 0, %0 ]
%7 = phi i32 [ %21, %18 ], [ undef, %0 ]
%8 = phi i32 [ %20, %18 ], [ undef, %0 ]
%9 = phi i32 [ %19, %18 ], [ undef, %0 ]
switch i32 %5, label %16 [
i32 32, label %10
i32 10, label %12
i32 9, label %14
]
10: ; preds = %4
%11 = add nsw i32 %9, 1
br label %18
12: ; preds = %4
%13 = add nsw i32 %7, 1
br label %18
14: ; preds = %4
%15 = add nsw i32 %8, 1
br label %18
16: ; preds = %4
%17 = add nsw i64 %6, 1
br label %18
18: ; preds = %12, %16, %14, %10
%19 = phi i32 [ %11, %10 ], [ %9, %12 ], [ %9, %14 ], [ %9, %16 ]
%20 = phi i32 [ %8, %10 ], [ %8, %12 ], [ %15, %14 ], [ %8, %16 ]
%21 = phi i32 [ %7, %10 ], [ %13, %12 ], [ %7, %14 ], [ %7, %16 ]
%22 = phi i64 [ %6, %10 ], [ %6, %12 ], [ %6, %14 ], [ %17, %16 ]
%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 = %18, %0
%27 = phi i32 [ undef, %0 ], [ %19, %18 ]
%28 = phi i32 [ undef, %0 ], [ %20, %18 ]
%29 = phi i32 [ undef, %0 ], [ %21, %18 ]
%30 = phi i64 [ 0, %0 ], [ %22, %18 ]
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %28, i64 %30, i32 %27)
ret i32 0
}