#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 main() {
  char c = '\0';
  bool ws = false;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (ws) {
        continue;
      } else {
        ws = true;
        printf(" ");
        continue;
      }
    }
    ws = false;
    printf("%c", c);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9a(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11c7 <main+0xa7>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     1180 <main+0x60>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     1180 <main+0x60>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11a9 <main+0x89>
cmpl   $0x0,-0xc(%rbp)
je     118f <main+0x6f>
jmp    113a <main+0x1a>
movl   $0x1,-0xc(%rbp)
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113a <main+0x1a>
movl   $0x0,-0xc(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113a <main+0x1a>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%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
cmp    (%r15),%al
jne    1151 <main+0x31>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%bl
movabs $0x100000600,%r14
jmp    1179 <main+0x59>
nop
movsbl %al,%edi
mov    $0x1,%bpl
call   1030 <putchar@plt>
mov    %ebp,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
je     113a <main+0x1a>
cmp    $0x20,%al
ja     1160 <main+0x40>
movzbl %al,%ecx
bt     %rcx,%r14
jae    1160 <main+0x40>
mov    $0x20,%edi
xor    %ebp,%ebp
test   $0x1,%bl
mov    $0x0,%ebx
jne    1166 <main+0x46>
jmp    116d <main+0x4d>

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

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %19, label %4
4: ; preds = %0, %12
%5 = phi i8 [ %14, %12 ], [ %1, %0 ]
%6 = phi i1 [ %13, %12 ], [ true, %0 ]
switch i8 %5, label %17 [
i8 32, label %7
i8 10, label %7
i8 9, label %7
]
7: ; preds = %4, %4, %4
br i1 %6, label %8, label %12
8: ; preds = %7, %17
%9 = phi i32 [ %18, %17 ], [ 32, %7 ]
%10 = phi i1 [ true, %17 ], [ false, %7 ]
%11 = tail call i32 @putchar(i32 %9)
br label %12
12: ; preds = %8, %7
%13 = phi i1 [ false, %7 ], [ %10, %8 ]
%14 = tail call signext i8 (...) @getchar()
%15 = load i8, i8* @EOF
%16 = icmp eq i8 %14, %15
br i1 %16, label %19, label %4
17: ; preds = %4
%18 = sext i8 %5 to i32
br label %8
19: ; preds = %12, %0
%20 = tail call i32 @putchar(i32 10)
ret i32 0
}