#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_file(char *, int);
int /*<<< orphan*/ detab_string(char *, int);
int /*<<< orphan*/ print_usage_err();
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int s_num;
  if (argc == 1 || argc == 2) {
    print_usage_err();
    return -1;
  }
  s_num = atoi(argv[1]);
  if (s_num <= 0 || s_num > 8) {
    printf("Error: The number of spaces per tab must be between 1 and 8.\n");
    return -1;
  }
  if (strcmp("-f", argv[2]) == 0)
    detab_file(argv[3], s_num);
  else
    detab_string(argv[2], s_num);
  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)
je     118a <main+0x2a>
cmpl   $0x2,-0x8(%rbp)
jne    119d <main+0x3d>
mov    $0x0,%al
call   1050 <print_usage_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1223 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11c1 <main+0x61>
cmpl   $0x8,-0x14(%rbp)
jle    11d9 <main+0x79>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1223 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe56(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    120c <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1080 <detab_file@plt>
jmp    121c <main+0xbc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1030 <detab_string@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
add    $0xffffffff,%edi
cmp    $0x1,%edi
ja     117a <main+0x1a>
xor    %eax,%eax
call   1050 <print_usage_err@plt>
mov    $0xffffffff,%eax
jmp    11d6 <main+0x76>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
lea    -0x9(%r14),%eax
cmp    $0xfffffff7,%eax
ja     11a5 <main+0x45>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11d6 <main+0x76>
mov    0x10(%rbx),%rsi
lea    0xe50(%rip),%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x68>
mov    0x10(%rbx),%rdi
mov    %r14d,%esi
call   1040 <detab_string@plt>
jmp    11d4 <main+0x74>
mov    0x18(%rbx),%rdi
mov    %r14d,%esi
call   1080 <detab_file@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Error: The number of spaces per tab must be between 1 and 8.\0A\00"
@.str.1 = [3 x i8] c"-f\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 %12, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %9, %2
%13 = call i32 (...) @print_usage_err()
store i32 -1, i32* %3
br label %45
14: ; preds = %9
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp sle i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %14
%22 = load i32, i32* %6
%23 = icmp sgt i32 %22, 8
br i1 %23, label %24, label %26
24: ; preds = %21, %14
%25 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %45
26: ; preds = %21
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %26
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 3
%35 = load i8*, i8** %34
%36 = load i32, i32* %6
%37 = call i32 @detab_file(i8* %35, i32 %36)
br label %44
38: ; preds = %26
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = load i32, i32* %6
%43 = call i32 @detab_string(i8* %41, i32 %42)
br label %44
44: ; preds = %38, %32
store i32 0, i32* %3
br label %45
45: ; preds = %44, %24, %12
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-f\00"
@str = [61 x i8] c"Error: The number of spaces per tab must be between 1 and 8.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 2
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @print_usage_err()
br label %27
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = add i32 %10, -9
%12 = icmp ult i32 %11, -8
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
br label %27
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i32 @detab_file(i8* %22, i32 %10)
br label %27
24: ; preds = %15
%25 = load i8*, i8** %16
%26 = tail call i32 @detab_string(i8* %25, i32 %10)
br label %27
27: ; preds = %20, %24, %13, %5
%28 = phi i32 [ -1, %5 ], [ -1, %13 ], [ 0, %24 ], [ 0, %20 ]
ret i32 %28
}