#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(int argc, char *argv[]) {
  char c, a = EOF;
  while ((c = getchar()) != EOF) {
    if (c == ' ' && a != ' ')
      putchar(c);
    else if (c == ' ' && a == ' ')
      ;
    else
      putchar(c);
    a = c;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e92(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11c1 <main+0xa1>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    1189 <main+0x69>
movsbl -0x12(%rbp),%eax
cmp    $0x20,%eax
je     1189 <main+0x69>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
jmp    11b6 <main+0x96>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    11a8 <main+0x88>
movsbl -0x12(%rbp),%eax
cmp    $0x20,%eax
jne    11a8 <main+0x88>
jmp    11b1 <main+0x91>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
jmp    11b6 <main+0x96>
mov    -0x11(%rbp),%al
mov    %al,-0x12(%rbp)
jmp    1142 <main+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
mov    (%r14),%bpl
xor    %eax,%eax
call   1040 <getchar@plt>
jmp    1151 <main+0x31>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebx,%ebp
cmp    (%r14),%al
je     1175 <main+0x55>
mov    %eax,%ebx
cmp    $0x20,%al
jne    1164 <main+0x44>
mov    $0x20,%al
cmp    $0x20,%bpl
jne    1140 <main+0x20>
mov    %ebx,%eax
cmp    $0x20,%bl
jne    1140 <main+0x20>
mov    %ebx,%eax
cmp    $0x20,%bpl
je     1148 <main+0x28>
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8, i8* @EOF
store i8 %8, i8* %7
br label %9
9: ; preds = %39, %2
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %41
15: ; preds = %9
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 32
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8, i8* %6
%25 = call i32 @putchar(i8 signext %24)
br label %39
26: ; preds = %19, %15
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 32
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 32
br i1 %33, label %34, label %35
34: ; preds = %30
br label %38
35: ; preds = %30, %26
%36 = load i8, i8* %6
%37 = call i32 @putchar(i8 signext %36)
br label %38
38: ; preds = %35, %34
br label %39
39: ; preds = %38, %23
%40 = load i8, i8* %6
store i8 %40, i8* %7
br label %9
41: ; preds = %9
ret i32 0
}

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