#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*/ print_spaces(int);
int /*<<< orphan*/ putchar(int);
int main(int argc, char const *argv[]) {
  int c, steps_to_next_tabstop;
  steps_to_next_tabstop = 1;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      steps_to_next_tabstop = 1;
      putchar(c);
    } else {
      if (c == '\t') {
        print_spaces(steps_to_next_tabstop);
      } else {
        putchar(c);
      }
      if (steps_to_next_tabstop == 0)
        steps_to_next_tabstop = 1 - 1;
      else
        steps_to_next_tabstop -= 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     11cc <main+0x9c>
cmpl   $0xa,-0x14(%rbp)
jne    1184 <main+0x54>
movl   $0x1,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    11c7 <main+0x97>
cmpl   $0x9,-0x14(%rbp)
jne    119b <main+0x6b>
mov    -0x18(%rbp),%edi
call   1040 <print_spaces@plt>
jmp    11a3 <main+0x73>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x18(%rbp)
jne    11b9 <main+0x89>
movl   $0x0,-0x18(%rbp)
jmp    11c2 <main+0x92>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c7 <main+0x97>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%eax
jne    1151 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%ebx
jmp    1175 <main+0x45>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <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>
mov    $0x1,%ebx
jmp    1169 <main+0x39>
mov    %ebx,%edi
call   1040 <print_spaces@plt>
jmp    1167 <main+0x37>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %8
8: ; preds = %35, %2
%9 = call i32 (...) @getchar()
store i32 %9, i32* %6
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %12
store i32 1, i32* %7
%16 = load i32, i32* %6
%17 = call i32 @putchar(i32 %16)
br label %35
18: ; preds = %12
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 9
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %7
%23 = call i32 @print_spaces(i32 %22)
br label %27
24: ; preds = %18
%25 = load i32, i32* %6
%26 = call i32 @putchar(i32 %25)
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 0, i32* %7
br label %34
31: ; preds = %27
%32 = load i32, i32* %7
%33 = sub nsw i32 %32, 1
store i32 %33, i32* %7
br label %34
34: ; preds = %31, %30
br label %35
35: ; preds = %34, %15
br label %8
36: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %20, label %6
6: ; preds = %2, %15
%7 = phi i32 [ %17, %15 ], [ %3, %2 ]
%8 = phi i32 [ %16, %15 ], [ 1, %2 ]
switch i32 %7, label %13 [
i32 10, label %9
i32 9, label %11
]
9: ; preds = %6
%10 = tail call i32 @putchar(i32 10)
br label %15
11: ; preds = %6
%12 = tail call i32 @print_spaces(i32 %8)
br label %15
13: ; preds = %6
%14 = tail call i32 @putchar(i32 %7)
br label %15
15: ; preds = %11, %13, %9
%16 = phi i32 [ 1, %9 ], [ 0, %13 ], [ 0, %11 ]
%17 = tail call i32 (...) @getchar()
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %6
20: ; preds = %15, %2
ret i32 0
}