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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11e1 <main+0xc1>
cmpl   $0x9,-0x8(%rbp)
jne    11a8 <main+0x88>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%eax
sub    %edx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11a3 <main+0x83>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x58>
jmp    11dc <main+0xbc>
cmpl   $0xa,-0x8(%rbp)
jne    11c6 <main+0xa6>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0x10(%rbp)
jmp    11d7 <main+0xb7>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11dc <main+0xbc>
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%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
mov    $0x1,%ebx
jmp    1166 <main+0x46>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
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    -0x1(%rbx),%eax
lea    0x6(%rbx),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    %ebx,%edx
sub    %eax,%ebx
add    $0x8,%ebx
neg    %ecx
lea    (%rdx,%rcx,1),%ebp
add    $0xfffffff7,%ebp
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebp
jne    1190 <main+0x70>
jmp    115a <main+0x3a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
jmp    115a <main+0x3a>

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

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 ], [ 1, %0 ]
switch i32 %5, label %19 [
i32 9, label %7
i32 10, label %17
]
7: ; preds = %4
%8 = add nsw i32 %6, -1
%9 = srem i32 %8, 8
%10 = add i32 %6, 8
%11 = sub i32 %10, %9
br label %12
12: ; preds = %7, %12
%13 = phi i32 [ %15, %12 ], [ %6, %7 ]
%14 = tail call i32 @putchar(i32 32)
%15 = add i32 %13, 1
%16 = icmp eq i32 %15, %11
br i1 %16, label %22, label %12
17: ; preds = %4
%18 = tail call i32 @putchar(i32 10)
br label %22
19: ; preds = %4
%20 = tail call i32 @putchar(i32 %5)
%21 = add nsw i32 %6, 1
br label %22
22: ; preds = %12, %17, %19
%23 = phi i32 [ 1, %17 ], [ %21, %19 ], [ %11, %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
}