#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, int);
main() {
  int num_blanks = 0;
  int num_tabs = 0;
  int num_newlines = 0;
  char current_char = EOF;
  while ((current_char = getchar()) != EOF) {
    if (current_char == ' ') {
      ++num_blanks;
    } else if (current_char == '\t') {
      ++num_tabs;
    } else if (current_char == '\n') {
      ++num_newlines;
    }
  }
  printf("Newlines\t%5d\n", num_newlines);
  printf("Blanks  \t%5d\n", num_blanks);
  printf("Tabs    \t%5d\n", num_tabs);
}


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    0x2e9d(%rip),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e84(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ca <main+0xaa>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    118a <main+0x6a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <main+0xa5>
movsbl -0x11(%rbp),%eax
cmp    $0x9,%eax
jne    11a5 <main+0x85>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <main+0xa0>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11bb <main+0x9b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c0 <main+0xa0>
jmp    11c5 <main+0xa5>
jmp    1150 <main+0x30>
mov    -0x10(%rbp),%esi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe2a(%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    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb0(%rip),%r15
mov    $0x0,%ebp
mov    $0x0,%ebx
cmp    (%r15),%al
jne    117f <main+0x5f>
lea    0xeb2(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    119f <main+0x7f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
je     1147 <main+0x27>
cmp    $0x9,%al
je     11c0 <main+0xa0>
cmp    $0xa,%al
je     1190 <main+0x70>
cmp    $0x20,%al
jne    1193 <main+0x73>
add    $0x1,%r14d
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
jmp    1193 <main+0x73>

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

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