#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 *, long);
void main() {
  long newlines = 0;
  long blanks = 0;
  long tabs = 0;
  int c;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      ++newlines;
    else if (c == ' ')
      ++blanks;
    else if (c == '\t')
      ++tabs;
  }
  printf("Lines: %ld\n", newlines);
  printf("Blanks: %ld\n", blanks);
  printf("Tabs: %ld\n", tabs);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e97(%rip),%rcx
cmp    (%rcx),%eax
je     11b4 <main+0x94>
cmpl   $0xa,-0x1c(%rbp)
jne    1174 <main+0x54>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11af <main+0x8f>
cmpl   $0x20,-0x1c(%rbp)
jne    118f <main+0x6f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11aa <main+0x8a>
cmpl   $0x9,-0x1c(%rbp)
jne    11a5 <main+0x85>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11aa <main+0x8a>
jmp    11af <main+0x8f>
jmp    1140 <main+0x20>
mov    -0x8(%rbp),%rsi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eaf(%rip),%r12
cmp    (%r12),%eax
jne    117c <main+0x5c>
xor    %r14d,%r14d
xor    %ebx,%ebx
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %r15d,%r15d
jmp    11a1 <main+0x81>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r12),%eax
je     1144 <main+0x24>
cmp    $0x9,%eax
je     11c0 <main+0xa0>
cmp    $0x20,%eax
je     1190 <main+0x70>
cmp    $0xa,%eax
jne    1194 <main+0x74>
add    $0x1,%rbx
jmp    1194 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14
jmp    1194 <main+0x74>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [12 x i8] c"Lines: %ld\0A\00"
@.str.1 = [13 x i8] c"Blanks: %ld\0A\00"
@.str.2 = [11 x i8] c"Tabs: %ld\0A\00"
define void @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 i64 [ %18, %15 ], [ 0, %0 ]
%7 = phi i64 [ %17, %15 ], [ 0, %0 ]
%8 = phi i64 [ %16, %15 ], [ 0, %0 ]
switch i32 %5, label %15 [
i32 10, label %9
i32 32, label %11
i32 9, label %13
]
9: ; preds = %4
%10 = add nsw i64 %6, 1
br label %15
11: ; preds = %4
%12 = add nsw i64 %8, 1
br label %15
13: ; preds = %4
%14 = add nsw i64 %7, 1
br label %15
15: ; preds = %4, %11, %13, %9
%16 = phi i64 [ %8, %9 ], [ %12, %11 ], [ %8, %13 ], [ %8, %4 ]
%17 = phi i64 [ %7, %9 ], [ %7, %11 ], [ %14, %13 ], [ %7, %4 ]
%18 = phi i64 [ %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 i64 [ 0, %0 ], [ %16, %15 ]
%24 = phi i64 [ 0, %0 ], [ %17, %15 ]
%25 = phi i64 [ 0, %0 ], [ %18, %15 ]
%26 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %25)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %23)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %24)
ret void
}