#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*/ isduplicate(int, int);
scalar_t__ iswordsplitter(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int main() {
  int character, previous_character;
  printf("Input text below, each word going to be printed on the new line:");
  while ((character = getchar()) != EOF) {
    if (iswordsplitter(character) &&
        !isduplicate(character, previous_character)) {
      putchar('\n');
    } else if (!iswordsplitter(character)) {
      putchar(character);
    }
    previous_character = character;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e6c(%rip),%rcx
cmp    (%rcx),%eax
je     11e3 <main+0x93>
mov    -0x8(%rbp),%edi
call   1060 <iswordsplitter@plt>
cmp    $0x0,%rax
je     11b9 <main+0x69>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <isduplicate@plt>
cmp    $0x0,%eax
jne    11b9 <main+0x69>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11d8 <main+0x88>
mov    -0x8(%rbp),%edi
call   1060 <iswordsplitter@plt>
cmp    $0x0,%rax
jne    11d3 <main+0x83>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11d8 <main+0x88>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    116b <main+0x1b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e7a(%rip),%r14
cmp    (%r14),%eax
jne    117a <main+0x2a>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
jmp    1198 <main+0x48>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebx,%ebp
cmp    (%r14),%eax
je     1173 <main+0x23>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <iswordsplitter@plt>
test   %rax,%rax
je     11b3 <main+0x63>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <isduplicate@plt>
test   %eax,%eax
je     1180 <main+0x30>
mov    %ebx,%edi
call   1060 <iswordsplitter@plt>
mov    %ebx,%edi
test   %rax,%rax
jne    118a <main+0x3a>
jmp    1185 <main+0x35>

LLVM IR (-O0):
@.str = [65 x i8] c"Input text below, each word going to be printed on the new line:\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %28, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %30
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i64 @iswordsplitter(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @isduplicate(i32 %14, i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = call i32 @putchar(i32 10)
br label %28
20: ; preds = %13, %9
%21 = load i32, i32* %2
%22 = call i64 @iswordsplitter(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = load i32, i32* %2
%26 = call i32 @putchar(i32 %25)
br label %27
27: ; preds = %24, %20
br label %28
28: ; preds = %27, %18
%29 = load i32, i32* %2
store i32 %29, i32* %3
br label %5
30: ; preds = %5
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [65 x i8] c"Input text below, each word going to be printed on the new line:\00"
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %23, label %5
5: ; preds = %0, %19
%6 = phi i32 [ %20, %19 ], [ %2, %0 ]
%7 = phi i32 [ %6, %19 ], [ undef, %0 ]
%8 = tail call i64 @iswordsplitter(i32 %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = tail call i32 @isduplicate(i32 %6, i32 %7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10, %5
%14 = tail call i64 @iswordsplitter(i32 %6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13, %10
%17 = phi i32 [ 10, %10 ], [ %6, %13 ]
%18 = tail call i32 @putchar(i32 %17)
br label %19
19: ; preds = %16, %13
%20 = tail call i32 (...) @getchar()
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %5
23: ; preds = %19, %0
ret i32 0
}