#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();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main() {
  char i, ch[100], c;
  int len = 0;
  printf("Enter The String: (Eg: WORD PROCESSING): \n");
  while ((c = getchar()) != '\n')
    ch[len++] = c;
  for (i = 0; i < len; i++)
    putchar(ch[i]);
  printf("\n");
  for (i = 0; i < len; i++)
    if (ch[i] == ' ')
      printf("\n");
    else
      putchar(ch[i]);
  printf("\n%c.", ch[0]);
  for (i = 0; i < len - 1; i++) {
    if (ch[i] == ' ')
      printf("%c.", ch[i + 1]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x78(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x71(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1186 <main+0x56>
mov    -0x71(%rbp),%cl
mov    -0x78(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x78(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
jmp    1157 <main+0x27>
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    11b3 <main+0x83>
movsbq -0x5(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    118a <main+0x5a>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    1219 <main+0xe9>
movsbq -0x5(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    11f8 <main+0xc8>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1207 <main+0xd7>
movsbq -0x5(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
jmp    120c <main+0xdc>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    11c5 <main+0x95>
movsbl -0x70(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1282 <main+0x152>
movsbq -0x5(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    1270 <main+0x140>
movsbl -0x5(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1275 <main+0x145>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    122f <main+0xff>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     11e7 <main+0xa7>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1170 <main+0x30>
test   %ebx,%ebx
jle    11e7 <main+0xa7>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbq %bpl,%rbp
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%bpl
movsbl %bpl,%eax
cmp    %eax,%ebx
jg     1190 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    11f1 <main+0xb1>
xor    %ebp,%ebp
jmp    11d4 <main+0x94>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%bpl
movsbl %bpl,%eax
cmp    %eax,%ebx
jle    11f1 <main+0xb1>
movsbq %bpl,%rax
movzbl (%rsp,%rax,1),%eax
cmp    $0x20,%al
jne    11c0 <main+0x80>
mov    $0xa,%edi
jmp    11c3 <main+0x83>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%r12b
movsbl %r12b,%esi
lea    0xe00(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%ebx
jl     125f <main+0x11f>
add    $0xffffffff,%ebx
mov    %rsp,%r15
lea    0xde8(%rip),%r14
xor    %ebp,%ebp
cmp    $0x20,%r12b
jne    1243 <main+0x103>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %ebp,%rax
movsbl 0x1(%rax,%r15,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%bpl
movsbl %bpl,%ebp
cmp    %ebp,%ebx
jle    125f <main+0x11f>
movslq %ebp,%rax
movzbl (%rsp,%rax,1),%r12d
cmp    $0x20,%r12b
je     1230 <main+0xf0>
jmp    1243 <main+0x103>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Enter The String: (Eg: WORD PROCESSING): \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c"\0A%c.\00"
@.str.3 = [4 x i8] c"%c.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [100 x i8]
%4 = alloca i8
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %11, %0
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8, i8* %4
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %15
store i8 %12, i8* %16
br label %7
17: ; preds = %7
store i8 0, i8* %2
br label %18
18: ; preds = %29, %17
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = load i8, i8* %2
%25 = sext i8 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @putchar(i8 signext %27)
br label %29
29: ; preds = %23
%30 = load i8, i8* %2
%31 = add i8 %30, 1
store i8 %31, i8* %2
br label %18
32: ; preds = %18
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8 0, i8* %2
br label %34
34: ; preds = %55, %32
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %58
39: ; preds = %34
%40 = load i8, i8* %2
%41 = sext i8 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 32
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %54
48: ; preds = %39
%49 = load i8, i8* %2
%50 = sext i8 %49 to i64
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = call i32 @putchar(i8 signext %52)
br label %54
54: ; preds = %48, %46
br label %55
55: ; preds = %54
%56 = load i8, i8* %2
%57 = add i8 %56, 1
store i8 %57, i8* %2
br label %34
58: ; preds = %34
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %61)
store i8 0, i8* %2
br label %63
63: ; preds = %86, %58
%64 = load i8, i8* %2
%65 = sext i8 %64 to i32
%66 = load i32, i32* %5
%67 = sub nsw i32 %66, 1
%68 = icmp slt i32 %65, %67
br i1 %68, label %69, label %89
69: ; preds = %63
%70 = load i8, i8* %2
%71 = sext i8 %70 to i64
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 32
br i1 %75, label %76, label %85
76: ; preds = %69
%77 = load i8, i8* %2
%78 = sext i8 %77 to i32
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %76, %69
br label %86
86: ; preds = %85
%87 = load i8, i8* %2
%88 = add i8 %87, 1
store i8 %88, i8* %2
br label %63
89: ; preds = %63
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"\0A%c.\00"
@.str.3 = [4 x i8] c"%c.\00"
@str = [42 x i8] c"Enter The String: (Eg: WORD PROCESSING): \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %25, label %9
6: ; preds = %9
%7 = trunc i64 %12 to i32
%8 = icmp sgt i32 %7, 0
br i1 %8, label %16, label %25
9: ; preds = %0, %9
%10 = phi i64 [ %12, %9 ], [ 0, %0 ]
%11 = phi i8 [ %14, %9 ], [ %4, %0 ]
%12 = add nuw i64 %10, 1
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %10
store i8 %11, i8* %13
%14 = tail call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 10
br i1 %15, label %6, label %9
16: ; preds = %6, %16
%17 = phi i8 [ %22, %16 ], [ 0, %6 ]
%18 = sext i8 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = tail call i32 @putchar(i8 signext %20)
%22 = add i8 %17, 1
%23 = sext i8 %22 to i32
%24 = icmp sgt i32 %7, %23
br i1 %24, label %16, label %28
25: ; preds = %6, %0
%26 = phi i32 [ %7, %6 ], [ 0, %0 ]
%27 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %44
28: ; preds = %16
%29 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br i1 %8, label %30, label %44
30: ; preds = %28, %40
%31 = phi i8 [ %41, %40 ], [ 0, %28 ]
%32 = sext i8 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 32
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %40
38: ; preds = %30
%39 = tail call i32 @putchar(i8 signext %34)
br label %40
40: ; preds = %36, %38
%41 = add i8 %31, 1
%42 = sext i8 %41 to i32
%43 = icmp sgt i32 %7, %42
br i1 %43, label %30, label %44
44: ; preds = %40, %25, %28
%45 = phi i32 [ %26, %25 ], [ %7, %28 ], [ %7, %40 ]
%46 = load i8, i8* %2
%47 = sext i8 %46 to i32
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = add nsw i32 %45, -1
%50 = icmp sgt i32 %45, 1
br i1 %50, label %51, label %71
51: ; preds = %44, %67
%52 = phi i8 [ %70, %67 ], [ %46, %44 ]
%53 = phi i32 [ %65, %67 ], [ 0, %44 ]
%54 = trunc i32 %53 to i8
%55 = icmp eq i8 %52, 32
br i1 %55, label %56, label %63
56: ; preds = %51
%57 = add nsw i32 %53, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %51, %56
%64 = add i8 %54, 1
%65 = sext i8 %64 to i32
%66 = icmp sgt i32 %49, %65
br i1 %66, label %67, label %71
67: ; preds = %63
%68 = sext i8 %64 to i64
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %68
%70 = load i8, i8* %69
br label %51
71: ; preds = %63, %44
%72 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret i32 0
}