#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() {
  char c;
  char prev = EOF;
  while ((c = getchar()) != EOF) {
    if (c == ' ' && c == prev)
      continue;
    putchar(c);
    prev = 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),%al
mov    %al,-0x6(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e99(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1190 <main+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    117c <main+0x5c>
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    117c <main+0x5c>
jmp    113b <main+0x1b>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x5(%rbp),%al
mov    %al,-0x6(%rbp)
jmp    113b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

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