#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 atoi(char *);
int /*<<< orphan*/ detab(int, char **);
int /*<<< orphan*/ entab(int, char **);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int tab_pos = 8;
  char **tab_poses1 = NULL;
  char **tab_poses2 = NULL;
  if (argc == 2)
    tab_pos = atoi(argv[1]);
  else if (argc > 2) {
    tab_poses1 = argv;
    tab_poses2 = argv;
    tab_poses1++;
    tab_poses2++;
  }
  printf("\ndoing detab...\n");
  detab(tab_pos, tab_poses1);
  printf("\ndoing entab...\n");
  entab(tab_pos, tab_poses2);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    118c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11c3 <main+0x83>
cmpl   $0x2,-0x8(%rbp)
jle    11be <main+0x7e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    11c3 <main+0x83>
lea    0xe36(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <detab@plt>
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1060 <entab@plt>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1167 <main+0x17>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    1179 <main+0x29>
add    $0x8,%rsi
xor    %ebx,%ebx
cmp    $0x3,%edi
cmovge %rsi,%rbx
mov    $0x8,%ebp
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <detab@plt>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <entab@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0Adoing detab...\0A\00"
@.str.1 = [17 x i8] c"\0Adoing entab...\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 8, i32* %6
store i8** null, i8*** %7
store i8** null, i8*** %8
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
br label %27
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i8**, i8*** %5
store i8** %20, i8*** %7
%21 = load i8**, i8*** %5
store i8** %21, i8*** %8
%22 = load i8**, i8*** %7
%23 = getelementptr inbounds i8*, i8** %22, i32 1
store i8** %23, i8*** %7
%24 = load i8**, i8*** %8
%25 = getelementptr inbounds i8*, i8** %24, i32 1
store i8** %25, i8*** %8
br label %26
26: ; preds = %19, %16
br label %27
27: ; preds = %26, %11
%28 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%29 = load i32, i32* %6
%30 = load i8**, i8*** %7
%31 = call i32 @detab(i32 %29, i8** %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* %6
%34 = load i8**, i8*** %8
%35 = call i32 @entab(i32 %33, i8** %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"\0Adoing detab...\00"
@str.3 = [16 x i8] c"\0Adoing entab...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %12
8: ; preds = %2
%9 = icmp sgt i32 %0, 2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = select i1 %9, i8** %10, i8** null
br label %12
12: ; preds = %8, %4
%13 = phi i32 [ %7, %4 ], [ 8, %8 ]
%14 = phi i8** [ null, %4 ], [ %11, %8 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @detab(i32 %13, i8** %14)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%18 = tail call i32 @entab(i32 %13, i8** %14)
%19 = tail call i32 @putchar(i32 10)
ret i32 0
}