#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);
int main(void) {
  int c;
  int nbnl = 0, nbs = 0, nbt = 0, nbc = 0;
  while ((c = getchar()) != EOF) {
    nbc++;
    if (c == '\n')
      nbnl++;
    else if (c == '\t')
      nbt++;
    else if (c == ' ')
      nbs++;
  }
  printf("\n\nChar: %d\nTab: %d\nSpaces: %d\nNew lines: %d\n", nbc, nbt, nbs,
         nbnl);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11bf <main+0x9f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    1185 <main+0x65>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ba <main+0x9a>
cmpl   $0x9,-0x8(%rbp)
jne    119d <main+0x7d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b5 <main+0x95>
cmpl   $0x20,-0x8(%rbp)
jne    11b0 <main+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b5 <main+0x95>
jmp    11ba <main+0x9a>
jmp    114b <main+0x2b>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eaf(%rip),%r12
mov    $0x0,%ebp
mov    $0x0,%r15d
mov    $0x0,%ebx
cmp    (%r12),%eax
jne    1177 <main+0x57>
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    11a3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    (%r12),%eax
je     114f <main+0x2f>
cmp    $0x9,%eax
je     11c0 <main+0xa0>
cmp    $0x20,%eax
je     1190 <main+0x70>
cmp    $0xa,%eax
jne    1193 <main+0x73>
add    $0x1,%r14d
jmp    1193 <main+0x73>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
jmp    1193 <main+0x73>

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

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