// File: TheStanian[P]Args/Args/Args.cpp
// Function: ArgsHandler::ArgsHandler(int, char**, bool)
ArgsHandler::ArgsHandler(int argc, char * argv [], bool checkCheckedFlags) : checkCheckedFlags(checkCheckedFlags) {
	std::string lastFlag = "";
	execpath = std::string(argv[0]);
	for (int i = 1; i < argc; ++i) {
		std::string current(argv[i]);
		if (current.at(0) == '-') {
			std::string fname;
			if (current.find('=') != current.npos) {
				fname = current.substr(1, current.find_first_of("=")-1);
			} else {
				fname = current.substr(1);
			}
			flags.insert(std::pair<std::string, Flag>(fname, Flag(current.substr(1))));
			lastFlag = fname;
		} else {
			arguments.push_back(current);
			if (lastFlag != "") {
				flags[lastFlag].addArgument(arguments.size()-1);
			} else {
				startargs.push_back(arguments.size()-1);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x220(%rbp)
movq %rdi, %rax
movq %rax, -0x248(%rbp)
callq 0x5a40
movq -0x220(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x240(%rbp)
callq 0x5a60
movq -0x220(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x238(%rbp)
callq 0x5a80
movq -0x220(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x230(%rbp)
callq 0x22b0
movq -0x220(%rbp), %rdi
subq $-0x80, %rdi
movq %rdi, -0x228(%rbp)
callq 0x5aa0
movq -0x220(%rbp), %rax
movb -0x19(%rbp), %cl
andb $0x1, %cl
movb %cl, 0xb0(%rax)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x2320
movq -0x218(%rbp), %rdx
leaq 0x829e(%rip), %rsi      # 0xc112
leaq -0x40(%rbp), %rdi
callq 0x2d30
jmp 0x3e7f
leaq -0x41(%rbp), %rdi
callq 0x2230
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x258(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x2320
movq -0x258(%rbp), %rsi
movq -0x250(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x2d30
jmp 0x3ebf
movq -0x248(%rbp), %rdi
addq $0x60, %rdi
leaq -0x78(%rbp), %rsi
callq 0x2270
leaq -0x78(%rbp), %rdi
callq 0x2130
leaq -0x79(%rbp), %rdi
callq 0x2230
movl $0x1, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x42cf
movq -0x18(%rbp), %rax
movslq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x268(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x2320
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x2d30
jmp 0x3f3a
leaq -0xa1(%rbp), %rdi
callq 0x2230
xorl %eax, %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0x2340
movq %rax, -0x270(%rbp)
jmp 0x3f5f
movq -0x270(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x41f6
leaq -0xc8(%rbp), %rdi
callq 0x22b0
leaq -0xa0(%rbp), %rdi
movl $0x3d, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x2290
cmpq $-0x1, %rax
je 0x4072
leaq 0x8143(%rip), %rsi      # 0xc0e7
xorl %eax, %eax
movl %eax, %edx
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x20f0
movq -0x278(%rbp), %rsi
movq %rax, %rcx
decq %rcx
leaq -0xe8(%rbp), %rdi
movl $0x1, %edx
callq 0x21f0
jmp 0x3fdb
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2270
leaq -0xe8(%rbp), %rdi
callq 0x2130
jmp 0x40b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x2230
jmp 0x42ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x2230
jmp 0x42e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa1(%rbp), %rdi
callq 0x2230
jmp 0x42e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x42c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x41e5
leaq -0x108(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x21f0
jmp 0x4093
leaq -0xc8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x2270
leaq -0x108(%rbp), %rdi
callq 0x2130
movq -0x248(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x280(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x21f0
jmp 0x40e5
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x4f10
jmp 0x40fa
leaq -0x180(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
callq 0x5b00
jmp 0x4116
movq -0x280(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x5ac0
movb %dl, -0x289(%rbp)
movq %rax, -0x288(%rbp)
jmp 0x4138
movb -0x289(%rbp), %al
movq -0x288(%rbp), %rcx
movq %rcx, -0x208(%rbp)
movb %al, -0x200(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x5b60
leaq -0x1d8(%rbp), %rdi
callq 0x37d0
leaq -0x1f8(%rbp), %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2040
jmp 0x4188
leaq -0xc8(%rbp), %rdi
callq 0x2130
jmp 0x42a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x41d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x41cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x5b60
leaq -0x1d8(%rbp), %rdi
callq 0x37d0
leaq -0x1f8(%rbp), %rdi
callq 0x2130
leaq -0xc8(%rbp), %rdi
callq 0x2130
jmp 0x42c1
movq -0x248(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5b90
jmp 0x420b
leaq 0x7f00(%rip), %rsi      # 0xc112
leaq -0x40(%rbp), %rdi
callq 0x5c00
movb %al, -0x28a(%rbp)
jmp 0x4223
movb -0x28a(%rbp), %al
testb $0x1, %al
jne 0x422f
jmp 0x426c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
leaq -0x40(%rbp), %rsi
callq 0x5c30
movq %rax, -0x298(%rbp)
jmp 0x424c
movq -0x248(%rbp), %rdi
callq 0x5d10
movq -0x298(%rbp), %rdi
movl %eax, %esi
decl %esi
callq 0x4330
jmp 0x426a
jmp 0x42a5
movq -0x248(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x2a0(%rbp)
callq 0x5d10
movq -0x2a0(%rbp), %rdi
decl %eax
movl %eax, -0x20c(%rbp)
leaq -0x20c(%rbp), %rsi
callq 0x5d30
jmp 0x42a3
jmp 0x42a5
jmp 0x42a7
leaq -0xa0(%rbp), %rdi
callq 0x2130
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x3eec
leaq -0xa0(%rbp), %rdi
callq 0x2130
jmp 0x42e1
leaq -0x40(%rbp), %rdi
callq 0x2130
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x2130
movq -0x228(%rbp), %rdi
callq 0x2f80
movq -0x230(%rbp), %rdi
callq 0x2130
movq -0x238(%rbp), %rdi
callq 0x2fa0
movq -0x240(%rbp), %rdi
callq 0x3000
movq -0x220(%rbp), %rdi
callq 0x2ec0
movq -0x50(%rbp), %rdi
callq 0x2310
nop