#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*/ putchar(char);
int main(void) {
  int c = 0;
  do {
    c = getchar();
    while (c == ' ') {
      c = getchar();
    }
    while ((c != EOF) && (c != ' ') && (c != '\n')) {
      putchar(c);
      c = getchar();
    }
    putchar('\n');
    while (c != EOF && c != '\n') {
      c = getchar();
    }
  } while (c != EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jne    1159 <main+0x39>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    1140 <main+0x20>
jmp    115e <main+0x3e>
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
mov    0x2e7e(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x9(%rbp)
je     118e <main+0x6e>
xor    %eax,%eax
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     118e <main+0x6e>
cmpl   $0xa,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    119e <main+0x7e>
jmp    11b8 <main+0x98>
mov    -0x8(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    115e <main+0x3e>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
mov    0x2e1a(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xa(%rbp)
je     11e3 <main+0xc3>
cmpl   $0xa,-0x8(%rbp)
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11f3 <main+0xd3>
jmp    1202 <main+0xe2>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    11c2 <main+0xa2>
jmp    1207 <main+0xe7>
mov    -0x8(%rbp),%eax
mov    0x2dd7(%rip),%rcx
cmp    (%rcx),%eax
jne    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
jmp    1138 <main+0x18>
nopl   (%rax)
test   %cl,%cl
je     11d1 <main+0xb1>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    $0x20,%eax
jne    115e <main+0x3e>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x20,%eax
je     1150 <main+0x30>
mov    %eax,%ebx
cmp    (%r14),%ebx
je     1190 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xa,%ebx
je     1190 <main+0x70>
cmp    $0x20,%ebx
je     1190 <main+0x70>
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
jne    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r14),%eax
cmp    %eax,%ebx
setne  %cl
cmp    $0xa,%ebx
je     1130 <main+0x10>
cmp    %eax,%ebx
je     1130 <main+0x10>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    (%r14),%edx
cmp    %edx,%eax
setne  %cl
cmp    $0xa,%eax
je     1130 <main+0x10>
cmp    %edx,%eax
jne    11b0 <main+0x90>
jmp    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %42, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
br label %5
5: ; preds = %8, %3
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 (...) @getchar()
store i32 %9, i32* %2
br label %5
10: ; preds = %5
br label %11
11: ; preds = %23, %10
%12 = load i32, i32* %2
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 32
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, 10
br label %21
21: ; preds = %18, %15, %11
%22 = phi i1 [ false, %15 ], [ false, %11 ], [ %20, %18 ]
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = load i32, i32* %2
%25 = trunc i32 %24 to i8
%26 = call i32 @putchar(i8 signext %25)
%27 = call i32 (...) @getchar()
store i32 %27, i32* %2
br label %11
28: ; preds = %21
%29 = call i32 @putchar(i8 signext 10)
br label %30
30: ; preds = %39, %28
%31 = load i32, i32* %2
%32 = load i32, i32* @EOF
%33 = icmp ne i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %2
%36 = icmp ne i32 %35, 10
br label %37
37: ; preds = %34, %30
%38 = phi i1 [ false, %30 ], [ %36, %34 ]
br i1 %38, label %39, label %41
39: ; preds = %37
%40 = call i32 (...) @getchar()
store i32 %40, i32* %2
br label %30
41: ; preds = %37
br label %42
42: ; preds = %41
%43 = load i32, i32* %2
%44 = load i32, i32* @EOF
%45 = icmp ne i32 %43, %44
br i1 %45, label %3, label %46
46: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
br label %1
1: ; preds = %34, %0
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 32
br i1 %3, label %9, label %4
4: ; preds = %9, %1
%5 = phi i32 [ %2, %1 ], [ %10, %9 ]
%6 = load i32, i32* @EOF
%7 = freeze i32 %6
%8 = icmp eq i32 %5, %7
br i1 %8, label %21, label %12
9: ; preds = %1, %9
%10 = tail call i32 (...) @getchar()
%11 = icmp eq i32 %10, 32
br i1 %11, label %9, label %4
12: ; preds = %4, %14
%13 = phi i32 [ %17, %14 ], [ %5, %4 ]
switch i32 %13, label %14 [
i32 32, label %21
i32 10, label %21
]
14: ; preds = %12
%15 = trunc i32 %13 to i8
%16 = tail call i32 @putchar(i8 signext %15)
%17 = tail call i32 (...) @getchar()
%18 = load i32, i32* @EOF
%19 = freeze i32 %18
%20 = icmp eq i32 %17, %19
br i1 %20, label %21, label %12
21: ; preds = %14, %12, %12, %4
%22 = phi i32 [ %5, %4 ], [ %13, %12 ], [ %13, %12 ], [ %17, %14 ]
%23 = tail call i32 @putchar(i8 signext 10)
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %22, %24
%26 = icmp ne i32 %22, 10
%27 = and i1 %26, %25
br i1 %27, label %28, label %34
28: ; preds = %21, %28
%29 = tail call i32 (...) @getchar()
%30 = load i32, i32* @EOF
%31 = icmp ne i32 %29, %30
%32 = icmp ne i32 %29, 10
%33 = and i1 %32, %31
br i1 %33, label %28, label %34
34: ; preds = %28, %21
%35 = phi i1 [ %25, %21 ], [ %31, %28 ]
br i1 %35, label %1, label %36
36: ; preds = %34
ret i32 0
}