#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 */
long EOF;
long getchar();
int /*<<< orphan*/ printf(char *, long, long, long);
void e_1_8() {
  long c, newLineCount, tabCount, spaceCount;
  newLineCount = tabCount = spaceCount = 0;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '\n':
      ++newLineCount;
      break;
    case '\t':
      ++tabCount;
      break;
    case ' ':
      ++spaceCount;
      break;
    }
  }
  printf("newLineCount: %ld, tabCount: %ld, spaceCount: %ld\n", newLineCount,
         tabCount, spaceCount);
}


x86 assembly (clang, -O0):
<e_1_8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %rax,-0x8(%rbp)
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
je     11cb <e_1_8+0xab>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
sub    $0x9,%rax
je     11a9 <e_1_8+0x89>
jmp    1172 <e_1_8+0x52>
mov    -0x28(%rbp),%rax
sub    $0xa,%rax
je     1198 <e_1_8+0x78>
jmp    1185 <e_1_8+0x65>
mov    -0x28(%rbp),%rax
sub    $0x20,%rax
je     11ba <e_1_8+0x9a>
jmp    11c6 <e_1_8+0xa6>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11c6 <e_1_8+0xa6>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11c6 <e_1_8+0xa6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1140 <e_1_8+0x20>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_1_8>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eaf(%rip),%r12
cmp    (%r12),%rax
jne    1164 <e_1_8+0x44>
xor    %r15d,%r15d
xor    %ebx,%ebx
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    1181 <e_1_8+0x61>
xchg   %ax,%ax
add    $0x1,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r12),%rax
je     1144 <e_1_8+0x24>
cmp    $0x9,%rax
je     11a0 <e_1_8+0x80>
cmp    $0x20,%rax
je     1170 <e_1_8+0x50>
cmp    $0xa,%rax
jne    1174 <e_1_8+0x54>
add    $0x1,%r14
jmp    1174 <e_1_8+0x54>
nopl   0x0(%rax)
add    $0x1,%r15
jmp    1174 <e_1_8+0x54>

LLVM IR (-O0):
@EOF = global i64 0
@.str = [51 x i8] c"newLineCount: %ld, tabCount: %ld, spaceCount: %ld\0A\00"
define void @e_1_8() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 0, i64* %4
store i64 0, i64* %3
store i64 0, i64* %2
br label %5
5: ; preds = %20, %0
%6 = call i64 (...) @getchar()
store i64 %6, i64* %1
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i64, i64* %1
switch i64 %10, label %20 [
i64 10, label %11
i64 9, label %14
i64 32, label %17
]
11: ; preds = %9
%12 = load i64, i64* %2
%13 = add nsw i64 %12, 1
store i64 %13, i64* %2
br label %20
14: ; preds = %9
%15 = load i64, i64* %3
%16 = add nsw i64 %15, 1
store i64 %16, i64* %3
br label %20
17: ; preds = %9
%18 = load i64, i64* %4
%19 = add nsw i64 %18, 1
store i64 %19, i64* %4
br label %20
20: ; preds = %9, %17, %14, %11
br label %5
21: ; preds = %5
%22 = load i64, i64* %2
%23 = load i64, i64* %3
%24 = load i64, i64* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 %22, i64 %23, i64 %24)
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [51 x i8] c"newLineCount: %ld, tabCount: %ld, spaceCount: %ld\0A\00"
define void @e_1_8() {
%1 = tail call i64 (...) @getchar()
%2 = load i64, i64* @EOF
%3 = icmp eq i64 %1, %2
br i1 %3, label %22, label %4
4: ; preds = %0, %15
%5 = phi i64 [ %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 i64 %5, label %15 [
i64 10, label %9
i64 9, label %11
i64 32, label %13
]
9: ; preds = %4
%10 = add nsw i64 %8, 1
br label %15
11: ; preds = %4
%12 = add nsw i64 %7, 1
br label %15
13: ; preds = %4
%14 = add nsw i64 %6, 1
br label %15
15: ; preds = %4, %13, %11, %9
%16 = phi i64 [ %8, %4 ], [ %8, %13 ], [ %8, %11 ], [ %10, %9 ]
%17 = phi i64 [ %7, %4 ], [ %7, %13 ], [ %12, %11 ], [ %7, %9 ]
%18 = phi i64 [ %6, %4 ], [ %14, %13 ], [ %6, %11 ], [ %6, %9 ]
%19 = tail call i64 (...) @getchar()
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %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 ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 %23, i64 %24, i64 %25)
ret void
}