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


x86 assembly (clang, -O0):
<IncopyOut3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     11b6 <IncopyOut3+0x96>
cmpl   $0x20,-0x4(%rbp)
jne    1175 <IncopyOut3+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1170 <IncopyOut3+0x50>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a7 <IncopyOut3+0x87>
cmpl   $0xa,-0x4(%rbp)
jne    1193 <IncopyOut3+0x73>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x8(%rbp)
jmp    11a2 <IncopyOut3+0x82>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x8(%rbp)
jmp    11a7 <IncopyOut3+0x87>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
jmp    1139 <IncopyOut3+0x19>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IncopyOut3>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%eax
jne    113e <IncopyOut3+0x1e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ecx,%ecx
jmp    1164 <IncopyOut3+0x44>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1135 <IncopyOut3+0x15>
xor    %ebp,%ebp
cmp    $0x20,%eax
jne    1150 <IncopyOut3+0x30>
lea    0x1(%rcx),%ebp
test   %ecx,%ecx
jg     1157 <IncopyOut3+0x37>
mov    $0x20,%eax
jmp    1150 <IncopyOut3+0x30>

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @IncopyOut3() {
%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 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = add nsw i32 %5, 1
%10 = icmp slt i32 %5, 1
br i1 %10, label %11, label %15
11: ; preds = %4, %8
%12 = phi i32 [ 32, %8 ], [ %6, %4 ]
%13 = phi i32 [ %9, %8 ], [ 0, %4 ]
%14 = tail call i32 @putchar(i32 %12)
br label %15
15: ; preds = %11, %8
%16 = phi i32 [ %9, %8 ], [ %13, %11 ]
%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
}