#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*/ isspace(int);
int /*<<< orphan*/ putchar(int);
int main() {
  int previousCharacter, currentCharacter;
  previousCharacter = ' ';
  while ((currentCharacter = getchar()) != EOF) {
    if (!isspace(previousCharacter) || !isspace(currentCharacter))
      putchar(currentCharacter);
    previousCharacter = currentCharacter;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     1194 <main+0x64>
mov    -0x8(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
je     1181 <main+0x51>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1189 <main+0x59>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
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   1050 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%eax
jne    1151 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x20,%ebx
jmp    1173 <main+0x43>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r14),%eax
je     1147 <main+0x17>
mov    %ebx,%edi
mov    %eax,%ebx
call   1040 <isspace@plt>
test   %eax,%eax
je     1160 <main+0x30>
mov    %ebx,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1167 <main+0x37>
jmp    1160 <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
store i32 32, i32* %2
br label %4
4: ; preds = %19, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %2
%10 = call i32 @isspace(i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @isspace(i32 %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12, %8
%17 = load i32, i32* %3
%18 = call i32 @putchar(i32 %17)
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* %3
store i32 %20, i32* %2
br label %4
21: ; preds = %4
%22 = load i32, i32* %1
ret i32 %22
}

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