#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, int, int, int);
int main(int argc, char *argv[]) {
  int c, tabs, spaces, newlines, others;
  c = tabs = spaces = newlines = others = 0;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '\t':
      ++tabs;
      break;
    case ' ':
      ++spaces;
      break;
    case '\n':
      ++newlines;
      break;
    default:
      ++others;
    }
  }
  printf("Tabs: %i, spaces: %i, new-lines: %i, others: %i\n", tabs, spaces,
         newlines, others);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
je     11e0 <main+0xc0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x9,%eax
je     11a8 <main+0x88>
jmp    1186 <main+0x66>
mov    -0x28(%rbp),%eax
sub    $0xa,%eax
je     11c4 <main+0xa4>
jmp    1197 <main+0x77>
mov    -0x28(%rbp),%eax
sub    $0x20,%eax
je     11b6 <main+0x96>
jmp    11d2 <main+0xb2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11db <main+0xbb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11db <main+0xbb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11db <main+0xbb>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1159 <main+0x39>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%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,%ebx
mov    $0x0,%r15d
cmp    (%r12),%eax
jne    1170 <main+0x50>
lea    0xeaa(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    1190 <main+0x70>
nopl   0x0(%rax)
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r12),%eax
je     114f <main+0x2f>
cmp    $0x20,%eax
je     11b0 <main+0x90>
cmp    $0xa,%eax
je     1180 <main+0x60>
cmp    $0x9,%eax
jne    11c0 <main+0xa0>
add    $0x1,%r14d
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
jmp    1183 <main+0x63>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [49 x i8] c"Tabs: %i, spaces: %i, new-lines: %i, others: %i\0A\00"
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 %28, label %6
6: ; preds = %2, %20
%7 = phi i32 [ %25, %20 ], [ %3, %2 ]
%8 = phi i32 [ %24, %20 ], [ 0, %2 ]
%9 = phi i32 [ %23, %20 ], [ 0, %2 ]
%10 = phi i32 [ %22, %20 ], [ 0, %2 ]
%11 = phi i32 [ %21, %20 ], [ 0, %2 ]
switch i32 %7, label %18 [
i32 9, label %12
i32 32, label %14
i32 10, label %16
]
12: ; preds = %6
%13 = add nsw i32 %11, 1
br label %20
14: ; preds = %6
%15 = add nsw i32 %10, 1
br label %20
16: ; preds = %6
%17 = add nsw i32 %9, 1
br label %20
18: ; preds = %6
%19 = add nsw i32 %8, 1
br label %20
20: ; preds = %18, %16, %14, %12
%21 = phi i32 [ %11, %18 ], [ %11, %16 ], [ %11, %14 ], [ %13, %12 ]
%22 = phi i32 [ %10, %18 ], [ %10, %16 ], [ %15, %14 ], [ %10, %12 ]
%23 = phi i32 [ %9, %18 ], [ %17, %16 ], [ %9, %14 ], [ %9, %12 ]
%24 = phi i32 [ %19, %18 ], [ %8, %16 ], [ %8, %14 ], [ %8, %12 ]
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %6
28: ; preds = %20, %2
%29 = phi i32 [ 0, %2 ], [ %21, %20 ]
%30 = phi i32 [ 0, %2 ], [ %22, %20 ]
%31 = phi i32 [ 0, %2 ], [ %23, %20 ]
%32 = phi i32 [ 0, %2 ], [ %24, %20 ]
%33 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30, i32 %31, i32 %32)
ret i32 0
}