#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 rep_tab(int);
int main() {
  int c, i;
  i = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      i = 0;
      putchar(c);
    } else if (c == '\t') {
      int sps = rep_tab(i);
      int j;
      for (j = 0; j < sps; ++j) {
        putchar(' ');
        ++i;
      }
    } else {
      putchar(c);
      ++i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     11e6 <main+0xb6>
cmpl   $0xa,-0x8(%rbp)
jne    117d <main+0x4d>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e1 <main+0xb1>
cmpl   $0x9,-0x8(%rbp)
jne    11cb <main+0x9b>
mov    -0xc(%rbp),%edi
call   1050 <rep_tab@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c6 <main+0x96>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1199 <main+0x69>
jmp    11dc <main+0xac>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e1 <main+0xb1>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea3(%rip),%r14
cmp    (%r14),%eax
jne    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
jmp    1177 <main+0x47>
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     114a <main+0x1a>
cmp    $0x9,%eax
je     1190 <main+0x60>
cmp    $0xa,%eax
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
jmp    116b <main+0x3b>
mov    %r15d,%edi
call   1050 <rep_tab@plt>
test   %eax,%eax
jle    116b <main+0x3b>
mov    %eax,%ebx
mov    %eax,%ebp
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
add    %ebx,%r15d
jmp    116b <main+0x3b>

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