#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, int);
int /*<<< orphan*/ entab(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int start_pos = 0;
  int col_per_tab = 8;
  if (argc != 3) {
    printf("\nUsage:\n\t%s -m +n\n\tm -\tstart position (column)\n\tn "
           "-\tcolumn per TAB\n",
           argv[0]);
    return 1;
  } else {
    if (argv[1][0] == '-')
      start_pos = atoi(argv[1] + 1);
    if (argv[2][0] == '+')
      col_per_tab = atoi(argv[2] + 1);
  }
  printf("m = %d\nn = %d\n", start_pos, col_per_tab);
  printf("\ndoing detab...\n");
  detab(start_pos, col_per_tab);
  printf("\ndoing entab...\n");
  entab(start_pos, col_per_tab);
  printf("\n");
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x8,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123f <main+0xff>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11b7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x1,%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    11df <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
add    $0x1,%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11e4 <main+0xa4>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <detab@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <entab@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11ea <main+0x8a>
mov    0x8(%rbx),%rdi
xor    %r14d,%r14d
cmpb   $0x2d,(%rdi)
jne    1184 <main+0x24>
add    $0x1,%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
mov    $0x8,%ebx
cmpb   $0x2b,(%rdi)
jne    119d <main+0x3d>
add    $0x1,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
lea    0xea0(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <detab@plt>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1080 <entab@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1200 <main+0xa0>
mov    (%rbx),%rsi
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [68 x i8] c"\0AUsage:\0A\09%s -m +n\0A\09m -\09start position (column)\0A\09n -\09column per TAB\0A\00"
@.str.1 = [15 x i8] c"m = %d\0An = %d\0A\00"
@.str.2 = [17 x i8] c"\0Adoing detab...\0A\00"
@.str.3 = [17 x i8] c"\0Adoing entab...\0A\00"
@.str.4 = [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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 8, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %57
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 45
br i1 %22, label %23, label %29
23: ; preds = %15
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %6
br label %29
29: ; preds = %23, %15
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 43
br i1 %36, label %37, label %43
37: ; preds = %29
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %7
br label %43
43: ; preds = %37, %29
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = call i32 @detab(i32 %49, i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%53 = load i32, i32* %6
%54 = load i32, i32* %7
%55 = call i32 @entab(i32 %53, i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %57
57: ; preds = %44, %10
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [68 x i8] c"\0AUsage:\0A\09%s -m +n\0A\09m -\09start position (column)\0A\09n -\09column per TAB\0A\00"
@.str.1 = [15 x i8] c"m = %d\0An = %d\0A\00"
@str = [16 x i8] c"\0Adoing detab...\00"
@str.5 = [16 x i8] c"\0Adoing entab...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %32
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 45
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = tail call i32 @atoi(i8* %13)
br label %15
15: ; preds = %12, %7
%16 = phi i32 [ %14, %12 ], [ 0, %7 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 43
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = getelementptr inbounds i8, i8* %18, i64 1
%23 = tail call i32 @atoi(i8* %22)
br label %24
24: ; preds = %15, %21
%25 = phi i32 [ %23, %21 ], [ 8, %15 ]
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%28 = tail call i32 @detab(i32 %16, i32 %25)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0))
%30 = tail call i32 @entab(i32 %16, i32 %25)
%31 = tail call i32 @putchar(i32 10)
br label %32
32: ; preds = %24, %4
%33 = phi i32 [ 1, %4 ], [ 0, %24 ]
ret i32 %33
}