#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*/ print_blank(int);
int /*<<< orphan*/ putchar(int);
int main(void) {
  int cur_char;
  int cur_blanks_len;
  int cur_line_len;
  cur_blanks_len = 0;
  cur_line_len = 0;
  while ((cur_char = getchar()) != EOF) {
    cur_line_len++;
    if (cur_char == '\n') {
      cur_line_len = 0;
      cur_blanks_len = 0;
      putchar(cur_char);
    } else if (cur_char == ' ') {
      cur_blanks_len++;
    } else {
      if (cur_line_len > 10) {
        putchar('\n');
        cur_blanks_len = 0;
        cur_line_len = 1;
      }
      print_blank(cur_blanks_len);
      putchar(cur_char);
      cur_blanks_len = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     11ef <main+0xbf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    1194 <main+0x64>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ea <main+0xba>
cmpl   $0x20,-0x8(%rbp)
jne    11ac <main+0x7c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e5 <main+0xb5>
cmpl   $0xa,-0x10(%rbp)
jle    11ce <main+0x9e>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <print_blank@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11ea <main+0xba>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea3(%rip),%r14
cmp    (%r14),%eax
jne    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
xor    %eax,%eax
xor    %r15d,%r15d
jmp    1174 <main+0x44>
add    $0x1,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
mov    %ebx,%eax
cmp    (%r14),%ebp
je     114a <main+0x1a>
lea    0x1(%rax),%ebx
cmp    $0x20,%ebp
je     1160 <main+0x30>
cmp    $0xa,%ebp
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    1164 <main+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0xa,%eax
jl     11b7 <main+0x87>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
xor    %r15d,%r15d
mov    %r15d,%edi
call   1040 <print_blank@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
jmp    1164 <main+0x34>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %34, %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 %35
9: ; preds = %5
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %9
store i32 0, i32* %4
store i32 0, i32* %3
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
br label %34
17: ; preds = %9
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 32
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %33
23: ; preds = %17
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 10
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @putchar(i32 10)
store i32 0, i32* %3
store i32 1, i32* %4
br label %28
28: ; preds = %26, %23
%29 = load i32, i32* %3
%30 = call i32 @print_blank(i32 %29)
%31 = load i32, i32* %2
%32 = call i32 @putchar(i32 %31)
store i32 0, i32* %3
br label %33
33: ; preds = %28, %20
br label %34
34: ; preds = %33, %14
br label %5
35: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %28, label %4
4: ; preds = %0, %22
%5 = phi i32 [ %25, %22 ], [ %1, %0 ]
%6 = phi i32 [ %24, %22 ], [ 0, %0 ]
%7 = phi i32 [ %23, %22 ], [ 0, %0 ]
%8 = add nsw i32 %6, 1
switch i32 %5, label %13 [
i32 10, label %9
i32 32, label %11
]
9: ; preds = %4
%10 = tail call i32 @putchar(i32 10)
br label %22
11: ; preds = %4
%12 = add nsw i32 %7, 1
br label %22
13: ; preds = %4
%14 = icmp sgt i32 %6, 9
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 @putchar(i32 10)
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ 0, %15 ], [ %7, %13 ]
%19 = phi i32 [ 1, %15 ], [ %8, %13 ]
%20 = tail call i32 @print_blank(i32 %18)
%21 = tail call i32 @putchar(i32 %5)
br label %22
22: ; preds = %11, %17, %9
%23 = phi i32 [ 0, %9 ], [ %12, %11 ], [ 0, %17 ]
%24 = phi i32 [ 0, %9 ], [ %8, %11 ], [ %19, %17 ]
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %4
28: ; preds = %22, %0
ret i32 0
}