#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);
void main() {
  int space = 0;
  int table = 0;
  int enter = 0;
  int end;
  while ((end = getchar()) != EOF) {
    if (end == ' ')
      ++space;
    if (end == '\t')
      ++table;
    if (end == '\n')
      ++enter;
  }
  printf("the number of space is %d\n", space);
  printf("the number of table is %d\n", table);
  printf("the number of enter is %d\n", enter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     1194 <main+0x74>
cmpl   $0x20,-0x10(%rbp)
jne    1169 <main+0x49>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x9,-0x10(%rbp)
jne    117c <main+0x5c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x10(%rbp)
jne    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%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),%eax
je     117b <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,%r14d
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%eax
jne    1150 <main+0x30>
lea    0xe7e(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [27 x i8] c"the number of space is %d\0A\00"
@.str.1 = [27 x i8] c"the number of table is %d\0A\00"
@.str.2 = [27 x i8] c"the number of enter is %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %27, %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 %28
9: ; preds = %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %15
15: ; preds = %12, %9
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 9
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 10
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %27
27: ; preds = %24, %21
br label %5
28: ; preds = %5
%29 = load i32, i32* %1
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %33)
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [27 x i8] c"the number of space is %d\0A\00"
@.str.1 = [27 x i8] c"the number of table is %d\0A\00"
@.str.2 = [27 x i8] c"the number of enter is %d\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 %21, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %18, %4 ], [ %1, %0 ]
%6 = phi i32 [ %11, %4 ], [ 0, %0 ]
%7 = phi i32 [ %17, %4 ], [ 0, %0 ]
%8 = phi i32 [ %14, %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 %8, %13
%15 = icmp eq i32 %5, 10
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %7, %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 ], [ %14, %4 ]
%23 = phi i32 [ 0, %0 ], [ %17, %4 ]
%24 = phi i32 [ 0, %0 ], [ %11, %4 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret void
}