#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*/ putchar(char);
int main(void) {
  int in_space = 0;
  char c;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      if (!in_space) {
        in_space = 1;
        putchar(c);
      }
    } else {
      in_space = 0;
      putchar(c);
    }
  }
}


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    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1196 <main+0x76>
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
jne    1181 <main+0x61>
cmpl   $0x0,-0x8(%rbp)
jne    117c <main+0x5c>
movl   $0x1,-0x8(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
jmp    1191 <main+0x71>
movl   $0x0,-0x8(%rbp)
movsbl -0x9(%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   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%al
jne    113e <main+0x1e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ecx,%ecx
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%al
je     1135 <main+0x15>
xor    %ebp,%ebp
cmp    $0x20,%al
jne    1150 <main+0x30>
mov    $0x1,%ebp
test   %ecx,%ecx
jne    1158 <main+0x38>
mov    $0x20,%al
jmp    1150 <main+0x30>

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

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, %14
%5 = phi i8 [ %16, %14 ], [ %1, %0 ]
%6 = phi i32 [ %15, %14 ], [ 0, %0 ]
%7 = icmp eq i8 %5, 32
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = icmp eq i32 %6, 0
br i1 %9, label %10, label %14
10: ; preds = %4, %8
%11 = phi i8 [ 32, %8 ], [ %5, %4 ]
%12 = phi i32 [ 1, %8 ], [ 0, %4 ]
%13 = tail call i32 @putchar(i8 signext %11)
br label %14
14: ; preds = %10, %8
%15 = phi i32 [ 1, %8 ], [ %12, %10 ]
%16 = tail call signext i8 (...) @getchar()
%17 = load i8, i8* @EOF
%18 = icmp eq i8 %16, %17
br i1 %18, label %19, label %4
19: ; preds = %14, %0
ret i32 0
}