#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 column, c, spaces;
  spaces = column = 0;
  while ((c = getchar()) != EOF) {
    column++;
    if (c == ' ') {
      spaces++;
      if (column % 8 == 0 && spaces > 0) {
        putchar('\t');
        spaces = 0;
      }
    } else {
      while (spaces > 0) {
        putchar(' ');
        spaces--;
      }
      if (c == '\n') {
        column = 0;
        spaces = 0;
      }
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11f2 <main+0xd2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x20,-0xc(%rbp)
jne    11a6 <main+0x86>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a1 <main+0x81>
cmpl   $0x0,-0x10(%rbp)
jle    11a1 <main+0x81>
mov    $0x9,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x10(%rbp)
jmp    11ed <main+0xcd>
jmp    11ab <main+0x8b>
cmpl   $0x0,-0x10(%rbp)
jle    11cd <main+0xad>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11ab <main+0x8b>
cmpl   $0xa,-0xc(%rbp)
jne    11e5 <main+0xc5>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%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    %ebp,%ebp
xor    %r12d,%r12d
jmp    1186 <main+0x66>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%ebx
cmove  %r14d,%r12d
cmove  %r14d,%ebp
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    %ebp,%r13d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %r13d,%ebp
cmp    (%r15),%eax
je     1141 <main+0x21>
add    $0x1,%r12d
cmp    $0x20,%ebx
jne    11b0 <main+0x90>
lea    0x1(%rbp),%r13d
test   $0x7,%r12b
jne    1175 <main+0x55>
test   %ebp,%ebp
js     1175 <main+0x55>
xor    %ebp,%ebp
mov    $0x9,%ebx
jmp    116b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    1160 <main+0x40>
add    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11c0 <main+0xa0>
xor    %ebp,%ebp
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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %4
br label %5
5: ; preds = %41, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %42
9: ; preds = %5
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = srem i32 %17, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @putchar(i32 9)
store i32 0, i32* %4
br label %25
25: ; preds = %23, %20, %14
br label %41
26: ; preds = %9
br label %27
27: ; preds = %30, %26
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = call i32 @putchar(i32 32)
%32 = load i32, i32* %4
%33 = add nsw i32 %32, -1
store i32 %33, i32* %4
br label %27
34: ; preds = %27
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 0, i32* %2
store i32 0, i32* %4
br label %38
38: ; preds = %37, %34
%39 = load i32, i32* %3
%40 = call i32 @putchar(i32 %39)
br label %41
41: ; preds = %38, %25
br label %5
42: ; 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 %39, label %4
4: ; preds = %0, %33
%5 = phi i32 [ %36, %33 ], [ %1, %0 ]
%6 = phi i32 [ %35, %33 ], [ 0, %0 ]
%7 = phi i32 [ %34, %33 ], [ 0, %0 ]
%8 = add nsw i32 %7, 1
%9 = icmp eq i32 %5, 32
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = icmp sgt i32 %6, 0
br i1 %11, label %18, label %23
12: ; preds = %4
%13 = add nsw i32 %6, 1
%14 = and i32 %8, 7
%15 = icmp eq i32 %14, 0
%16 = icmp sgt i32 %6, -1
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %28, label %33
18: ; preds = %10, %18
%19 = phi i32 [ %21, %18 ], [ %6, %10 ]
%20 = tail call i32 @putchar(i32 32)
%21 = add nsw i32 %19, -1
%22 = icmp ugt i32 %19, 1
br i1 %22, label %18, label %23
23: ; preds = %18, %10
%24 = phi i32 [ %6, %10 ], [ 0, %18 ]
%25 = icmp eq i32 %5, 10
%26 = select i1 %25, i32 0, i32 %8
%27 = select i1 %25, i32 0, i32 %24
br label %28
28: ; preds = %12, %23
%29 = phi i32 [ %5, %23 ], [ 9, %12 ]
%30 = phi i32 [ %26, %23 ], [ %8, %12 ]
%31 = phi i32 [ %27, %23 ], [ 0, %12 ]
%32 = tail call i32 @putchar(i32 %29)
br label %33
33: ; preds = %28, %12
%34 = phi i32 [ %8, %12 ], [ %30, %28 ]
%35 = phi i32 [ %13, %12 ], [ %31, %28 ]
%36 = tail call i32 (...) @getchar()
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %4
39: ; preds = %33, %0
ret i32 0
}