#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 EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ putchar(int);
int main(void) {
  int c;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      while ((c = getchar()) == ' ')
        ;
      putchar(' ');
    }
    putchar(c);
  }
  return EXIT_SUCCESS;
}


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     1186 <main+0x66>
cmpl   $0x20,-0x8(%rbp)
jne    1179 <main+0x59>
jmp    1157 <main+0x37>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x20,%eax
jne    116f <main+0x4f>
jmp    1157 <main+0x37>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
mov    0x2e4b(%rip),%rax
mov    (%rax),%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    1148 <main+0x28>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1165 <main+0x45>
nopl   0x0(%rax)
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
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %17, %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 %20
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 32
br i1 %9, label %10, label %17
10: ; preds = %7
br label %11
11: ; preds = %14, %10
%12 = call i32 (...) @getchar()
store i32 %12, i32* %2
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %15
14: ; preds = %11
br label %11
15: ; preds = %11
%16 = call i32 @putchar(i32 32)
br label %17
17: ; preds = %15, %7
%18 = load i32, i32* %2
%19 = call i32 @putchar(i32 %18)
br label %3
20: ; preds = %3
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}

LLVM IR (-O2):
@EOF = global i32 0
@EXIT_SUCCESS = 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 [ %8, %10 ], [ %5, %4 ]
%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
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}