#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*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ print_error_tracyWidom(char *, char *);
int /*<<< orphan*/ print_help_tracyWidom();
char *remove_ext(char *, char, char);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void analyse_param_tracyWidom(int argc, char *argv[], char *input,
                              char *output) {
  int i;
  char *tmp_file;
  int g_data = -1;
  for (i = 1; i < argc; i++) {
    if (argv[i][0] == '-') {
      switch (argv[i][1]) {
      case 'h':
        print_help_tracyWidom();
        exit(1);
        break;
      case 'i':
        i++;
        if (argc == i || argv[i][0] == '-')
          print_error_tracyWidom("cmd", "i (intput file)");
        g_data = 0;
        strcpy(input, argv[i]);
        break;
      case 'o':
        i++;
        if (argc == i || argv[i][0] == '-')
          print_error_tracyWidom("cmd", "o (output file)");
        strcpy(output, argv[i]);
        break;
      default:
        print_error_tracyWidom("basic", NULL);
      }
    } else {
      print_error_tracyWidom("basic", NULL);
    }
  }
  if (g_data == -1)
    print_error_tracyWidom("option", "-i input_file");
  tmp_file = remove_ext(input, '.', '/');
  if (!strcmp(output, "")) {
    strcpy(output, tmp_file);
    strcat(output, ".tracywidom");
  }
  free(tmp_file);
}


