#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 i;
  int c, col, spaces;
  col = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      spaces = 8 - (col % 8);
      for (i = 0; i < spaces; ++i)
        putchar(' ');
      col = col + spaces;
    } else {
      putchar(c);
      ++col;
      if (c == '\n')
        col = 0;
    }
  }
  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     11d3 <main+0xb3>
cmpl   $0x9,-0xc(%rbp)
jne    11a7 <main+0x87>
mov    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%eax
sub    %edx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1199 <main+0x79>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x55>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11ce <main+0xae>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    11c9 <main+0xa9>
movl   $0x0,-0x10(%rbp)
jmp    11ce <main+0xae>
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
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %39, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %3
%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* %3
%12 = icmp eq i32 %11, 9
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32, i32* %4
%15 = srem i32 %14, 8
%16 = sub nsw i32 8, %15
store i32 %16, i32* %5
store i32 0, i32* %2
br label %17
17: ; preds = %23, %13
%18 = load i32, i32* %2
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 @putchar(i32 32)
br label %23
23: ; preds = %21
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %17
26: ; preds = %17
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = add nsw i32 %27, %28
store i32 %29, i32* %4
br label %39
30: ; preds = %10
%31 = load i32, i32* %3
%32 = call i32 @putchar(i32 %31)
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %30
store i32 0, i32* %4
br label %38
38: ; preds = %37, %30
br label %39
39: ; preds = %38, %26
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 %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 = add nsw i32 %6, 1
%21 = icmp eq i32 %5, 10
%22 = select i1 %21, i32 0, i32 %20
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
}