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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%eax
je     1183 <main+0x63>
cmpl   $0x20,-0xc(%rbp)
jne    1166 <main+0x46>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0x20,-0x8(%rbp)
je     1178 <main+0x58>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    113b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
mov    (%r14),%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     115a <main+0x3a>
mov    %ebx,%ecx
mov    %eax,%ebx
cmp    $0x20,%ecx
jne    114c <main+0x2c>
mov    %ebx,%edi
call   1030 <putchar@plt>
cmp    $0x20,%ebx
je     1130 <main+0x10>
mov    %ebx,%edi
call   1030 <putchar@plt>
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
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @EOF
store i32 %4, i32* %3
br label %5
5: ; preds = %21, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %2
%14 = call i32 @putchar(i32 %13)
br label %15
15: ; preds = %12, %9
%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 = call i32 @putchar(i32 %19)
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %2
store i32 %22, i32* %3
br label %5
23: ; preds = %5
ret i32 0
}

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