#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 getline(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char line[1024];
  int len;
  int tabs;
  int spaces;
  int spaces_total;
  int i;
  while ((len = getline(line, 1024)) > 0) {
    i = 0;
    while (i < len) {
      if (line[i] == ' ') {
        spaces_total = 0;
        while (line[i++] == ' ')
          ++spaces_total;
        --i;
        tabs = spaces_total / 4;
        spaces = spaces_total % 4;
        while (tabs-- > 0)
          printf("\\t");
        while (spaces-- > 0)
          putchar('_');
      } else
        putchar(line[i++]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
mov    %eax,-0x414(%rbp)
cmp    $0x0,%eax
jle    1297 <main+0x167>
movl   $0x0,-0x424(%rbp)
mov    -0x424(%rbp),%eax
cmp    -0x414(%rbp),%eax
jge    1292 <main+0x162>
movslq -0x424(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    126d <main+0x13d>
movl   $0x0,-0x420(%rbp)
mov    -0x424(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x424(%rbp)
cltq
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    11d8 <main+0xa8>
mov    -0x420(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x420(%rbp)
jmp    11a0 <main+0x70>
mov    -0x424(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x424(%rbp)
mov    -0x420(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x418(%rbp)
mov    -0x420(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x41c(%rbp)
mov    -0x418(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x418(%rbp)
cmp    $0x0,%eax
jle    123a <main+0x10a>
lea    0xdd0(%rip),%rdi
call   1040 <printf@plt>
jmp    120f <main+0xdf>
jmp    123f <main+0x10f>
mov    -0x41c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x41c(%rbp)
cmp    $0x0,%eax
jle    1268 <main+0x138>
mov    $0x5f,%edi
call   1030 <putchar@plt>
jmp    123f <main+0x10f>
jmp    128d <main+0x15d>
mov    -0x424(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x424(%rbp)
cltq
movsbl -0x410(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
jmp    116c <main+0x3c>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    1237 <main+0x107>
mov    %eax,%r12d
lea    0xea0(%rip),%r13
jmp    1188 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rsp,%rdi
mov    $0x400,%esi
call   1050 <getline@plt>
mov    %eax,%r12d
test   %eax,%eax
jle    1237 <main+0x107>
xor    %ebp,%ebp
jmp    11a0 <main+0x70>
nopl   0x0(%rax)
add    $0x1,%ebp
movsbl %cl,%edi
call   1030 <putchar@plt>
cmp    %r12d,%ebp
jge    1170 <main+0x40>
movslq %ebp,%rax
mov    (%rsp,%rax,1),%cl
cmp    $0x20,%cl
jne    1190 <main+0x60>
lea    0x1(%rsp),%rcx
add    %rcx,%rax
mov    $0x1,%ecx
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %ecx,%ebx
cmpb   $0x20,(%rax,%r14,1)
lea    0x1(%r14),%r14
lea    0x1(%rbx),%ecx
je     11c0 <main+0x90>
lea    -0x1(%r14),%eax
cmp    $0x3,%eax
jb     1202 <main+0xd2>
mov    %ebx,%r15d
shr    $0x2,%r15d
add    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%r15d
cmp    $0x1,%r15d
ja     11f0 <main+0xc0>
mov    %ebp,%ebp
add    %r14,%rbp
test   $0x3,%r14b
je     119b <main+0x6b>
and    $0x3,%ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x5f,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
jg     1220 <main+0xf0>
jmp    119b <main+0x6b>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\t\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %65, %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @getline(i8* %9, i32 1024)
store i32 %10, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %66
12: ; preds = %8
store i32 0, i32* %7
br label %13
13: ; preds = %64, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %65
17: ; preds = %13
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 32
br i1 %23, label %24, label %57
24: ; preds = %17
store i32 0, i32* %6
br label %25
25: ; preds = %33, %24
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
%28 = sext i32 %26 to i64
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 32
br i1 %32, label %33, label %36
33: ; preds = %25
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %25
36: ; preds = %25
%37 = load i32, i32* %7
%38 = add nsw i32 %37, -1
store i32 %38, i32* %7
%39 = load i32, i32* %6
%40 = sdiv i32 %39, 4
store i32 %40, i32* %4
%41 = load i32, i32* %6
%42 = srem i32 %41, 4
store i32 %42, i32* %5
br label %43
43: ; preds = %47, %36
%44 = load i32, i32* %4
%45 = add nsw i32 %44, -1
store i32 %45, i32* %4
%46 = icmp sgt i32 %44, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %43
49: ; preds = %43
br label %50
50: ; preds = %54, %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, -1
store i32 %52, i32* %5
%53 = icmp sgt i32 %51, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @putchar(i8 signext 95)
br label %50
56: ; preds = %50
br label %64
57: ; preds = %17
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = call i32 @putchar(i8 signext %62)
br label %64
64: ; preds = %57, %56
br label %13
65: ; preds = %13
br label %8
66: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\t\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2, i32 1024)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %8, label %48
5: ; preds = %45
%6 = call i32 @getline(i8* %2, i32 1024)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %48
8: ; preds = %0, %5
%9 = phi i32 [ %6, %5 ], [ %3, %0 ]
br label %10
10: ; preds = %8, %45
%11 = phi i32 [ %46, %45 ], [ 0, %8 ]
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
br i1 %15, label %16, label %42
16: ; preds = %10, %16
%17 = phi i64 [ %19, %16 ], [ %12, %10 ]
%18 = phi i32 [ %20, %16 ], [ 0, %10 ]
%19 = add i64 %17, 1
%20 = add nuw nsw i32 %18, 1
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %19
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 32
br i1 %23, label %16, label %24
24: ; preds = %16
%25 = trunc i64 %19 to i32
%26 = and i32 %20, 3
%27 = icmp ult i32 %18, 3
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = lshr i32 %20, 2
br label %32
30: ; preds = %32, %24
%31 = icmp eq i32 %26, 0
br i1 %31, label %45, label %37
32: ; preds = %28, %32
%33 = phi i32 [ %34, %32 ], [ %29, %28 ]
%34 = add nsw i32 %33, -1
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%36 = icmp ugt i32 %33, 1
br i1 %36, label %32, label %30
37: ; preds = %30, %37
%38 = phi i32 [ %39, %37 ], [ %26, %30 ]
%39 = add nsw i32 %38, -1
%40 = call i32 @putchar(i8 signext 95)
%41 = icmp sgt i32 %38, 1
br i1 %41, label %37, label %45
42: ; preds = %10
%43 = add nsw i32 %11, 1
%44 = call i32 @putchar(i8 signext %14)
br label %45
45: ; preds = %37, %30, %42
%46 = phi i32 [ %43, %42 ], [ %25, %30 ], [ %25, %37 ]
%47 = icmp slt i32 %46, %9
br i1 %47, label %10, label %5
48: ; preds = %5, %0
ret i32 0
}