x86 assembly (clang, -O0):
<analyse_param_tracyWidom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0xffffffff,-0x34(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1310 <analyse_param_tracyWidom+0x190>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12ed <analyse_param_tracyWidom+0x16d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x38(%rbp)
sub    $0x68,%eax
je     120c <analyse_param_tracyWidom+0x8c>
jmp    11ea <analyse_param_tracyWidom+0x6a>
mov    -0x38(%rbp),%eax
sub    $0x69,%eax
je     121d <analyse_param_tracyWidom+0x9d>
jmp    11fb <analyse_param_tracyWidom+0x7b>
mov    -0x38(%rbp),%eax
sub    $0x6f,%eax
je     127e <analyse_param_tracyWidom+0xfe>
jmp    12d8 <analyse_param_tracyWidom+0x158>
mov    $0x0,%al
call   10a0 <print_help_tracyWidom@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     124a <analyse_param_tracyWidom+0xca>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    125d <analyse_param_tracyWidom+0xdd>
lea    0xdaf(%rip),%rdi
lea    0xdac(%rip),%rsi
call   1070 <print_error_tracyWidom@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
jmp    12e8 <analyse_param_tracyWidom+0x168>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     12ab <analyse_param_tracyWidom+0x12b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12be <analyse_param_tracyWidom+0x13e>
lea    0xd4e(%rip),%rdi
lea    0xd5b(%rip),%rsi
call   1070 <print_error_tracyWidom@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
jmp    12e8 <analyse_param_tracyWidom+0x168>
lea    0xd45(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <print_error_tracyWidom@plt>
jmp    12fd <analyse_param_tracyWidom+0x17d>
lea    0xd30(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <print_error_tracyWidom@plt>
jmp    1302 <analyse_param_tracyWidom+0x182>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a5 <analyse_param_tracyWidom+0x25>
cmpl   $0xffffffff,-0x34(%rbp)
jne    132d <analyse_param_tracyWidom+0x1ad>
lea    0xd09(%rip),%rdi
lea    0xd09(%rip),%rsi
call   1070 <print_error_tracyWidom@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
mov    $0x2f,%edx
call   1050 <remove_ext@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xcc4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    137a <analyse_param_tracyWidom+0x1fa>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xcca(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyse_param_tracyWidom>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r15
mov    %rdx,0x10(%rsp)
cmp    $0x2,%edi
jl     126b <analyse_param_tracyWidom+0xfb>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r12d
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xe7b(%rip),%r13
jmp    11cb <analyse_param_tracyWidom+0x5b>
cmp    $0x68,%eax
je     12cb <analyse_param_tracyWidom+0x15b>
mov    %r13,%rdi
xor    %esi,%esi
call   1060 <print_error_tracyWidom@plt>
add    $0x1,%r12d
cmp    %ebp,%r12d
jge    1264 <analyse_param_tracyWidom+0xf4>
movslq %r12d,%rax
mov    (%rbx,%rax,8),%rax
cmpb   $0x2d,(%rax)
jne    11b4 <analyse_param_tracyWidom+0x44>
movsbl 0x1(%rax),%eax
cmp    $0x69,%eax
je     1221 <analyse_param_tracyWidom+0xb1>
cmp    $0x6f,%eax
jne    11ab <analyse_param_tracyWidom+0x3b>
mov    %r15,%r14
add    $0x1,%r12d
movslq %r12d,%r15
cmp    %ebp,%r12d
je     11fd <analyse_param_tracyWidom+0x8d>
mov    (%rbx,%r15,8),%rsi
cmpb   $0x2d,(%rsi)
jne    1214 <analyse_param_tracyWidom+0xa4>
lea    0xdfc(%rip),%rdi
lea    0xe09(%rip),%rsi
call   1060 <print_error_tracyWidom@plt>
mov    (%rbx,%r15,8),%rsi
mov    %r14,%r15
mov    %r14,%rdi
call   1040 <strcpy@plt>
jmp    11be <analyse_param_tracyWidom+0x4e>
add    $0x1,%r12d
movslq %r12d,%r14
cmp    %ebp,%r12d
je     1236 <analyse_param_tracyWidom+0xc6>
mov    (%rbx,%r14,8),%rsi
cmpb   $0x2d,(%rsi)
jne    124d <analyse_param_tracyWidom+0xdd>
lea    0xdc3(%rip),%rdi
lea    0xdc0(%rip),%rsi
call   1060 <print_error_tracyWidom@plt>
mov    (%rbx,%r14,8),%rsi
mov    0x10(%rsp),%rdi
call   1040 <strcpy@plt>
movl   $0x0,0xc(%rsp)
jmp    11be <analyse_param_tracyWidom+0x4e>
cmpl   $0xffffffff,0xc(%rsp)
jne    127e <analyse_param_tracyWidom+0x10e>
lea    0xdb8(%rip),%rdi
lea    0xdb8(%rip),%rsi
call   1060 <print_error_tracyWidom@plt>
mov    0x10(%rsp),%rdi
mov    $0x2e,%esi
mov    $0x2f,%edx
call   1050 <remove_ext@plt>
mov    %rax,%rbx
cmpb   $0x0,(%r15)
jne    12b5 <analyse_param_tracyWidom+0x145>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0xd92(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
xor    %eax,%eax
call   1090 <print_help_tracyWidom@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cmd\00"
@.str.1 = [16 x i8] c"i (intput file)\00"
@.str.2 = [16 x i8] c"o (output file)\00"
@.str.3 = [6 x i8] c"basic\00"
@.str.4 = [7 x i8] c"option\00"
@.str.5 = [14 x i8] c"-i input_file\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [12 x i8] c".tracywidom\00"
define void @analyse_param_tracyWidom(i32 %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 -1, i32* %11
store i32 1, i32* %9
br label %12
12: ; preds = %96, %4
%13 = load i32, i32* %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %99
16: ; preds = %12
%17 = load i8**, i8*** %6
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br i1 %25, label %26, label %93
26: ; preds = %16
%27 = load i8**, i8*** %6
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
switch i32 %34, label %90 [
i32 104, label %35
i32 105, label %38
i32 111, label %64
]
35: ; preds = %26
%36 = call i32 (...) @print_help_tracyWidom()
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %26
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
%41 = load i32, i32* %5
%42 = load i32, i32* %9
%43 = icmp eq i32 %41, %42
br i1 %43, label %54, label %44
44: ; preds = %38
%45 = load i8**, i8*** %6
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8, i8* %49, i64 0
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 45
br i1 %53, label %54, label %56
54: ; preds = %44, %38
%55 = call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %56
56: ; preds = %54, %44
store i32 0, i32* %11
%57 = load i8*, i8** %7
%58 = load i8**, i8*** %6
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i32 @strcpy(i8* %57, i8* %62)
br label %92
64: ; preds = %26
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
%67 = load i32, i32* %5
%68 = load i32, i32* %9
%69 = icmp eq i32 %67, %68
br i1 %69, label %80, label %70
70: ; preds = %64
%71 = load i8**, i8*** %6
%72 = load i32, i32* %9
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
%75 = load i8*, i8** %74
%76 = getelementptr inbounds i8, i8* %75, i64 0
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 45
br i1 %79, label %80, label %82
80: ; preds = %70, %64
%81 = call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %82
82: ; preds = %80, %70
%83 = load i8*, i8** %8
%84 = load i8**, i8*** %6
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = call i32 @strcpy(i8* %83, i8* %88)
br label %92
90: ; preds = %26
%91 = call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %92
92: ; preds = %90, %82, %56
br label %95
93: ; preds = %16
%94 = call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %95
95: ; preds = %93, %92
br label %96
96: ; preds = %95
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %12
99: ; preds = %12
%100 = load i32, i32* %11
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %104
102: ; preds = %99
%103 = call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %104
104: ; preds = %102, %99
%105 = load i8*, i8** %7
%106 = call i8* @remove_ext(i8* %105, i8 signext 46, i8 signext 47)
store i8* %106, i8** %10
%107 = load i8*, i8** %8
%108 = call i32 @strcmp(i8* %107, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0))
%109 = icmp ne i32 %108, 0
br i1 %109, label %116, label %110
110: ; preds = %104
%111 = load i8*, i8** %8
%112 = load i8*, i8** %10
%113 = call i32 @strcpy(i8* %111, i8* %112)
%114 = load i8*, i8** %8
%115 = call i32 @strcat(i8* %114, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %116
116: ; preds = %110, %104
%117 = load i8*, i8** %10
%118 = call i32 @free(i8* %117)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cmd\00"
@.str.1 = [16 x i8] c"i (intput file)\00"
@.str.2 = [16 x i8] c"o (output file)\00"
@.str.3 = [6 x i8] c"basic\00"
@.str.4 = [7 x i8] c"option\00"
@.str.5 = [14 x i8] c"-i input_file\00"
@.str.7 = [12 x i8] c".tracywidom\00"
define void @analyse_param_tracyWidom(i32 %0, i8** nocapture %1, i8* %2, i8* %3) {
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %64
6: ; preds = %4, %57
%7 = phi i32 [ %59, %57 ], [ -1, %4 ]
%8 = phi i32 [ %60, %57 ], [ 1, %4 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 45
br i1 %13, label %14, label %55
14: ; preds = %6
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %53 [
i32 104, label %18
i32 105, label %21
i32 111, label %37
]
18: ; preds = %14
%19 = tail call i32 (...) @print_help_tracyWidom()
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %14
%22 = add nsw i32 %8, 1
%23 = icmp eq i32 %22, %0
%24 = sext i32 %22 to i64
br i1 %23, label %30, label %25
25: ; preds = %21
%26 = getelementptr inbounds i8*, i8** %1, i64 %24
%27 = load i8*, i8** %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 45
br i1 %29, label %30, label %34
30: ; preds = %21, %25
%31 = tail call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds i8*, i8** %1, i64 %24
%33 = load i8*, i8** %32
br label %34
34: ; preds = %30, %25
%35 = phi i8* [ %33, %30 ], [ %27, %25 ]
%36 = tail call i32 @strcpy(i8* %2, i8* %35)
br label %57
37: ; preds = %14
%38 = add nsw i32 %8, 1
%39 = icmp eq i32 %38, %0
%40 = sext i32 %38 to i64
br i1 %39, label %46, label %41
41: ; preds = %37
%42 = getelementptr inbounds i8*, i8** %1, i64 %40
%43 = load i8*, i8** %42
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 45
br i1 %45, label %46, label %50
46: ; preds = %37, %41
%47 = tail call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%48 = getelementptr inbounds i8*, i8** %1, i64 %40
%49 = load i8*, i8** %48
br label %50
50: ; preds = %46, %41
%51 = phi i8* [ %49, %46 ], [ %43, %41 ]
%52 = tail call i32 @strcpy(i8* %3, i8* %51)
br label %57
53: ; preds = %14
%54 = tail call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %57
55: ; preds = %6
%56 = tail call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %57
57: ; preds = %55, %53, %50, %34
%58 = phi i32 [ %8, %53 ], [ %38, %50 ], [ %22, %34 ], [ %8, %55 ]
%59 = phi i32 [ %7, %53 ], [ %7, %50 ], [ 0, %34 ], [ %7, %55 ]
%60 = add nsw i32 %58, 1
%61 = icmp slt i32 %60, %0
br i1 %61, label %6, label %62
62: ; preds = %57
%63 = icmp eq i32 %59, -1
br i1 %63, label %64, label %66
64: ; preds = %4, %62
%65 = tail call i32 @print_error_tracyWidom(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %66
66: ; preds = %64, %62
%67 = tail call i8* @remove_ext(i8* %2, i8 signext 46, i8 signext 47)
%68 = load i8, i8* %3
%69 = icmp eq i8 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = tail call i32 @strcpy(i8* %3, i8* %67)
%72 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %73
73: ; preds = %70, %66
%74 = tail call i32 @free(i8* %67)
ret void
}