#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ detab(char *, int, unsigned int);
int getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  int len, i;
  unsigned int ts = 8;
  char line[1000];
  while ((len = getline(line, 1000)) > 0) {
    if (argc == 0) {
      detab(line, len, ts);
      printf("%s", line);
    }
    for (i = 1; i < argc; ++i) {
      char tmp[1000];
      strcpy(tmp, line);
      ts = atoi(argv[i]);
      if (ts < 0)
        continue;
      detab(tmp, len, ts);
      printf("%s", tmp);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x1c(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x3e8,%esi
call   1070 <getline@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    123d <main+0xed>
cmpl   $0x0,-0x8(%rbp)
jne    11bc <main+0x6c>
lea    -0x410(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <detab@plt>
lea    -0x410(%rbp),%rsi
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1238 <main+0xe8>
lea    -0x800(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jae    1205 <main+0xb5>
jmp    122a <main+0xda>
lea    -0x800(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <detab@plt>
lea    -0x800(%rbp),%rsi
lea    0xddb(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c3 <main+0x73>
jmp    1170 <main+0x20>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e8,%rsp
mov    %rsi,0x8(%rsp)
mov    %edi,%r12d
lea    0x10(%rsp),%rdi
mov    $0x3e8,%esi
call   1070 <getline@plt>
test   %eax,%eax
jle    1256 <main+0x106>
mov    %eax,%ebx
mov    %r12d,%r15d
mov    $0x8,%r14d
lea    0xe6e(%rip),%r13
lea    0x400(%rsp),%rbp
mov    %r12d,0x4(%rsp)
jmp    11c4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3e8,%esi
call   1070 <getline@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1256 <main+0x106>
test   %r12d,%r12d
jne    11e5 <main+0x95>
lea    0x10(%rsp),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <detab@plt>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   1050 <printf@plt>
cmp    $0x2,%r12d
lea    0x10(%rsp),%rdi
jl     11b0 <main+0x60>
mov    $0x1,%r12d
mov    %r15,%r13
mov    0x8(%rsp),%r15
xchg   %ax,%ax
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    (%r15,%r12,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <detab@plt>
lea    0xdd4(%rip),%rdi
mov    %rbp,%rsi
call   1050 <printf@plt>
lea    0x10(%rsp),%rdi
add    $0x1,%r12
cmp    %r12,%r13
jne    1200 <main+0xb0>
mov    0x4(%rsp),%r12d
mov    %r13,%r15
lea    0xdaf(%rip),%r13
jmp    11b0 <main+0x60>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
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 [1000 x i8]
%10 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 8, i32* %8
br label %11
11: ; preds = %53, %2
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%13 = call i32 @getline(i8* %12, i32 1000)
store i32 %13, i32* %6
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %54
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%20 = load i32, i32* %6
%21 = load i32, i32* %8
%22 = call i32 @detab(i8* %19, i32 %20, i32 %21)
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %18, %15
store i32 1, i32* %7
br label %26
26: ; preds = %50, %25
%27 = load i32, i32* %7
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %53
30: ; preds = %26
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%33 = call i32 @strcpy(i8* %31, i8* %32)
%34 = load i8**, i8*** %5
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = icmp ult i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %30
br label %50
43: ; preds = %30
%44 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%45 = load i32, i32* %6
%46 = load i32, i32* %8
%47 = call i32 @detab(i8* %44, i32 %45, i32 %46)
%48 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %43, %42
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %26
53: ; preds = %26
br label %11
54: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @getline(i8* %5, i32 1000)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %34
8: ; preds = %2
%9 = icmp eq i32 %0, 0
%10 = icmp sgt i32 %0, 1
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%12 = zext i32 %0 to i64
br label %17
13: ; preds = %24, %23
%14 = phi i32 [ %19, %23 ], [ %29, %24 ]
%15 = call i32 @getline(i8* %5, i32 1000)
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %34
17: ; preds = %8, %13
%18 = phi i32 [ %6, %8 ], [ %15, %13 ]
%19 = phi i32 [ 8, %8 ], [ %14, %13 ]
br i1 %9, label %20, label %23
20: ; preds = %17
%21 = call i32 @detab(i8* %5, i32 %18, i32 %19)
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %23
23: ; preds = %20, %17
br i1 %10, label %24, label %13
24: ; preds = %23, %24
%25 = phi i64 [ %32, %24 ], [ 1, %23 ]
%26 = call i32 @strcpy(i8* %11, i8* %5)
%27 = getelementptr inbounds i8*, i8** %1, i64 %25
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = call i32 @detab(i8* %11, i32 %18, i32 %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%32 = add nuw nsw i64 %25, 1
%33 = icmp eq i64 %32, %12
br i1 %33, label %13, label %24
34: ; preds = %13, %2
ret i32 0
}