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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11c5 <main+0xa5>
cmpl   $0x9,-0x8(%rbp)
jne    1197 <main+0x77>
mov    -0xc(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    118b <main+0x6b>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1169 <main+0x49>
movl   $0x0,-0x14(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11bb <main+0x9b>
movl   $0x0,-0x14(%rbp)
jmp    11c0 <main+0xa0>
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%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
xor    %ebx,%ebx
jmp    1171 <main+0x51>
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%r12d
cmp    $0x8,%ebx
cmovge %r14d,%r12d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r12d,%ebx
cmp    (%r15),%eax
je     113e <main+0x1e>
cmp    $0x9,%eax
jne    1150 <main+0x30>
xor    %r12d,%r12d
cmp    $0x7,%ebx
jg     1162 <main+0x42>
mov    $0x9,%ebp
sub    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1190 <main+0x70>
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
%5 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %3
store i32 0, i32* %5
br label %6
6: ; preds = %36, %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 %37
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 9
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = sub nsw i32 %14, %15
store i32 %16, i32* %4
br label %17
17: ; preds = %22, %13
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = call i32 @putchar(i32 32)
br label %22
22: ; preds = %20
%23 = load i32, i32* %4
%24 = add nsw i32 %23, -1
store i32 %24, i32* %4
br label %17
25: ; preds = %17
store i32 0, i32* %5
br label %36
26: ; preds = %10
%27 = load i32, i32* %2
%28 = call i32 @putchar(i32 %27)
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = load i32, i32* %3
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %26
store i32 0, i32* %5
br label %35
35: ; preds = %34, %26
br label %36
36: ; preds = %35, %25
br label %6
37: ; preds = %6
%38 = load i32, i32* %1
ret i32 %38
}

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 %27, label %4
4: ; preds = %0, %22
%5 = phi i32 [ %24, %22 ], [ %1, %0 ]
%6 = phi i32 [ %23, %22 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 9
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = icmp slt i32 %6, 8
br i1 %9, label %10, label %22
10: ; preds = %8
%11 = sub nsw i32 8, %6
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %15, %12 ], [ %11, %10 ]
%14 = tail call i32 @putchar(i32 32)
%15 = add nsw i32 %13, -1
%16 = icmp ugt i32 %13, 1
br i1 %16, label %12, label %22
17: ; preds = %4
%18 = tail call i32 @putchar(i32 %5)
%19 = add nsw i32 %6, 1
%20 = icmp sgt i32 %6, 7
%21 = select i1 %20, i32 0, i32 %19
br label %22
22: ; preds = %12, %8, %17
%23 = phi i32 [ %21, %17 ], [ 0, %8 ], [ 0, %12 ]
%24 = tail call i32 (...) @getchar()
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %4
27: ; preds = %22, %0
ret i32 0
}