#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 tab, blank, newln;
  int c;
  tab = 0;
  blank = 0;
  newln = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\t')
      ++tab;
    else if (c == ' ')
      ++blank;
    else if (c == '\n')
      ++newln;
  }
  printf("Counted Results:\n");
  printf("Tabs: %d\n", tab);
  printf("Blanks: %d\n", blank);
  printf("New Lines: %d\n", newln);
  return 0;
}


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     11af <main+0x8f>
cmpl   $0x9,-0x14(%rbp)
jne    1175 <main+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x8a>
cmpl   $0x20,-0x14(%rbp)
jne    118d <main+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a5 <main+0x85>
cmpl   $0xa,-0x14(%rbp)
jne    11a0 <main+0x80>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a5 <main+0x85>
jmp    11aa <main+0x8a>
jmp    1144 <main+0x24>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea0(%rip),%rbp
mov    $0x0,%r15d
mov    $0x0,%ebx
cmp    0x0(%rbp),%eax
jne    11a3 <main+0x73>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    11c0 <main+0x90>
nopl   (%rax)
add    $0x1,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    0x0(%rbp),%eax
je     1158 <main+0x28>
cmp    $0x20,%eax
je     11e0 <main+0xb0>
cmp    $0xa,%eax
je     11b0 <main+0x80>
cmp    $0x9,%eax
jne    11b4 <main+0x84>
add    $0x1,%ebx
jmp    11b4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14d
jmp    11b4 <main+0x84>

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

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