#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 col2nts(int);
int getchar();
int /*<<< orphan*/ initabstop(int, char **);
int /*<<< orphan*/ print_char(char, int);
int /*<<< orphan*/ putchar(int);
int main(int argc, char **argv) {
  int c;
  int nc = 0;
  initabstop(argc, argv);
  while ((c = getchar()) != EOF) {
    ++nc;
    if (c == '\t') {
      int ct = col2nts(nc - 1);
      print_char('_', ct);
      nc += ct - 1;
      continue;
    }
    if (c == '\n') {
      nc = 0;
    }
    putchar(c);
  }
  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   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <initabstop@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e5e(%rip),%rcx
cmp    (%rcx),%eax
je     11ef <main+0x9f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x9,-0x14(%rbp)
jne    11d1 <main+0x81>
mov    -0x18(%rbp),%edi
sub    $0x1,%edi
call   1060 <col2nts@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x5f,%edi
call   1070 <print_char@plt>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1179 <main+0x29>
cmpl   $0xa,-0x14(%rbp)
jne    11e2 <main+0x92>
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1179 <main+0x29>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
call   1040 <initabstop@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e7b(%rip),%r15
cmp    (%r15),%eax
jne    117f <main+0x2f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    11b3 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1060 <col2nts@plt>
mov    %eax,%ebp
mov    $0x5f,%edi
mov    %eax,%esi
call   1070 <print_char@plt>
add    %ebp,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%eax
je     1172 <main+0x22>
cmp    $0x9,%eax
je     1190 <main+0x40>
add    $0x1,%ebx
cmp    $0xa,%eax
cmove  %r14d,%ebx
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11a7 <main+0x57>

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
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @initabstop(i32 %9, i8** %10)
br label %12
12: ; preds = %35, %21, %2
%13 = call i32 (...) @getchar()
store i32 %13, i32* %6
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %38
16: ; preds = %12
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 9
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load i32, i32* %7
%23 = sub nsw i32 %22, 1
%24 = call i32 @col2nts(i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = call i32 @print_char(i8 signext 95, i32 %25)
%27 = load i32, i32* %8
%28 = sub nsw i32 %27, 1
%29 = load i32, i32* %7
%30 = add nsw i32 %29, %28
store i32 %30, i32* %7
br label %12
31: ; preds = %16
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 0, i32* %7
br label %35
35: ; preds = %34, %31
%36 = load i32, i32* %6
%37 = call i32 @putchar(i32 %36)
br label %12
38: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @initabstop(i32 %0, i8** %1)
%4 = tail call i32 (...) @getchar()
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %25, label %7
7: ; preds = %2, %15
%8 = phi i32 [ %17, %15 ], [ %4, %2 ]
%9 = phi i32 [ %16, %15 ], [ 0, %2 ]
%10 = icmp eq i32 %8, 9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = tail call i32 @col2nts(i32 %9)
%13 = tail call i32 @print_char(i8 signext 95, i32 %12)
%14 = add i32 %12, %9
br label %15
15: ; preds = %11, %20
%16 = phi i32 [ %14, %11 ], [ %23, %20 ]
%17 = tail call i32 (...) @getchar()
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %25, label %7
20: ; preds = %7
%21 = add nsw i32 %9, 1
%22 = icmp eq i32 %8, 10
%23 = select i1 %22, i32 0, i32 %21
%24 = tail call i32 @putchar(i32 %8)
br label %15
25: ; preds = %15, %2
ret i32 0
}