#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
main() {
  int blanks, tabs, newlines;
  char c;
  blanks = tabs = newlines = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ')
      blanks++;
    if (c == '\t')
      tabs++;
    if (c == '\n')
      newlines++;
  }
  printf("blanks = %2i\ntabs = %2i\nnewlines = %2i\n", blanks, tabs, newlines);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e90(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11aa <main+0x8a>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    1179 <main+0x59>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x9,%eax
jne    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11a5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%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,%ebp
mov    $0x0,%ebx
cmp    (%r15),%al
je     1178 <main+0x58>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
xchg   %ax,%ax
xor    %ecx,%ecx
cmp    $0x20,%al
sete   %cl
add    %ecx,%ebx
xor    %ecx,%ecx
cmp    $0x9,%al
sete   %cl
add    %ecx,%r14d
xor    %ecx,%ecx
cmp    $0xa,%al
sete   %cl
add    %ecx,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
jne    1150 <main+0x30>
lea    0xe81(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i8 0
@.str = [40 x i8] c"blanks = %2i\0Atabs = %2i\0Anewlines = %2i\0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %21, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %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 i8 %5, 32
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %6, %10
%12 = icmp eq i8 %5, 9
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %8, %13
%15 = icmp eq i8 %5, 10
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %7, %16
%18 = tail call signext i8 (...) @getchar()
%19 = load i8, i8* @EOF
%20 = icmp eq i8 %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 ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %22, i32 %23)
ret i32 0
}