#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 check_arg(char *);
int /*<<< orphan*/ detab(int);
int /*<<< orphan*/ entab(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i;
  if (argc == 1) {
    printf("Usage: ./a.out arg1 arg2 arg3\nDefault value has been setup\n");
    printf("Testing detab func\n");
    detab(8);
    printf("\nTesting entab func\n");
    entab(8);
  } else {
    for (i = 1; argv[i] != NULL; i++) {
      printf("\nTesting detab func TABSTOP set = %s\n", argv[i]);
      detab(check_arg(argv[i]));
    }
    for (i = 1; argv[i] != NULL; i++) {
      printf("\nTesting entab func TABSTOP set = %s\n", argv[i]);
      entab(check_arg(argv[i]));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11a3 <main+0x63>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <detab@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x8,%edi
call   1060 <entab@plt>
jmp    125c <main+0x11c>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11fd <main+0xbd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <check_arg@plt>
mov    %eax,%edi
call   1030 <detab@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <main+0x6a>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1257 <main+0x117>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <check_arg@plt>
mov    %eax,%edi
call   1060 <entab@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1204 <main+0xc4>
jmp    125c <main+0x11c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x1,%edi
jne    1197 <main+0x47>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%edi
call   1040 <detab@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%edi
call   1070 <entab@plt>
jmp    1216 <main+0xc6>
mov    %rsi,%r15
mov    0x8(%rsi),%rsi
test   %rsi,%rsi
je     1216 <main+0xc6>
lea    0x10(%r15),%rbx
lea    0xe52(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x8(%rbx),%rdi
call   1060 <check_arg@plt>
mov    %eax,%edi
call   1040 <detab@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    11b0 <main+0x60>
mov    0x8(%r15),%rsi
test   %rsi,%rsi
je     1216 <main+0xc6>
add    $0x10,%r15
lea    0xe3c(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x8(%r15),%rdi
call   1060 <check_arg@plt>
mov    %eax,%edi
call   1070 <entab@plt>
mov    (%r15),%rsi
add    $0x8,%r15
test   %rsi,%rsi
jne    11f0 <main+0xa0>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Usage: ./a.out arg1 arg2 arg3\0ADefault value has been setup\0A\00"
@.str.1 = [20 x i8] c"Testing detab func\0A\00"
@.str.2 = [21 x i8] c"\0ATesting entab func\0A\00"
@.str.3 = [38 x i8] c"\0ATesting detab func TABSTOP set = %s\0A\00"
@.str.4 = [38 x i8] c"\0ATesting entab func TABSTOP set = %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @detab(i32 8)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @entab(i32 8)
br label %66
15: ; preds = %2
store i32 1, i32* %6
br label %16
16: ; preds = %37, %15
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %40
23: ; preds = %16
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @check_arg(i8* %34)
%36 = call i32 @detab(i32 %35)
br label %37
37: ; preds = %23
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %16
40: ; preds = %16
store i32 1, i32* %6
br label %41
41: ; preds = %62, %40
%42 = load i8**, i8*** %5
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %65
48: ; preds = %41
%49 = load i8**, i8*** %5
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %53)
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @check_arg(i8* %59)
%61 = call i32 @entab(i32 %60)
br label %62
62: ; preds = %48
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %41
65: ; preds = %41
br label %66
66: ; preds = %65, %9
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [38 x i8] c"\0ATesting detab func TABSTOP set = %s\0A\00"
@.str.4 = [38 x i8] c"\0ATesting entab func TABSTOP set = %s\0A\00"
@str = [59 x i8] c"Usage: ./a.out arg1 arg2 arg3\0ADefault value has been setup\00"
@str.5 = [19 x i8] c"Testing detab func\00"
@str.6 = [20 x i8] c"\0ATesting entab func\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %41, label %17
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%11 = tail call i32 @detab(i32 8)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%13 = tail call i32 @entab(i32 8)
br label %41
14: ; preds = %17
%15 = load i8*, i8** %5
%16 = icmp eq i8* %15, null
br i1 %16, label %41, label %29
17: ; preds = %4, %17
%18 = phi i64 [ %25, %17 ], [ 1, %4 ]
%19 = phi i8* [ %27, %17 ], [ %6, %4 ]
%20 = phi i8** [ %26, %17 ], [ %5, %4 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%22 = load i8*, i8** %20
%23 = tail call i32 @check_arg(i8* %22)
%24 = tail call i32 @detab(i32 %23)
%25 = add nuw i64 %18, 1
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
%28 = icmp eq i8* %27, null
br i1 %28, label %14, label %17
29: ; preds = %14, %29
%30 = phi i64 [ %37, %29 ], [ 1, %14 ]
%31 = phi i8* [ %39, %29 ], [ %15, %14 ]
%32 = phi i8** [ %38, %29 ], [ %5, %14 ]
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%34 = load i8*, i8** %32
%35 = tail call i32 @check_arg(i8* %34)
%36 = tail call i32 @entab(i32 %35)
%37 = add nuw i64 %30, 1
%38 = getelementptr inbounds i8*, i8** %1, i64 %37
%39 = load i8*, i8** %38
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %29
41: ; preds = %29, %4, %14, %8
ret i32 0
}