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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11c2 <main+0xa2>
cmpl   $0x9,-0x8(%rbp)
jne    118c <main+0x6c>
jmp    115e <main+0x3e>
cmpl   $0x0,-0xc(%rbp)
jle    1180 <main+0x60>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x3e>
movl   $0x8,-0xc(%rbp)
jmp    11bd <main+0x9d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
je     11b1 <main+0x91>
cmpl   $0x0,-0xc(%rbp)
jne    11b8 <main+0x98>
movl   $0x8,-0xc(%rbp)
jmp    11bd <main+0x9d>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb2(%rip),%r14
cmp    (%r14),%eax
jne    1146 <main+0x26>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    $0x8,%r15d
mov    $0x8,%ebp
jmp    1189 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmove  %r15d,%ebp
cmp    $0xa,%ebx
cmove  %r15d,%ebp
mov    %ebp,%r12d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %r12d,%ebp
cmp    (%r14),%eax
je     113b <main+0x1b>
cmp    $0x9,%ebx
jne    1160 <main+0x40>
mov    $0x8,%r12d
test   %ebp,%ebp
jle    1178 <main+0x58>
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11a0 <main+0x80>
jmp    1178 <main+0x58>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %3
br label %4
4: ; preds = %32, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %33
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 9
br i1 %10, label %11, label %20
11: ; preds = %8
br label %12
12: ; preds = %15, %11
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = call i32 @putchar(i32 32)
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %12
19: ; preds = %12
store i32 8, i32* %3
br label %32
20: ; preds = %8
%21 = load i32, i32* %2
%22 = call i32 @putchar(i32 %21)
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 10
br i1 %26, label %30, label %27
27: ; preds = %20
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27, %20
store i32 8, i32* %3
br label %31
31: ; preds = %30, %27
br label %32
32: ; preds = %31, %19
br label %4
33: ; preds = %4
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 %27, label %4
4: ; preds = %0, %22
%5 = phi i32 [ %24, %22 ], [ %1, %0 ]
%6 = phi i32 [ %23, %22 ], [ 8, %0 ]
%7 = icmp eq i32 %5, 9
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = icmp sgt i32 %6, 0
br i1 %9, label %10, label %22
10: ; preds = %8, %10
%11 = phi i32 [ %13, %10 ], [ %6, %8 ]
%12 = tail call i32 @putchar(i32 32)
%13 = add nsw i32 %11, -1
%14 = icmp ugt i32 %11, 1
br i1 %14, label %10, label %22
15: ; preds = %4
%16 = tail call i32 @putchar(i32 %5)
%17 = add nsw i32 %6, -1
%18 = icmp eq i32 %5, 10
%19 = icmp eq i32 %17, 0
%20 = select i1 %18, i1 true, i1 %19
%21 = select i1 %20, i32 8, i32 %17
br label %22
22: ; preds = %10, %8, %15
%23 = phi i32 [ %21, %15 ], [ 8, %8 ], [ 8, %10 ]
%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
}