#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 */
char getchar();
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(int argc, const char **argv) {
  char c;
  while (1) {
    printf(">>> ");
    while ((c = getchar()) != '\n') {
      if (isspace(c)) {
        putchar('\n');
      } else {
        putchar(c);
      }
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11a8 <main+0x68>
movsbl -0x11(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     119a <main+0x5a>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11a3 <main+0x63>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
jmp    1162 <main+0x22>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1156 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%r14
mov    $0xa,%ebx
jmp    116a <main+0x2a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     1160 <main+0x20>
movsbl %al,%ebp
mov    %ebp,%edi
call   1050 <isspace@plt>
test   %rax,%rax
movzbl %bpl,%eax
cmovne %ebx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x40>

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

LLVM IR (-O2):
@.str = [5 x i8] c">>> \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %15, %2
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call signext i8 (...) @getchar()
%6 = icmp eq i8 %5, 10
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi i8 [ %13, %7 ], [ %5, %3 ]
%9 = tail call i64 @isspace(i8 signext %8)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8 %8, i8 10
%12 = tail call i32 @putchar(i8 signext %11)
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = tail call i32 @putchar(i8 signext 10)
br label %3
}