#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 /*<<< orphan*/ DeTab(char *, char *, int);
int GetLine(char *, int);
int atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char input[1024];
  char line[1024 * 2];
  int len, tabwidth;
  if (argc == 2) {
    tabwidth = atoi(argv[1]);
  } else {
    tabwidth = 8;
  }
  while ((len = GetLine(input, 1024)) > 0) {
    DeTab(input, line, tabwidth);
    printf("%s", line);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    117b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0xc18(%rbp)
jmp    1185 <main+0x45>
movl   $0x8,-0xc18(%rbp)
jmp    118a <main+0x4a>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1030 <GetLine@plt>
mov    %eax,-0xc14(%rbp)
cmp    $0x0,%eax
jle    11db <main+0x9b>
lea    -0x410(%rbp),%rdi
lea    -0xc10(%rbp),%rsi
mov    -0xc18(%rbp),%edx
call   1050 <DeTab@plt>
lea    -0xc10(%rbp),%rsi
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
jmp    118a <main+0x4a>
mov    -0x4(%rbp),%eax
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc08,%rsp
mov    $0x8,%r14d
cmp    $0x2,%edi
jne    1164 <main+0x24>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    %rsp,%rdi
mov    $0x400,%esi
call   1030 <GetLine@plt>
test   %eax,%eax
jle    11ba <main+0x7a>
mov    %rsp,%rbx
lea    0x400(%rsp),%rbp
lea    0xe79(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <DeTab@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <GetLine@plt>
test   %eax,%eax
jg     1190 <main+0x50>
xor    %eax,%eax
add    $0xc08,%rsp
pop    %rbx
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 [1024 x i8]
%7 = alloca [2048 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %9
br label %18
17: ; preds = %2
store i32 8, i32* %9
br label %18
18: ; preds = %17, %12
br label %19
19: ; preds = %23, %18
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = call i32 @GetLine(i8* %20, i32 1024)
store i32 %21, i32* %8
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%25 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* %9
%27 = call i32 @DeTab(i8* %24, i8* %25, i32 %26)
%28 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %19
30: ; preds = %19
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [2048 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
br label %12
12: ; preds = %2, %8
%13 = phi i32 [ %11, %8 ], [ 8, %2 ]
%14 = call i32 @GetLine(i8* %5, i32 1024)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12, %16
%17 = call i32 @DeTab(i8* %5, i8* %6, i32 %13)
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%19 = call i32 @GetLine(i8* %5, i32 1024)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %16, label %21
21: ; preds = %16, %12
ret i32 0
}