#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(int argc, char **argv) {
  size_t spaces = 0;
  int c;
  while ((c = getchar()) > EOF) {
    size_t i;
    switch (c) {
    case ' ':
      spaces++;
      if (spaces == 8) {
        putchar('\t');
        spaces = 0;
      }
      break;
    default:
      for (i = 0; i < spaces; ++i)
        putchar(' ');
      spaces = 0;
      putchar(c);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
jle    11dc <main+0xbc>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
jne    1196 <main+0x76>
jmp    1168 <main+0x48>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jne    1191 <main+0x71>
mov    $0x9,%edi
call   1030 <putchar@plt>
movq   $0x0,-0x18(%rbp)
jmp    11d7 <main+0xb7>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11c7 <main+0xa7>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    119e <main+0x7e>
movq   $0x0,-0x18(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <putchar@plt>
jmp    113e <main+0x1e>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jle    1192 <main+0x72>
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    1157 <main+0x37>
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
jle    1192 <main+0x72>
cmp    $0x20,%ebp
jne    1170 <main+0x50>
add    $0x1,%rbx
cmp    $0x8,%rbx
jne    1149 <main+0x29>
mov    $0x9,%ebp
jmp    1140 <main+0x20>
nopl   (%rax)
test   %rbx,%rbx
je     1140 <main+0x20>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jne    1180 <main+0x60>
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
br label %9
9: ; preds = %36, %2
%10 = call i32 (...) @getchar()
store i32 %10, i32* %7
%11 = load i32, i32* @EOF
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i32, i32* %7
switch i32 %14, label %23 [
i32 32, label %15
]
15: ; preds = %13
%16 = load i64, i64* %6
%17 = add i64 %16, 1
store i64 %17, i64* %6
%18 = load i64, i64* %6
%19 = icmp eq i64 %18, 8
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @putchar(i32 9)
store i64 0, i64* %6
br label %22
22: ; preds = %20, %15
br label %36
23: ; preds = %13
store i64 0, i64* %8
br label %24
24: ; preds = %30, %23
%25 = load i64, i64* %8
%26 = load i64, i64* %6
%27 = icmp ult i64 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @putchar(i32 32)
br label %30
30: ; preds = %28
%31 = load i64, i64* %8
%32 = add i64 %31, 1
store i64 %32, i64* %8
br label %24
33: ; preds = %24
store i64 0, i64* %6
%34 = load i32, i32* %7
%35 = call i32 @putchar(i32 %34)
br label %36
36: ; preds = %33, %22
br label %9
37: ; preds = %9
%38 = load i32, i32* %3
ret i32 %38
}

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