#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(int);
main() {
  int c, cont;
  cont = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      ++cont;
      if (cont == 1)
        putchar(c);
    }
    if (c != ' ' && cont > 0)
      cont = 0;
    if (cont == 0)
      putchar(c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11ab <main+0x8b>
cmpl   $0x20,-0x8(%rbp)
jne    1179 <main+0x59>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1174 <main+0x54>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1179 <main+0x59>
cmpl   $0x20,-0x8(%rbp)
je     1194 <main+0x74>
cmpl   $0x0,-0xc(%rbp)
jle    1194 <main+0x74>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a6 <main+0x86>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%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
cmp    (%r15),%eax
jne    114a <main+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    1180 <main+0x60>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
nop
mov    %ebp,%eax
test   %ebp,%ebp
cmovg  %r14d,%ebp
cmp    $0x20,%ebx
cmove  %eax,%ebp
test   %ebp,%ebp
je     1190 <main+0x70>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     113d <main+0x1d>
cmp    $0x20,%ebx
jne    1160 <main+0x40>
test   %ebp,%ebp
je     1150 <main+0x30>
add    $0x1,%ebp
jmp    1160 <main+0x40>
xchg   %ax,%ax
mov    %ebx,%edi
call   1030 <putchar@plt>
jmp    1172 <main+0x52>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %33, %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 %34
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %2
%18 = call i32 @putchar(i32 %17)
br label %19
19: ; preds = %16, %11
br label %20
20: ; preds = %19, %8
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 32
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 0, i32* %3
br label %27
27: ; preds = %26, %23, %20
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %2
%32 = call i32 @putchar(i32 %31)
br label %33
33: ; preds = %30, %27
br label %4
34: ; preds = %4
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %26, label %4
4: ; preds = %0, %22
%5 = phi i32 [ %23, %22 ], [ %1, %0 ]
%6 = phi i32 [ %18, %22 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 32
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = add nsw i32 %6, 1
%10 = icmp eq i32 %6, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @putchar(i32 32)
br label %13
13: ; preds = %8, %11, %4
%14 = phi i32 [ 1, %11 ], [ %9, %8 ], [ %6, %4 ]
%15 = icmp ne i32 %5, 32
%16 = icmp sgt i32 %14, 0
%17 = select i1 %15, i1 %16, i1 false
%18 = select i1 %17, i32 0, i32 %14
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = tail call i32 @putchar(i32 %5)
br label %22
22: ; preds = %20, %13
%23 = tail call i32 (...) @getchar()
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %4
26: ; preds = %22, %0
ret i32 0
}