#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);
void main(void) {
  char estado = 0;
  int c;
  while ((c = getchar()) != EOF) {
    switch (estado) {
    case 0:
      if (c == ' ')
        estado = 1;
      putchar(c);
      break;
    case 1:
      if (c != ' ') {
        estado = 0;
        putchar(c);
      }
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%eax
je     11a5 <main+0x85>
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     116a <main+0x4a>
jmp    1159 <main+0x39>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1185 <main+0x65>
jmp    11a0 <main+0x80>
cmpl   $0x20,-0x8(%rbp)
jne    1178 <main+0x58>
movb   $0x1,-0x1(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x80>
cmpl   $0x20,-0x8(%rbp)
je     119b <main+0x7b>
movb   $0x0,-0x1(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x80>
jmp    112c <main+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%eax
jne    113c <main+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1152 <main+0x32>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1135 <main+0x15>
cmp    $0x1,%bpl
je     1170 <main+0x50>
test   %bpl,%bpl
jne    1147 <main+0x27>
cmp    $0x20,%eax
sete   %bpl
jmp    1140 <main+0x20>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%bpl
cmp    $0x20,%eax
je     1147 <main+0x27>
xor    %ebp,%ebp
jmp    1140 <main+0x20>

LLVM IR (-O0):
@EOF = global i32 0
define void @main() {
%1 = alloca i8
%2 = alloca i32
store i8 0, i8* %1
br label %3
3: ; preds = %24, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %25
7: ; preds = %3
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %24 [
i32 0, label %10
i32 1, label %17
]
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %14
13: ; preds = %10
store i8 1, i8* %1
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
br label %24
17: ; preds = %7
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 32
br i1 %19, label %20, label %23
20: ; preds = %17
store i8 0, i8* %1
%21 = load i32, i32* %2
%22 = call i32 @putchar(i32 %21)
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %7, %23, %14
br label %3
25: ; preds = %3
ret void
}

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