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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x8,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11ed <main+0xcd>
cmpl   $0xa,-0x8(%rbp)
jne    1174 <main+0x54>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11e8 <main+0xc8>
cmpl   $0x9,-0x8(%rbp)
jne    11ba <main+0x9a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11ae <main+0x8e>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x65>
movl   $0x0,-0xc(%rbp)
jmp    11e3 <main+0xc3>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11de <main+0xbe>
movl   $0x0,-0xc(%rbp)
jmp    11e3 <main+0xc3>
jmp    11e8 <main+0xc8>
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    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eac(%rip),%r12
cmp    (%r12),%eax
jne    1153 <main+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r14d
xor    %ebp,%ebp
jmp    1184 <main+0x64>
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
cmove  %r15d,%ebp
mov    %ebp,%r13d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r13d,%ebp
cmp    (%r12),%eax
je     1142 <main+0x22>
cmp    $0xa,%eax
je     11d0 <main+0xb0>
cmp    $0x9,%eax
jne    1160 <main+0x40>
xor    %r13d,%r13d
cmp    $0x7,%ebp
jg     1174 <main+0x54>
mov    $0x8,%ebx
sub    %ebp,%ebx
cmp    $0x2,%ebx
cmovl  %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x90>
jmp    1174 <main+0x54>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r13d,%r13d
jmp    1174 <main+0x54>

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