#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char s[1001];
  scanf("%[^\n]%*c", s);
  for (int i = 0; i < strlen(s); i++) {
    if (s[i] == ' ')
      printf("\n");
    else
      printf("%c", s[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
mov    %eax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3f8(%rbp),%eax
cmp    %ecx,%eax
jge    11e8 <main+0xb8>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    11b2 <main+0x82>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11cf <main+0x9f>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%esi
ff
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d4 <main+0xa4>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    115f <main+0x2f>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x3f0,%rsp
lea    0xebe(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1194 <main+0x64>
xor    %ebx,%ebx
mov    $0xa,%ebp
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsp,%rbx,1),%eax
cmp    $0x20,%al
cmove  %ebp,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%[^\0A]%*c\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %28, %0
%7 = load i32, i32* %3
%8 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %31
11: ; preds = %6
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 32
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
20: ; preds = %11
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20, %18
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %6
31: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%[^\0A]%*c\00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %7, %0
ret i32 0
7: ; preds = %0, %7
%8 = phi i64 [ %15, %7 ], [ 0, %0 ]
%9 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 32
%12 = select i1 %11, i8 10, i8 %10
%13 = sext i8 %12 to i32
%14 = call i32 @putchar(i32 %13)
%15 = add nuw nsw i64 %8, 1
%16 = call i32 @strlen(i8* %2)
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %7, label %6
}