#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*/ putchar(int);
int main(void) {
  int i, c;
  int space_count = 0;
  int col_count = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      space_count++;
      if (space_count >= (8 - (col_count % 8))) {
        putchar('\t');
        space_count = space_count - (8 - (col_count % 8));
        col_count = col_count + (8 - col_count % 8);
      }
    } else {
      if (space_count > 0) {
        for (i = 0; i < space_count; i++) {
          putchar(' ');
          col_count++;
        }
        space_count = 0;
      }
      putchar(c);
      col_count++;
      if (c == '\n')
        col_count = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     124c <main+0x12c>
cmpl   $0x20,-0xc(%rbp)
jne    11db <main+0xbb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jl     11d6 <main+0xb6>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1247 <main+0x127>
cmpl   $0x0,-0x10(%rbp)
jle    1220 <main+0x100>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1219 <main+0xf9>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ec <main+0xcc>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1242 <main+0x122>
movl   $0x0,-0x14(%rbp)
jmp    1247 <main+0x127>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eac(%rip),%r15
cmp    (%r15),%eax
jne    1152 <main+0x32>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1186 <main+0x66>
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    $0xa,%ebx
cmove  %r14d,%r12d
mov    %r13d,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %ebp,%r13d
cmp    (%r15),%eax
je     1141 <main+0x21>
cmp    $0x20,%ebx
jne    11c0 <main+0xa0>
add    $0x1,%r13d
lea    0x7(%r12),%ebx
test   %r12d,%r12d
cmovns %r12d,%ebx
and    $0xfffffff8,%ebx
sub    %r12d,%ebx
add    $0x8,%ebx
mov    %r13d,%ebp
sub    %ebx,%ebp
jl     1172 <main+0x52>
mov    $0x9,%edi
call   1030 <putchar@plt>
add    %r12d,%ebx
mov    %ebx,%r12d
jmp    1175 <main+0x55>
nopl   (%rax)
test   %r13d,%r13d
jle    1160 <main+0x40>
mov    %r13d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0xb0>
add    %r12d,%r13d
mov    %r13d,%r12d
xor    %r13d,%r13d
jmp    1160 <main+0x40>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %59, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %3
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %60
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = srem i32 %17, 8
%19 = sub nsw i32 8, %18
%20 = icmp sge i32 %16, %19
br i1 %20, label %21, label %33
21: ; preds = %13
%22 = call i32 @putchar(i32 9)
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = srem i32 %24, 8
%26 = sub nsw i32 8, %25
%27 = sub nsw i32 %23, %26
store i32 %27, i32* %4
%28 = load i32, i32* %5
%29 = load i32, i32* %5
%30 = srem i32 %29, 8
%31 = sub nsw i32 8, %30
%32 = add nsw i32 %28, %31
store i32 %32, i32* %5
br label %33
33: ; preds = %21, %13
br label %59
34: ; preds = %10
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %50
37: ; preds = %34
store i32 0, i32* %2
br label %38
38: ; preds = %46, %37
%39 = load i32, i32* %2
%40 = load i32, i32* %4
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %49
42: ; preds = %38
%43 = call i32 @putchar(i32 32)
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %46
46: ; preds = %42
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %38
49: ; preds = %38
store i32 0, i32* %4
br label %50
50: ; preds = %49, %34
%51 = load i32, i32* %3
%52 = call i32 @putchar(i32 %51)
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
%55 = load i32, i32* %3
%56 = icmp eq i32 %55, 10
br i1 %56, label %57, label %58
57: ; preds = %50
store i32 0, i32* %5
br label %58
58: ; preds = %57, %50
br label %59
59: ; preds = %58, %33
br label %6
60: ; preds = %6
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 %40, label %4
4: ; preds = %0, %34
%5 = phi i32 [ %37, %34 ], [ %1, %0 ]
%6 = phi i32 [ %36, %34 ], [ 0, %0 ]
%7 = phi i32 [ %35, %34 ], [ 0, %0 ]
%8 = icmp eq i32 %5, 32
br i1 %8, label %9, label %18
9: ; preds = %4
%10 = add nsw i32 %7, 1
%11 = srem i32 %6, 8
%12 = sub nsw i32 8, %11
%13 = icmp slt i32 %10, %12
br i1 %13, label %34, label %14
14: ; preds = %9
%15 = tail call i32 @putchar(i32 9)
%16 = sub nsw i32 %10, %12
%17 = add nsw i32 %12, %6
br label %34
18: ; preds = %4
%19 = icmp sgt i32 %7, 0
br i1 %19, label %20, label %27
20: ; preds = %18, %20
%21 = phi i32 [ %23, %20 ], [ 0, %18 ]
%22 = tail call i32 @putchar(i32 32)
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %23, %7
br i1 %24, label %25, label %20
25: ; preds = %20
%26 = add i32 %7, %6
br label %27
27: ; preds = %25, %18
%28 = phi i32 [ %7, %18 ], [ 0, %25 ]
%29 = phi i32 [ %6, %18 ], [ %26, %25 ]
%30 = tail call i32 @putchar(i32 %5)
%31 = add nsw i32 %29, 1
%32 = icmp eq i32 %5, 10
%33 = select i1 %32, i32 0, i32 %31
br label %34
34: ; preds = %9, %14, %27
%35 = phi i32 [ %16, %14 ], [ %10, %9 ], [ %28, %27 ]
%36 = phi i32 [ %17, %14 ], [ %6, %9 ], [ %33, %27 ]
%37 = tail call i32 (...) @getchar()
%38 = load i32, i32* @EOF
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %4
40: ; preds = %34, %0
ret i32 0
}