#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(void) {
  int ch = getchar(), blank_p = 0;
  while (ch != EOF) {
    ;
    if (blank_p) {
      ;
      if (ch == ' ') {
        ;
        ch = getchar();
      } else {
        ;
        blank_p = 0;
        putchar(' ');
        putchar(ch);
        ch = getchar();
      }
    } else {
      ;
      if (ch == ' ') {
        ;
        blank_p = 1;
        ch = getchar();
      } else {
        ;
        putchar(ch);
        ch = getchar();
      }
    }
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
je     11d9 <main+0xb9>
cmpl   $0x0,-0xc(%rbp)
je     119d <main+0x7d>
cmpl   $0x20,-0x8(%rbp)
jne    1175 <main+0x55>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    1198 <main+0x78>
movl   $0x0,-0xc(%rbp)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    11d4 <main+0xb4>
cmpl   $0x20,-0x8(%rbp)
jne    11bd <main+0x9d>
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    11cf <main+0xaf>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    11d4 <main+0xb4>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    1167 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1137 <main+0x17>
test   %ebp,%ebp
je     1190 <main+0x70>
mov    $0x1,%ebp
cmp    $0x20,%ebx
je     1159 <main+0x39>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
cmp    $0x20,%ebx
jne    1150 <main+0x30>
jmp    1159 <main+0x39>

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

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