#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(int argc, const char **argv) {
  int count = 0;
  char c = 0;
  while (1) {
    count = 0;
    printf(">>> ");
    while ((c = getchar()) != '\n') {
      if (c == ' ') {
        for (int i = 0; i < 20 - count; ++i) {
          putchar(' ');
        }
      }
      putchar(c);
      count = (count + 1) % 20;
    }
    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)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11dd <main+0xad>
movsbl -0x15(%rbp),%eax
cmp    $0x20,%eax
jne    11be <main+0x8e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x14,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    11b9 <main+0x89>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118e <main+0x5e>
jmp    11be <main+0x8e>
movsbl -0x15(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
jmp    1164 <main+0x34>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1151 <main+0x21>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%r14
mov    $0x1,%r15d
jmp    115a <main+0x2a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %ebp,%ebp
jmp    11a1 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
cmp    $0xa,%r12b
je     1150 <main+0x20>
movsbl %r12b,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
movslq %ebp,%rbp
imul   $0x66666667,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r12d
cmp    $0x20,%al
jne    1170 <main+0x40>
mov    $0x14,%ebx
sub    %ebp,%ebx
cmp    $0x2,%ebx
cmovl  %r15d,%ebx
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11c0 <main+0x90>
jmp    1176 <main+0x46>

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 i32
%7 = alloca i8
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8 0, i8* %7
br label %9
9: ; preds = %2, %37
store i32 0, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %31, %9
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %7
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %37
15: ; preds = %11
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %31
19: ; preds = %15
store i32 0, i32* %8
br label %20
20: ; preds = %27, %19
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = sub nsw i32 20, %22
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = call i32 @putchar(i8 signext 32)
br label %27
27: ; preds = %25
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %20
30: ; preds = %20
br label %31
31: ; preds = %30, %15
%32 = load i8, i8* %7
%33 = call i32 @putchar(i8 signext %32)
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
%36 = srem i32 %35, 20
store i32 %36, i32* %6
br label %11
37: ; preds = %11
%38 = call i32 @putchar(i8 signext 10)
br label %9
}

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