#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 const *argv[]) {
  int c;
  int blankStreak = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' && blankStreak >= 1)
      ++blankStreak;
    else {
      if (c == ' ')
        ++blankStreak;
      else
        blankStreak = 0;
      putchar(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)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11a4 <main+0x84>
cmpl   $0x20,-0x14(%rbp)
jne    1178 <main+0x58>
cmpl   $0x1,-0x18(%rbp)
jl     1178 <main+0x58>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x7f>
cmpl   $0x20,-0x14(%rbp)
jne    1190 <main+0x70>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1197 <main+0x77>
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%rbx
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ecx,%ecx
jmp    116b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x20,%eax
cmovne %r14d,%ebp
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1139 <main+0x19>
lea    0x1(%rcx),%ebp
cmp    $0x20,%eax
jne    1150 <main+0x30>
test   %ecx,%ecx
jg     115e <main+0x3e>
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* %7
br label %8
8: ; preds = %31, %2
%9 = call i32 (...) @getchar()
store i32 %9, i32* %6
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp sge i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %31
21: ; preds = %15, %12
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 32
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %28
27: ; preds = %21
store i32 0, i32* %7
br label %28
28: ; preds = %27, %24
%29 = load i32, i32* %6
%30 = call i32 @putchar(i32 %29)
br label %31
31: ; preds = %28, %18
br label %8
32: ; 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 %21, label %6
6: ; preds = %2, %16
%7 = phi i32 [ %18, %16 ], [ %3, %2 ]
%8 = phi i32 [ %17, %16 ], [ 0, %2 ]
%9 = icmp eq i32 %7, 32
%10 = icmp sgt i32 %8, 0
%11 = select i1 %9, i1 %10, i1 false
%12 = add nsw i32 %8, 1
br i1 %11, label %16, label %13
13: ; preds = %6
%14 = select i1 %9, i32 %12, i32 0
%15 = tail call i32 @putchar(i32 %7)
br label %16
16: ; preds = %6, %13
%17 = phi i32 [ %14, %13 ], [ %12, %6 ]
%18 = tail call i32 (...) @getchar()
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16, %2
ret i32 0
}