#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_blank_with_tab(int, int, int, char);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int cur_char;
  int cur_blanks_length;
  int cur_line_length;
  char tab_stop = '\t';
  cur_blanks_length = 0;
  cur_line_length = 0;
  if (argc > 1) {
    tab_stop = argv[1][0];
  }
  while ((cur_char = getchar()) != EOF) {
    if (cur_char == ' ') {
      cur_blanks_length++;
      cur_line_length++;
    } else {
      if (cur_char != '\n') {
        print_blank_with_tab(cur_line_length, cur_blanks_length, 8, tab_stop);
      } else {
        cur_line_length = 0;
      }
      putchar(cur_char);
      cur_blanks_length = 0;
    }
  }
  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)
movb   $0x9,-0x1d(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x1d(%rbp)
jmp    1174 <main+0x44>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e63(%rip),%rcx
cmp    (%rcx),%eax
je     11ec <main+0xbc>
cmpl   $0x20,-0x14(%rbp)
jne    11ae <main+0x7e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e7 <main+0xb7>
cmpl   $0xa,-0x14(%rbp)
je     11d1 <main+0xa1>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x8,%edx
movsbl -0x1d(%rbp),%ecx
call   1040 <print_blank_with_tab@plt>
jmp    11d8 <main+0xa8>
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x18(%rbp)
jmp    1174 <main+0x44>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x9,0x7(%rsp)
cmp    $0x2,%edi
jl     114f <main+0x1f>
mov    0x8(%rsi),%rax
mov    (%rax),%al
mov    %al,0x7(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e8b(%rip),%r12
cmp    (%r12),%eax
jne    1174 <main+0x44>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    11c4 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x7(%rsp),%ecx
mov    %r15d,%edi
mov    %r14d,%esi
mov    $0x8,%edx
call   1040 <print_blank_with_tab@plt>
mov    %r15d,%ebx
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%r15d
mov    %r13d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1163 <main+0x33>
mov    $0x0,%ebx
cmp    $0xa,%ebp
je     11a8 <main+0x78>
cmp    $0x20,%ebp
jne    1190 <main+0x60>
add    $0x1,%r14d
add    $0x1,%r15d
jmp    11b5 <main+0x85>

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
br label %8
8: ; preds = %4, %2
%9 = phi i8 [ %7, %4 ], [ 9, %2 ]
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %31, label %13
13: ; preds = %8, %25
%14 = phi i32 [ %28, %25 ], [ %10, %8 ]
%15 = phi i32 [ %27, %25 ], [ 0, %8 ]
%16 = phi i32 [ %26, %25 ], [ 0, %8 ]
switch i32 %14, label %20 [
i32 32, label %17
i32 10, label %22
]
17: ; preds = %13
%18 = add nsw i32 %16, 1
%19 = add nsw i32 %15, 1
br label %25
20: ; preds = %13
%21 = tail call i32 @print_blank_with_tab(i32 %15, i32 %16, i32 8, i8 signext %9)
br label %22
22: ; preds = %13, %20
%23 = phi i32 [ %15, %20 ], [ 0, %13 ]
%24 = tail call i32 @putchar(i32 %14)
br label %25
25: ; preds = %22, %17
%26 = phi i32 [ %18, %17 ], [ 0, %22 ]
%27 = phi i32 [ %19, %17 ], [ %23, %22 ]
%28 = tail call i32 (...) @getchar()
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %13
31: ; preds = %25, %8
ret i32 0
}