#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 c1;
  int c2;
  while ((c1 = getchar()) != EOF) {
    while (c1 == ' ') {
      c2 = getchar();
      if (c2 != ' ') {
        putchar(' ');
        c1 = c2;
      }
    }
    putchar(c1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     118d <main+0x6d>
jmp    114d <main+0x2d>
cmpl   $0x20,-0x8(%rbp)
jne    1180 <main+0x60>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
je     117b <main+0x5b>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    1141 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1137 <main+0x17>
cmp    $0x20,%ebx
jne    1150 <main+0x30>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x20,%eax
je     1170 <main+0x50>
mov    %eax,%ebx
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x30>

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

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