#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*/ ConfigLoad(int);
int /*<<< orphan*/ FileSpecActiveProfils(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *HashGet(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ showVersion(int);
scalar_t__ strcmp(char *, char *);
void ParseArgs(int ac, char **av) {
  int verbose = 1;
  int i;
  if (ac == 1)
    return;
  for (i = 1; i < ac; i++)
    if (strcmp(av[i], "-c") == 0)
      i++;
    else if (strcmp(av[i], "--configtest") == 0) {
      ConfigLoad(verbose);
      if (HashGet("ApplyFileSpec") != NULL)
        FileSpecActiveProfils(HashGet("ApplyFileSpec"), verbose);
      (void)printf("Config is valid.\n");
      exit(0);
    } else if (strcmp(av[i], "--help") == 0) {
    help:
      (void)printf("Build:\n\t");
      showVersion(0);
      (void)printf("\nUsage:\n\t%s [verbose] [options]\n\nOptions:\n", av[0]);
      (void)printf("\t--configtest : test the config file and show errors\n");
      (void)printf("\t--help       : show this screen\n");
      (void)printf("\t--version    : show version of MySecureShell\n");
      (void)printf("\nVerbose:\n");
      (void)printf("\t-v           : add a level at verbose mode\n");
      exit(0);
    } else if (strcmp(av[i], "--version") == 0) {
      showVersion(1);
      exit(0);
    } else if (strcmp(av[i], "-v") == 0)
      verbose++;
    else {
      (void)printf("--- UNKNOW OPTION: %s ---\n\n", av[i]);
      goto help;
    }
}


x86 assembly (clang, -O0):
<ParseArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1195 <ParseArgs+0x25>
jmp    138b <ParseArgs+0x21b>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    138b <ParseArgs+0x21b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe45(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11d8 <ParseArgs+0x68>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1378 <ParseArgs+0x208>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe18(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1244 <ParseArgs+0xd4>
mov    -0x14(%rbp),%edi
call   1050 <ConfigLoad@plt>
lea    0xe07(%rip),%rdi
call   1090 <HashGet@plt>
cmp    $0x0,%rax
je     122f <ParseArgs+0xbf>
lea    0xdf1(%rip),%rdi
call   1090 <HashGet@plt>
mov    %rax,%rdi
mov    -0x14(%rbp),%esi
call   1070 <FileSpecActiveProfils@plt>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12e2 <ParseArgs+0x172>
jmp    126b <ParseArgs+0xfb>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <showVersion@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe35(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1315 <ParseArgs+0x1a5>
mov    $0x1,%edi
call   1040 <showVersion@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1345 <ParseArgs+0x1d5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1364 <ParseArgs+0x1f4>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126b <ParseArgs+0xfb>
jmp    1369 <ParseArgs+0x1f9>
jmp    136e <ParseArgs+0x1fe>
jmp    1373 <ParseArgs+0x203>
jmp    1378 <ParseArgs+0x208>
jmp    137d <ParseArgs+0x20d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119c <ParseArgs+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseArgs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     122e <ParseArgs+0xae>
mov    %rsi,%rbx
mov    %edi,%r14d
mov    $0x1,%r12d
lea    0xe59(%rip),%r15
mov    $0x1,%ebp
jmp    11bd <ParseArgs+0x3d>
xchg   %ax,%ax
add    $0x1,%r12d
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    122e <ParseArgs+0xae>
movslq %r12d,%r13
mov    (%rbx,%r13,8),%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11b0 <ParseArgs+0x30>
mov    (%rbx,%r13,8),%rdi
lea    0xe27(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12bf <ParseArgs+0x13f>
mov    (%rbx,%r13,8),%rdi
lea    0xe29(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1260 <ParseArgs+0xe0>
mov    (%rbx,%r13,8),%rdi
lea    0xe4f(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     123d <ParseArgs+0xbd>
mov    (%rbx,%r13,8),%rdi
lea    0xe44(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    124e <ParseArgs+0xce>
add    $0x1,%ebp
jmp    11b4 <ParseArgs+0x34>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1050 <showVersion@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    (%rbx,%r13,8),%rsi
lea    0xe0d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <showVersion@plt>
mov    (%rbx),%rsi
lea    0xdaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
lea    0xe53(%rip),%rdi
jmp    12f4 <ParseArgs+0x174>
mov    %ebp,%edi
call   1060 <ConfigLoad@plt>
lea    0xd43(%rip),%rdi
call   10a0 <HashGet@plt>
test   %rax,%rax
je     12ed <ParseArgs+0x16d>
lea    0xd32(%rip),%rdi
call   10a0 <HashGet@plt>
mov    %rax,%rdi
mov    %ebp,%esi
call   1080 <FileSpecActiveProfils@plt>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-c\00"
@.str.1 = [13 x i8] c"--configtest\00"
@.str.2 = [14 x i8] c"ApplyFileSpec\00"
@.str.3 = [18 x i8] c"Config is valid.\0A\00"
@.str.4 = [7 x i8] c"--help\00"
@.str.5 = [9 x i8] c"Build:\0A\09\00"
@.str.6 = [43 x i8] c"\0AUsage:\0A\09%s [verbose] [options]\0A\0AOptions:\0A\00"
@.str.7 = [54 x i8] c"\09--configtest : test the config file and show errors\0A\00"
@.str.8 = [34 x i8] c"\09--help : show this screen\0A\00"
@.str.9 = [47 x i8] c"\09--version : show version of MySecureShell\0A\00"
@.str.10 = [11 x i8] c"\0AVerbose:\0A\00"
@.str.11 = [45 x i8] c"\09-v : add a level at verbose mode\0A\00"
@.str.12 = [10 x i8] c"--version\00"
@.str.13 = [3 x i8] c"-v\00"
@.str.14 = [28 x i8] c"--- UNKNOW OPTION: %s ---\0A\0A\00"
define void @ParseArgs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %5
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %2
br label %105
10: ; preds = %2
store i32 1, i32* %6
br label %11
11: ; preds = %102, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %105
15: ; preds = %11
%16 = load i8**, i8*** %4
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %15
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %101
26: ; preds = %15
%27 = load i8**, i8*** %4
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %46
34: ; preds = %26
%35 = load i32, i32* %5
%36 = call i32 @ConfigLoad(i32 %35)
%37 = call i32* @HashGet(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %43
39: ; preds = %34
%40 = call i32* @HashGet(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* %5
%42 = call i32 @FileSpecActiveProfils(i32* %40, i32 %41)
br label %43
43: ; preds = %39, %34
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
46: ; preds = %26
%47 = load i8**, i8*** %4
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %68
54: ; preds = %46
br label %55
55: ; preds = %90, %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @showVersion(i32 0)
%58 = load i8**, i8*** %4
%59 = getelementptr inbounds i8*, i8** %58, i64 0
%60 = load i8*, i8** %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
%67 = call i32 @exit(i32 0)
unreachable
68: ; preds = %46
%69 = load i8**, i8*** %4
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %68
%77 = call i32 @showVersion(i32 1)
%78 = call i32 @exit(i32 0)
unreachable
79: ; preds = %68
%80 = load i8**, i8*** %4
%81 = load i32, i32* %6
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %80, i64 %82
%84 = load i8*, i8** %83
%85 = call i64 @strcmp(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %79
%88 = load i32, i32* %5
%89 = add nsw i32 %88, 1
store i32 %89, i32* %5
br label %97
90: ; preds = %79
%91 = load i8**, i8*** %4
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %91, i64 %93
%95 = load i8*, i8** %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i8* %95)
br label %55
97: ; preds = %87
br label %98
98: ; preds = %97
br label %99
99: ; preds = %98
br label %100
100: ; preds = %99
br label %101
101: ; preds = %100, %23
br label %102
102: ; preds = %101
%103 = load i32, i32* %6
%104 = add nsw i32 %103, 1
store i32 %104, i32* %6
br label %11
105: ; preds = %9, %11
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-c\00"
@.str.1 = [13 x i8] c"--configtest\00"
@.str.2 = [14 x i8] c"ApplyFileSpec\00"
@.str.4 = [7 x i8] c"--help\00"
@.str.5 = [9 x i8] c"Build:\0A\09\00"
@.str.6 = [43 x i8] c"\0AUsage:\0A\09%s [verbose] [options]\0A\0AOptions:\0A\00"
@.str.12 = [10 x i8] c"--version\00"
@.str.13 = [3 x i8] c"-v\00"
@.str.14 = [28 x i8] c"--- UNKNOW OPTION: %s ---\0A\0A\00"
@str = [53 x i8] c"\09--configtest : test the config file and show errors\00"
@str.15 = [33 x i8] c"\09--help : show this screen\00"
@str.16 = [46 x i8] c"\09--version : show version of MySecureShell\00"
@str.17 = [10 x i8] c"\0AVerbose:\00"
@str.18 = [44 x i8] c"\09-v : add a level at verbose mode\00"
@str.19 = [17 x i8] c"Config is valid.\00"
define void @ParseArgs(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %64
4: ; preds = %2, %59
%5 = phi i32 [ %62, %59 ], [ 1, %2 ]
%6 = phi i32 [ %60, %59 ], [ 1, %2 ]
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = add nsw i32 %5, 1
br label %59
14: ; preds = %4
%15 = load i8*, i8** %8
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = tail call i32 @ConfigLoad(i32 %6)
%20 = tail call i32* @HashGet(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = tail call i32* @HashGet(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @FileSpecActiveProfils(i32* %23, i32 %6)
br label %25
25: ; preds = %22, %18
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.19, i64 0, i64 0))
%27 = tail call i32 @exit(i32 0)
unreachable
28: ; preds = %14
%29 = load i8*, i8** %8
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %28, %56
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%34 = tail call i32 @showVersion(i32 0)
%35 = load i8*, i8** %1
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %35)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.17, i64 0, i64 0))
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.18, i64 0, i64 0))
%42 = tail call i32 @exit(i32 0)
unreachable
43: ; preds = %28
%44 = load i8*, i8** %8
%45 = tail call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = tail call i32 @showVersion(i32 1)
%49 = tail call i32 @exit(i32 0)
unreachable
50: ; preds = %43
%51 = load i8*, i8** %8
%52 = tail call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = add nsw i32 %6, 1
br label %59
56: ; preds = %50
%57 = load i8*, i8** %8
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i8* %57)
br label %32
59: ; preds = %12, %54
%60 = phi i32 [ %6, %12 ], [ %55, %54 ]
%61 = phi i32 [ %13, %12 ], [ %5, %54 ]
%62 = add nsw i32 %61, 1
%63 = icmp slt i32 %62, %0
br i1 %63, label %4, label %64
64: ; preds = %59, %2
ret void
}