#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() {
  int c, nl, tl, sl;
  sl = 0;
  tl = 0;
  nl = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      ++sl;
    }
    if (c == '\t') {
      ++tl;
    }
    if (c == '\n') {
      ++nl;
    }
  }
  printf("\n");
  printf("%s%d\n", "Spaces: ", sl);
  printf("%s%d\n", "Tabs: ", tl);
  printf("%s%d\n", "Ends: ", nl);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     119b <main+0x7b>
cmpl   $0x20,-0x8(%rbp)
jne    1170 <main+0x50>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x9,-0x8(%rbp)
jne    1183 <main+0x63>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    1196 <main+0x76>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edx
lea    0xe4d(%rip),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%edx
lea    0xe35(%rip),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edx
lea    0xe1d(%rip),%rdi
lea    0xe2c(%rip),%rsi
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),%r15
mov    $0x0,%ebp
mov    $0x0,%ebx
cmp    (%r15),%eax
je     118b <main+0x5b>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
xchg   %ax,%ax
xor    %ecx,%ecx
cmp    $0x20,%eax
sete   %cl
add    %ecx,%ebx
xor    %ecx,%ecx
cmp    $0x9,%eax
sete   %cl
add    %ecx,%ebp
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%eax
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe64(%rip),%r15
lea    0xe63(%rip),%rsi
mov    %r15,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe59(%rip),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4d(%rip),%rsi
mov    %r15,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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