#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 main() {
  int cblanks, ctabs, cnl, nc, c;
  cblanks = ctabs = cnl = 0;
  for (nc = 0; (c = getchar()) != EOF; ++nc) {
    if (c == ' ')
      cblanks++;
    else if (c == '\t')
      ctabs++;
    else if (c == '\n')
      cnl++;
  }
  printf("Blanks: %d\n", cblanks);
  printf("Tabs  : %d\n", ctabs);
  printf("Lines : %d\n", cnl);
}


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)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11c4 <main+0xa4>
cmpl   $0x20,-0x18(%rbp)
jne    117c <main+0x5c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x91>
cmpl   $0x9,-0x18(%rbp)
jne    1194 <main+0x74>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ac <main+0x8c>
cmpl   $0xa,-0x18(%rbp)
jne    11a7 <main+0x87>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ac <main+0x8c>
jmp    11b1 <main+0x91>
jmp    11b6 <main+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
mov    -0x8(%rbp),%esi
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe2c(%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),%eax
jne    117f <main+0x5f>
lea    0xeb2(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    119f <main+0x7f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%eax
je     1147 <main+0x27>
cmp    $0x9,%eax
je     11c0 <main+0xa0>
cmp    $0xa,%eax
je     1190 <main+0x70>
cmp    $0x20,%eax
jne    1193 <main+0x73>
add    $0x1,%ebx
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r14d
jmp    1193 <main+0x73>

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

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