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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11c0 <main+0xa0>
cmpl   $0xa,-0x8(%rbp)
jne    1160 <main+0x40>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0x8(%rbp)
jne    11a5 <main+0x85>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11a0 <main+0x80>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x54>
jmp    11ad <main+0x8d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11b2 <main+0x92>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%rbx
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1139 <main+0x19>
cmp    $0xa,%eax
cmove  %r14d,%ebp
cmp    $0x9,%eax
jne    1150 <main+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
je     1157 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
test   $0x7,%bpl
jne    1190 <main+0x70>
jmp    1157 <main+0x37>

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