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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11f1 <main+0xd1>
cmpl   $0x9,-0xc(%rbp)
jne    11c0 <main+0xa0>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    119b <main+0x7b>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x40>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    11ec <main+0xcc>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0xa,-0xc(%rbp)
jne    11de <main+0xbe>
movl   $0x0,-0x10(%rbp)
jmp    11e7 <main+0xc7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ec <main+0xcc>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eaf(%rip),%r15
cmp    (%r15),%eax
jne    1149 <main+0x29>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %r12d,%r12d
jmp    1170 <main+0x50>
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    $0xa,%ebx
cmove  %r14d,%r12d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     113e <main+0x1e>
cmp    $0x9,%ebx
jne    1150 <main+0x30>
lea    0x7(%r12),%eax
test   %r12d,%r12d
cmovns %r12d,%eax
and    $0xfffffff8,%eax
mov    %r12d,%ecx
sub    %eax,%ecx
mov    $0x8,%ebx
sub    %ecx,%ebx
neg    %eax
lea    (%r12,%rax,1),%ebp
add    $0xfffffff8,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebp
jne    11a0 <main+0x80>
add    %r12d,%ebx
mov    %ebx,%r12d
jmp    1162 <main+0x42>

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* %4
br label %5
5: ; preds = %40, %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 %41
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 9
br i1 %11, label %12, label %30
12: ; preds = %9
store i32 0, i32* %2
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = srem i32 %15, 8
%17 = sub nsw i32 8, %16
%18 = icmp slt i32 %14, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = call i32 @putchar(i32 32)
br label %21
21: ; preds = %19
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %13
24: ; preds = %13
%25 = load i32, i32* %4
%26 = load i32, i32* %4
%27 = srem i32 %26, 8
%28 = sub nsw i32 8, %27
%29 = add nsw i32 %25, %28
store i32 %29, i32* %4
br label %40
30: ; preds = %9
%31 = load i32, i32* %3
%32 = call i32 @putchar(i32 %31)
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 10
br i1 %34, label %35, label %36
35: ; preds = %30
store i32 0, i32* %4
br label %39
36: ; preds = %30
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %39
39: ; preds = %36, %35
br label %40
40: ; preds = %39, %24
br label %5
41: ; 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, %23
%5 = phi i32 [ %25, %23 ], [ %1, %0 ]
%6 = phi i32 [ %24, %23 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 9
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = srem i32 %6, 8
%10 = sub nsw i32 8, %9
br label %11
11: ; preds = %8, %11
%12 = phi i32 [ %14, %11 ], [ 0, %8 ]
%13 = tail call i32 @putchar(i32 32)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %10
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = add nsw i32 %10, %6
br label %23
18: ; preds = %4
%19 = tail call i32 @putchar(i32 %5)
%20 = icmp eq i32 %5, 10
%21 = add nsw i32 %6, 1
%22 = select i1 %20, i32 0, i32 %21
br label %23
23: ; preds = %18, %16
%24 = phi i32 [ %17, %16 ], [ %22, %18 ]
%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 = %23, %0
ret i32 0
}