#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*/ insert_char(char, int);
int /*<<< orphan*/ putchar(int);
int main() {
  int chr;
  int col = 0;
  char line[0x1000];
  while ((chr = getchar()) != EOF) {
    if (chr == '\n') {
      col = 0;
      putchar(chr);
    } else if (chr == '\t')
      insert_char(' ', 8 - (col % 8));
    else {
      putchar(chr);
      col++;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%eax
je     11c6 <main+0x96>
cmpl   $0xa,-0x8(%rbp)
jne    1180 <main+0x50>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11c1 <main+0x91>
cmpl   $0x9,-0x8(%rbp)
jne    11ab <main+0x7b>
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%esi
sub    %edx,%esi
mov    $0x20,%edi
call   1050 <insert_char@plt>
jmp    11bc <main+0x8c>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <main+0x91>
jmp    1149 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%eax
jne    1151 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
jmp    1176 <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     1147 <main+0x17>
cmp    $0x9,%eax
je     1190 <main+0x60>
cmp    $0xa,%eax
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    116a <main+0x3a>
xchg   %ax,%ax
lea    0x7(%rbx),%esi
test   %ebx,%ebx
cmovns %ebx,%esi
and    $0xfffffff8,%esi
sub    %ebx,%esi
add    $0x8,%esi
mov    $0x20,%edi
call   1050 <insert_char@plt>
jmp    116a <main+0x3a>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4096 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %29, %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 %30
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %15
12: ; preds = %9
store i32 0, i32* %3
%13 = load i32, i32* %2
%14 = call i32 @putchar(i32 %13)
br label %29
15: ; preds = %9
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 9
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %3
%20 = srem i32 %19, 8
%21 = sub nsw i32 8, %20
%22 = call i32 @insert_char(i8 signext 32, i32 %21)
br label %28
23: ; preds = %15
%24 = load i32, i32* %2
%25 = call i32 @putchar(i32 %24)
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %28
28: ; preds = %23, %18
br label %29
29: ; preds = %28, %12
br label %5
30: ; preds = %5
%31 = load i32, i32* %1
ret i32 %31
}

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