#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 EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char **argv) {
  int c, ns, nt, nn;
  ns = nt = nn = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ')
      ns++;
    if (c == '\t')
      nt++;
    if (c == '\n')
      nn++;
  }
  printf("number of space: %d, number of tab: %d, number of nextline: %d\n", ns,
         nt, nn);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11a2 <main+0x82>
cmpl   $0x20,-0x14(%rbp)
jne    1177 <main+0x57>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x9,-0x14(%rbp)
jne    118a <main+0x6a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    119d <main+0x7d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <main+0x2b>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%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,%ebx
mov    $0x0,%ebp
cmp    (%r15),%eax
je     117b <main+0x5b>
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r14d,%r14d
xchg   %ax,%ax
xor    %ecx,%ecx
cmp    $0x20,%eax
sete   %cl
add    %ecx,%r14d
xor    %ecx,%ecx
cmp    $0x9,%eax
sete   %cl
add    %ecx,%ebx
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    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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