#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);
main2() {
  int c, nl;
  while ((c = getchar()) != EOF) {
    if (c == '\n' || c == '\t' || c == ' ') {
      ++nl;
    }
  }
  printf("%d\n", nl);
}


x86 assembly (clang, -O0):
<main2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eaf(%rip),%rcx
cmp    (%rcx),%eax
je     116d <main2+0x4d>
cmpl   $0xa,-0x8(%rbp)
je     115f <main2+0x3f>
cmpl   $0x9,-0x8(%rbp)
je     115f <main2+0x3f>
cmpl   $0x20,-0x8(%rbp)
jne    1168 <main2+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <main2+0x8>
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main2>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb5(%rip),%r14
movabs $0x100000600,%r15
jmp    114c <main2+0x2c>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     115e <main2+0x3e>
cmp    $0x20,%eax
ja     1140 <main2+0x20>
mov    %eax,%eax
bt     %rax,%r15
jae    1140 <main2+0x20>
add    $0x1,%ebx
jmp    1140 <main2+0x20>
lea    0xe9b(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main2() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp ne i32 %1, %2
br label %4
4: ; preds = %0, %9
%5 = phi i32 [ %11, %9 ], [ %1, %0 ]
%6 = phi i32 [ %10, %9 ], [ undef, %0 ]
switch i32 %5, label %9 [
i32 32, label %7
i32 10, label %7
i32 9, label %7
]
7: ; preds = %4, %4, %4
%8 = add nsw i32 %6, 1
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ %8, %7 ], [ %6, %4 ]
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %4
14: ; preds = %9
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 undef
}