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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11da <main+0xba>
cmpl   $0x9,-0x8(%rbp)
jne    11ae <main+0x8e>
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%eax
sub    %edx,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a9 <main+0x89>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <main+0x5c>
jmp    11d5 <main+0xb5>
cmpl   $0xa,-0x8(%rbp)
jne    11c4 <main+0xa4>
movl   $0x0,-0xc(%rbp)
jmp    11cd <main+0xad>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%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
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebx,%ebx
jmp    1166 <main+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     1137 <main+0x17>
cmp    $0xa,%eax
je     11a0 <main+0x80>
cmp    $0x9,%eax
jne    1150 <main+0x30>
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
mov    %ebx,%ebp
sub    %eax,%ebp
mov    %eax,%ebx
add    $0x8,%ebx
add    $0xfffffff8,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebp
jne    1190 <main+0x70>
jmp    115a <main+0x3a>
xor    %ebx,%ebx
jmp    1153 <main+0x33>

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