#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*/ putchar(char);
main() {
  int ts = 8;
  int i, j;
  int len;
  char line[1000];
  while ((len = getline(line, 1000)) > 0) {
    i = 0;
    while (line[i] != '\0') {
      if (line[i] == '\t')
        for (j = 0; j < ts; j++)
          putchar(' ');
      else
        putchar(line[i]);
      ++i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x8(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    11db <main+0xbb>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11d6 <main+0xb6>
movslq -0xc(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
jne    11b7 <main+0x97>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b2 <main+0x92>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118e <main+0x6e>
jmp    11c8 <main+0xa8>
movslq -0xc(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x3d>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
test   %eax,%eax
jle    11d6 <main+0xb6>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    115c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
movzbl (%rsp,%rbx,1),%eax
test   %al,%al
je     11c0 <main+0xa0>
cmp    $0x9,%al
jne    1150 <main+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%al
jmp    1150 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1040 <getline@plt>
mov    $0x0,%ebx
test   %eax,%eax
jg     115c <main+0x3c>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000 x i8]
store i32 0, i32* %1
store i32 8, i32* %2
br label %7
7: ; preds = %46, %0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%9 = call i32 @getline(i8* %8, i32 1000)
store i32 %9, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %47
11: ; preds = %7
store i32 0, i32* %3
br label %12
12: ; preds = %43, %11
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %46
19: ; preds = %12
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 9
br i1 %25, label %26, label %37
26: ; preds = %19
store i32 0, i32* %4
br label %27
27: ; preds = %33, %26
%28 = load i32, i32* %4
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = call i32 @putchar(i8 signext 32)
br label %33
33: ; preds = %31
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %27
36: ; preds = %27
br label %43
37: ; preds = %19
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = call i32 @putchar(i8 signext %41)
br label %43
43: ; preds = %37, %36
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %12
46: ; preds = %12
br label %7
47: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %8, label %26
5: ; preds = %8
%6 = call i32 @getline(i8* %2, i32 1000)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %24, label %26
8: ; preds = %0, %24
%9 = phi i64 [ %25, %24 ], [ 0, %0 ]
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %9
%11 = load i8, i8* %10
switch i8 %11, label %20 [
i8 0, label %5
i8 9, label %12
]
12: ; preds = %8
%13 = call i32 @putchar(i8 signext 32)
%14 = call i32 @putchar(i8 signext 32)
%15 = call i32 @putchar(i8 signext 32)
%16 = call i32 @putchar(i8 signext 32)
%17 = call i32 @putchar(i8 signext 32)
%18 = call i32 @putchar(i8 signext 32)
%19 = call i32 @putchar(i8 signext 32)
br label %20
20: ; preds = %8, %12
%21 = phi i8 [ 32, %12 ], [ %11, %8 ]
%22 = call i32 @putchar(i8 signext %21)
%23 = add nuw i64 %9, 1
br label %24
24: ; preds = %20, %5
%25 = phi i64 [ %23, %20 ], [ 0, %5 ]
br label %8
26: ; preds = %5, %0
ret i32 0
}