#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 /*<<< orphan*/ putchar(int);
int main() {
  int c, first_space;
  first_space = 1;
  printf("-------------------------\n");
  while ((c = getchar()) != '\n' && c != EOF) {
    if (c == ' ' && first_space) {
      putchar(c);
      first_space = 0;
    } else if (c == ' ' && !first_space)
      continue;
    else {
      putchar(c);
      first_space = 1;
    }
  }
  printf("\n-------------------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xd(%rbp)
je     117e <main+0x4e>
mov    -0x8(%rbp),%eax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    118e <main+0x5e>
jmp    11e8 <main+0xb8>
cmpl   $0x20,-0x8(%rbp)
jne    11b6 <main+0x86>
cmpl   $0x0,-0xc(%rbp)
je     11b6 <main+0x86>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11e3 <main+0xb3>
cmpl   $0x20,-0x8(%rbp)
jne    11cf <main+0x9f>
cmpl   $0x0,-0xc(%rbp)
jne    11cf <main+0x9f>
jmp    1152 <main+0x22>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
jmp    11e3 <main+0xb3>
jmp    1152 <main+0x22>
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11a8 <main+0x78>
mov    0x2e95(%rip),%r14
cmp    (%r14),%eax
je     11a8 <main+0x78>
mov    $0x1,%ebx
nopl   (%rax)
test   %ebx,%ebx
je     1173 <main+0x43>
mov    $0x20,%edi
mov    $0x0,%ebp
cmp    $0x20,%eax
je     1190 <main+0x60>
mov    $0x1,%ebp
test   %ebx,%ebx
jne    1187 <main+0x57>
xor    %ebx,%ebx
mov    %eax,%edi
cmp    $0x20,%eax
je     1197 <main+0x67>
jmp    1190 <main+0x60>
mov    %eax,%edi
nopl   0x0(%rax)
call   1030 <putchar@plt>
mov    %ebp,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11a8 <main+0x78>
cmp    (%r14),%eax
jne    1160 <main+0x30>
lea    0xe51(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"-------------------------\0A\00"
@EOF = global i32 0
@.str.1 = [28 x i8] c"\0A-------------------------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %34, %29, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br label %12
12: ; preds = %8, %5
%13 = phi i1 [ false, %5 ], [ %11, %8 ]
br i1 %13, label %14, label %35
14: ; preds = %12
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 32
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %2
%22 = call i32 @putchar(i32 %21)
store i32 0, i32* %3
br label %34
23: ; preds = %17, %14
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %26
br label %5
30: ; preds = %26, %23
%31 = load i32, i32* %2
%32 = call i32 @putchar(i32 %31)
store i32 1, i32* %3
br label %33
33: ; preds = %30
br label %34
34: ; preds = %33, %20
br label %5
35: ; preds = %12
%36 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [26 x i8] c"-------------------------\00"
@str.2 = [27 x i8] c"\0A-------------------------\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = icmp ne i32 %2, 10
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %2, %4
%6 = select i1 %3, i1 %5, i1 false
br i1 %6, label %7, label %27
7: ; preds = %0, %20
%8 = phi i32 [ %22, %20 ], [ %2, %0 ]
%9 = phi i32 [ %21, %20 ], [ 1, %0 ]
%10 = icmp eq i32 %8, 32
%11 = icmp ne i32 %9, 0
%12 = and i1 %11, %10
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = icmp ne i32 %8, 32
%15 = or i1 %11, %14
br i1 %15, label %16, label %20
16: ; preds = %13, %7
%17 = phi i32 [ 32, %7 ], [ %8, %13 ]
%18 = phi i32 [ 0, %7 ], [ 1, %13 ]
%19 = tail call i32 @putchar(i32 %17)
br label %20
20: ; preds = %16, %13
%21 = phi i32 [ 0, %13 ], [ %18, %16 ]
%22 = tail call i32 (...) @getchar()
%23 = icmp ne i32 %22, 10
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %22, %24
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %7, label %27
27: ; preds = %20, %0
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}