#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*/ printf(char *, ...);
int main(void) {
  char blank_space = 0;
  int c;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      blank_space = 1;
      continue;
    } else if (blank_space == 1) {
      printf(" ");
      blank_space = 0;
    }
    printf("%c", c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%eax
je     1199 <main+0x79>
cmpl   $0x20,-0xc(%rbp)
jne    115f <main+0x3f>
movb   $0x1,-0x5(%rbp)
jmp    1133 <main+0x13>
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    117e <main+0x5e>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x5(%rbp)
jmp    1183 <main+0x63>
mov    -0xc(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1133 <main+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r14
cmp    (%r14),%eax
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    116b <main+0x4b>
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    %ebp,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %r15d,%ebp
cmp    (%r14),%eax
je     113a <main+0x1a>
mov    $0x1,%r15b
cmp    $0x20,%ebx
je     115a <main+0x3a>
cmp    $0x1,%bpl
jne    1150 <main+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1150 <main+0x30>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %2
br label %4
4: ; preds = %19, %11, %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 %22
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %12
11: ; preds = %8
store i8 1, i8* %2
br label %4
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %2
br label %18
18: ; preds = %16, %12
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %4
22: ; preds = %4
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 [ %17, %15 ], [ %1, %0 ]
%6 = phi i8 [ %16, %15 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 32
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = icmp eq i8 %6, 1
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @putchar(i32 32)
br label %12
12: ; preds = %8, %10
%13 = phi i8 [ 0, %10 ], [ %6, %8 ]
%14 = tail call i32 @putchar(i32 %5)
br label %15
15: ; preds = %12, %4
%16 = phi i8 [ %13, %12 ], [ 1, %4 ]
%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
}