#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 argc, char *argv[]) {
  int old_ch, ch;
  ch = old_ch = 0;
  while ((ch = getchar()) != EOF) {
    if (ch != ' ' || old_ch != ' ')
      putchar(ch);
    old_ch = ch;
  }
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     1184 <main+0x64>
cmpl   $0x20,-0x18(%rbp)
jne    1171 <main+0x51>
cmpl   $0x20,-0x14(%rbp)
je     1179 <main+0x59>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%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
xor    %ebx,%ebx
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     1137 <main+0x17>
mov    %ebx,%ecx
mov    %eax,%ebx
cmp    $0x20,%ecx
jne    1150 <main+0x30>
cmp    $0x20,%ebx
je     1157 <main+0x37>
jmp    1150 <main+0x30>

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

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