// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/main.cpp
// Function: getFlags(int, char**)
Flags getFlags(int argc, char ** argv)
{
	bool after = false;
	Flags flags;
	
	for (int i=1; i<argc; i++)
	{
		string arg(argv[i]);
		if (!after)
		{
			if (arg.size()>1 && arg[0]=='-')
			{
				string flag=arg.substr(1, string::npos);

				if (flag=="d" || flag=="debug")
				{
					flags.debug=true;
				}
				else if (flag=="v" || flag=="version")
				{
					flags.version=true;
				}
				else if (flag=="h" || flag=="help")
				{
					flags.help=true;
				}
				else if (flag=="r" || flag=="run")
				{
					flags.runCompiled=false;
					flags.runInterpreted=true;
					after = true;
				}
				else if (flag=="cpp")
				{
					if (i+1>=argc)
					{
						cout << "output file harus diikuti '-cpp' flag";
						flags.flagError=true;
					}

					flags.runInterpreted=false;

					flags.cppOutFile=string(argv[i+1]);

					i++;
				}
				else if (flag=="bin")
				{
					if (i+1>=argc)
					{
						cout << "output file harus diikuti '-bin' flag";
						flags.flagError=true;
					}

					flags.runInterpreted=false;

					flags.binOutFile=string(argv[i+1]);

					i++;
				}
				else if (flag=="e" || flag=="execute")
				{
					flags.runCompiled=true;
					flags.runInterpreted=false;
					after = true;
				}
				else
				{
					cout << "flag tidak diketahui '"+flag+"'" << endl;
					flags.flagError=true;
				}
			}
			else
			{
				flags.inFiles.push_back(arg);
				cmdLineArgs.push_back(arg);
			}
		}
		else
		{
			cmdLineArgs.push_back(arg);
		}
	}
	
	return flags;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, 0x8(%rsp)
movl %esi, %ebp
movq %rdi, %rbx
callq 0x41862
leaq 0x20(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %rbx, (%rsp)
leaq 0x40(%rbx), %rax
movq %rax, 0x18(%rsp)
pushq $0x1
popq %r15
xorl %ebx, %ebx
leaq 0x48(%rsp), %r12
leaq 0x68(%rsp), %r13
cmpl %ebp, %r15d
jge 0x41774
movslq %r15d, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rdx
callq 0xa150
testb $0x1, %bl
je 0x414d3
movb $0x1, %bl
leaq 0x38f92(%rip), %rdi     # 0x7a458
movq %r12, %rsi
callq 0x1855a
jmp 0x4155d
cmpq $0x2, 0x50(%rsp)
jb 0x4153f
movq 0x48(%rsp), %rax
cmpb $0x2d, (%rax)
jne 0x4153f
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0xa2d0
leaq 0x88(%rsp), %rbx
movq %r14, %rdi
leaq 0x16895(%rip), %rsi     # 0x57da2
callq 0x182b0
testb %al, %al
jne 0x41529
movq %r14, %rdi
leaq 0x17c05(%rip), %rsi     # 0x59125
callq 0x182b0
testb %al, %al
je 0x4156d
movq (%rsp), %rax
movb $0x1, 0x38(%rax)
xorl %ebx, %ebx
leaq 0x28(%rsp), %rdi
callq 0xa558
jmp 0x4155d
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x1855a
leaq 0x38f05(%rip), %rdi     # 0x7a458
movq %r12, %rsi
callq 0x1855a
xorl %ebx, %ebx
movq %r12, %rdi
callq 0xa558
incl %r15d
jmp 0x41496
movq %r14, %rdi
leaq 0x135f0(%rip), %rsi     # 0x54b67
callq 0x182b0
testb %al, %al
jne 0x41593
movq %r14, %rdi
leaq 0x17ba1(%rip), %rsi     # 0x5912b
callq 0x182b0
testb %al, %al
je 0x4159d
movq (%rsp), %rax
movb $0x1, 0x3a(%rax)
jmp 0x41531
movq %r14, %rdi
leaq 0x16598(%rip), %rsi     # 0x57b3f
callq 0x182b0
testb %al, %al
jne 0x415c3
movq %r14, %rdi
leaq 0x17b79(%rip), %rsi     # 0x59133
callq 0x182b0
testb %al, %al
je 0x415d0
movq (%rsp), %rax
movb $0x1, 0x39(%rax)
jmp 0x41531
movq %r14, %rdi
leaq 0x137e4(%rip), %rsi     # 0x54dbe
callq 0x182b0
testb %al, %al
jne 0x415f6
movq %r14, %rdi
leaq 0x17b4b(%rip), %rsi     # 0x59138
callq 0x182b0
testb %al, %al
je 0x4160c
movq (%rsp), %rax
movb $0x0, 0x80(%rax)
movb $0x1, 0x3b(%rax)
movb $0x1, %bl
jmp 0x41533
movq %r14, %rdi
leaq 0x17aa8(%rip), %rsi     # 0x590be
callq 0x182b0
testb %al, %al
je 0x4166b
incl %r15d
cmpl %ebp, %r15d
jl 0x41645
movq 0x38982(%rip), %rdi     # 0x79fb0
leaq 0x17b07(%rip), %rsi     # 0x5913c
callq 0xa2b0
movq (%rsp), %rax
movb $0x1, 0x81(%rax)
movq (%rsp), %rax
movb $0x0, 0x3b(%rax)
movslq %r15d, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0xa150
movq 0x18(%rsp), %rdi
jmp 0x416c8
movq %r14, %rdi
leaq 0x17aed(%rip), %rsi     # 0x59162
callq 0x182b0
testb %al, %al
je 0x416dd
incl %r15d
cmpl %ebp, %r15d
jl 0x416a4
movq 0x38923(%rip), %rdi     # 0x79fb0
leaq 0x17ad2(%rip), %rsi     # 0x59166
callq 0xa2b0
movq (%rsp), %rax
movb $0x1, 0x81(%rax)
movq (%rsp), %rax
movb $0x0, 0x3b(%rax)
movslq %r15d, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0xa150
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xa350
movq %rbx, %rdi
callq 0xa558
jmp 0x41531
movq %r14, %rdi
leaq 0x12b0d(%rip), %rsi     # 0x541f4
callq 0x182b0
testb %al, %al
jne 0x41703
movq %r14, %rdi
leaq 0x17a92(%rip), %rsi     # 0x5918c
callq 0x182b0
testb %al, %al
je 0x41717
movq (%rsp), %rax
movb $0x1, 0x80(%rax)
movb $0x0, 0x3b(%rax)
jmp 0x41605
movq %r13, %rdi
leaq 0x17a73(%rip), %rsi     # 0x59194
movq %r14, %rdx
callq 0xc8a1
movq %rbx, %rdi
leaq 0x68(%rsp), %rsi
leaq 0x17b1a(%rip), %rdx     # 0x59252
callq 0xc882
movq 0x3886c(%rip), %rdi     # 0x79fb0
movq %rbx, %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
movq %rbx, %rdi
callq 0xa558
movq %r13, %rdi
callq 0xa558
movq (%rsp), %rax
movb $0x1, 0x81(%rax)
jmp 0x41531
movq (%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x417a1
jmp 0x417b1
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xa558
leaq 0x68(%rsp), %rdi
callq 0xa558
jmp 0x417b4
jmp 0x417b1
jmp 0x417b1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
jmp 0x417ca
jmp 0x417c7
movq %rax, %rbx
jmp 0x417d4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa558
movq (%rsp), %rdi
callq 0x4183a
movq %rbx, %rdi
callq 0xa500
nop