#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);
int main(void) {
  char c;
  int blanks, tabs, nls = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      blanks++;
    }
    if (c == '\t') {
      tabs++;
    }
    if (c == '\n') {
      nls++;
    }
  }
  printf("%d blanks, %d tabs, and %d newlines.\n", blanks, tabs, nls);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     119c <main+0x7c>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    116b <main+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    1181 <main+0x61>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1197 <main+0x77>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r15
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0x20,%al
sete   %cl
add    %ecx,%ebx
xor    %ecx,%ecx
cmp    $0x9,%al
sete   %cl
add    %ecx,%ebp
xor    %ecx,%ecx
cmp    $0xa,%al
sete   %cl
add    %ecx,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
jne    1140 <main+0x20>
lea    0xe91(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%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 = [38 x i8] c"%d blanks, %d tabs, and %d newlines.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %33, %0
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %2
%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* %2
%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* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %19
19: ; preds = %16, %12
%20 = load i8, i8* %2
%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* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %26
26: ; preds = %23, %19
%27 = load i8, i8* %2
%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* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %33
33: ; preds = %30, %26
br label %6
34: ; preds = %6
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
ret i32 0
}

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