// File: /workspace/github_cpp_makefile_star2_O1/akinanop[P]mvl-solver/src/Global.cc
// Function: ParseCommandLine(CommandLine*, int, char**)
void ParseCommandLine(CommandLine * cline, int argc, char ** argv)
{
	//local variables
	int current = 1;

	//Default Initialization
	cline->NUM_VAR = -1;
	cline->NUM_CLAUSE = -1;
	cline->CLAUSE_SIZE = 3;
	cline->SAT_UNSAT = true;
	cline->DOMAIN_SIZE = 10;
	cline->DRAND = false;
	cline->BOOL_FINITE = false;
	cline->FILE = NULL;
	cline->MODEL_FILE = NULL;
	cline->TIME = 3600000; //1000 hours = 1000 * 60mins * 60secs
	cline -> RESTARTS = 0;
	cline->MODEL = true;
	cline -> WATCH = false;
	cline -> heuristic = Heuristic::BK;
	cline -> LOG = false;


	//Check if enough arguments supplied
	if(argc < 2)
	{
		PrintHelp();
	}

	else
	{
		//If Menu/Help option selected
		if(!strcmp(argv[1], "-help"))
		{
			PrintHelp();
		}

		//If option is for generating benchmark problems
		else if(!strcmp(argv[1],"-genben"))
		{
			for(current = 2; current < argc; current++)
			{
				if(!strcmp(argv[current], "-var"))
					cline->NUM_VAR = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clause"))
					cline->NUM_CLAUSE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clausesize"))
					cline->CLAUSE_SIZE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-sat"))
					cline->SAT_UNSAT = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-domain"))
					cline->DOMAIN_SIZE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-drand"))
					cline->DRAND = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-bool"))
					cline->BOOL_FINITE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else
					;
			}
		}

		//If option is for converting boolean to finite domain
		else if(!strcmp(argv[1], "-b2f"))
		{
			for(current = 2; current < argc; current++)
			{
				if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else if(!strcmp(argv[current], "-model"))
					cline->MODEL_FILE = argv[++current];
				else
					;
			}
		}

		//If option if for converting finite domain to boolean : Linear Encoding
		else if(!strcmp(argv[1], "-linenc"))
		{
			for(current = 2; current < argc; current++)
			{
				if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else if(!strcmp(argv[current], "-model"))
					cline->MODEL_FILE = argv[++current];
				else
					;
			}
		}

		//If option if for converting finite domain to boolean : Quadratic Encoding
		else if(!strcmp(argv[1], "-quadenc"))
		{
			for(current = 2; current < argc; current++)
			{
				if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else if(!strcmp(argv[current], "-model"))
					cline->MODEL_FILE = argv[++current];
				else
					;
			}
		}

		//If option is for solving a domain problem : Chronological Backtracking
		else if(!strcmp(argv[1],"-solvech"))
		{
			for(current = 2; current < argc; current++)
			{
				if(!strcmp(argv[current], "-var"))
					cline->NUM_VAR = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clause"))
					cline->NUM_CLAUSE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clausesize"))
					cline->CLAUSE_SIZE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else if(!strcmp(argv[current], "-model"))
					cline->MODEL_FILE = argv[++current];
				else if(!strcmp(argv[current], "-time"))
					cline->TIME = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-lazy"))
					cline -> heuristic = Heuristic::lazy;
				else if(!strcmp(argv[current], "-verbose"))
					cline->LOG = true;
				else
					;
			}

		}

		//If option is for solving a domain problem : Non Chronological Backtracking
		else if(!strcmp(argv[1],"-solvenc"))
		{
			for(current = 2; current < argc; current++)
			{
				if (!strcmp(argv[current], "-restart"))
					cline->RESTARTS = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-verbose"))
					cline->LOG = true;
				else if(!strcmp(argv[current], "-wl")) {
					cline -> WATCH = true;
					if (cline->heuristic == Heuristic::BK)
						cline->heuristic = Heuristic::VSIDS;
				}
				else if(!strcmp(argv[current], "-vsids"))
					cline -> heuristic = Heuristic::VSIDS;
				else if(!strcmp(argv[current], "-vsids_pos"))
					cline -> heuristic = Heuristic::VSIDS_pos;
				else if(!strcmp(argv[current], "-lazy"))
					cline -> heuristic = Heuristic::lazy;
				else if(!strcmp(argv[current], "-model"))
					cline->MODEL = true;
				else if(!strcmp(argv[current], "-var"))
					cline->NUM_VAR = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clause"))
					cline->NUM_CLAUSE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-clausesize"))
					cline->CLAUSE_SIZE = atoi(argv[++current]);
				else if(!strcmp(argv[current], "-file"))
					cline->FILE = argv[++current];
				else if(!strcmp(argv[current], "-time"))
					cline->TIME = atoi(argv[++current]);
				else
					;
			}

		}

		else
		{
			//nothing
			;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq $-0x1, 0x4(%rdi)
movl $0x3, 0xc(%rdi)
movb $0x1, 0x10(%rdi)
movl $0xa, 0x14(%rdi)
movw $0x0, 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq $0x36ee80, 0x30(%rdi)   # imm = 0x36EE80
movw $0x1, (%rdi)
movl $0x0, 0x38(%rdi)
movb $0x0, 0x2(%rdi)
cmpl $0x2, %esi
jl 0x3e03
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdx), %r15
leaq 0x8ef2(%rip), %rsi      # 0xca5a
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x3e03
leaq 0x20(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x84de(%rip), %rsi      # 0xc066
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x3e16
leaq 0x28(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x84c6(%rip), %rsi      # 0xc06e
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x3f9e
leaq 0x84b4(%rip), %rsi      # 0xc073
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x4000
leaq 0x84a5(%rip), %rsi      # 0xc07b
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x405f
leaq 0x8497(%rip), %rsi      # 0xc084
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
je 0x40ba
leaq 0x8489(%rip), %rsi      # 0xc08d
movq %r15, %rdi
callq 0x22e0
testl %eax, %eax
setne %al
cmpl $0x2, %ebp
sete %cl
orb %al, %cl
jne 0x40bf
movl $0x2, %r12d
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x8e7f(%rip), %rsi      # 0xcab5
callq 0x22e0
testl %eax, %eax
je 0x3d57
movq %r13, %rdi
leaq 0x8e5f(%rip), %rsi      # 0xcaac
callq 0x22e0
testl %eax, %eax
je 0x3d6e
movq %r13, %rdi
leaq 0x8e5a(%rip), %rsi      # 0xcabe
callq 0x22e0
testl %eax, %eax
je 0x3d75
movq %r13, %rdi
leaq 0x8e47(%rip), %rsi      # 0xcac2
callq 0x22e0
testl %eax, %eax
je 0x3d81
movq %r13, %rdi
leaq 0x8e37(%rip), %rsi      # 0xcac9
callq 0x22e0
testl %eax, %eax
je 0x3d8b
movq %r13, %rdi
leaq 0x8dfd(%rip), %rsi      # 0xcaa6
callq 0x22e0
testl %eax, %eax
je 0x3d95
movq %r13, %rdi
leaq 0x8dd9(%rip), %rsi      # 0xca99
callq 0x22e0
testl %eax, %eax
je 0x3d9f
movq %r13, %rdi
leaq 0x8d89(%rip), %rsi      # 0xca60
callq 0x22e0
testl %eax, %eax
je 0x3da5
movq %r13, %rdi
leaq 0x8d77(%rip), %rsi      # 0xca65
callq 0x22e0
testl %eax, %eax
je 0x3db9
movq %r13, %rdi
leaq 0x8d68(%rip), %rsi      # 0xca6d
callq 0x22e0
testl %eax, %eax
je 0x3dcd
movq %r13, %rdi
leaq 0x8d77(%rip), %rsi      # 0xca93
callq 0x22e0
testl %eax, %eax
je 0x3de1
movq %r13, %rdi
leaq 0x8d6d(%rip), %rsi      # 0xcaa0
callq 0x22e0
testl %eax, %eax
jne 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x30(%r14)
jmp 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x34(%r14)
jmp 0x3df2
movb $0x1, 0x2(%r14)
jmp 0x3df2
movb $0x1, 0x1(%r14)
cmpl $0x0, 0x38(%r14)
jne 0x3df2
movl $0x1, 0x38(%r14)
jmp 0x3df2
movl $0x3, 0x38(%r14)
jmp 0x3df2
movl $0x2, 0x38(%r14)
jmp 0x3df2
movb $0x1, (%r14)
jmp 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x4(%r14)
jmp 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x8(%r14)
jmp 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0xc(%r14)
jmp 0x3df2
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
incl %r12d
cmpl %ebp, %r12d
jl 0x3c25
jmp 0x40bf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2bad
cmpl $0x2, %ebp
je 0x40bf
movl $0x2, %r12d
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x8c2a(%rip), %rsi      # 0xca60
callq 0x22e0
testl %eax, %eax
je 0x3efa
movq %r13, %rdi
leaq 0x8c18(%rip), %rsi      # 0xca65
callq 0x22e0
testl %eax, %eax
je 0x3f0e
movq %r13, %rdi
leaq 0x8c09(%rip), %rsi      # 0xca6d
callq 0x22e0
testl %eax, %eax
je 0x3f22
movq %r13, %rdi
leaq 0x8bfe(%rip), %rsi      # 0xca79
callq 0x22e0
testl %eax, %eax
je 0x3f36
movq %r13, %rdi
leaq 0x8bec(%rip), %rsi      # 0xca7e
callq 0x22e0
testl %eax, %eax
je 0x3f4d
movq %r13, %rdi
leaq 0x8bdd(%rip), %rsi      # 0xca86
callq 0x22e0
testl %eax, %eax
je 0x3f61
movq %r13, %rdi
leaq 0x8bcd(%rip), %rsi      # 0xca8d
callq 0x22e0
testl %eax, %eax
je 0x3f78
movq %r13, %rdi
leaq 0x8bbc(%rip), %rsi      # 0xca93
callq 0x22e0
testl %eax, %eax
jne 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x4(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x8(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0xc(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
testl %eax, %eax
setne 0x10(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x14(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
testl %eax, %eax
setne 0x18(%r14)
jmp 0x3f8d
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
testl %eax, %eax
setne 0x19(%r14)
incl %r12d
cmpl %ebp, %r12d
jl 0x3e25
jmp 0x40bf
cmpl $0x2, %ebp
je 0x40bf
movl $0x2, %r13d
leaq 0x8adf(%rip), %r14      # 0xca93
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22e0
movq 0x8(%rsp), %rcx
testl %eax, %eax
je 0x3fe7
movq %r12, %rdi
leaq 0x8ac0(%rip), %rsi      # 0xca99
callq 0x22e0
movq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x3ff3
leal 0x1(%r15), %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
cmpl %ebp, %r13d
jl 0x3fb4
jmp 0x40bf
cmpl $0x2, %ebp
je 0x40bf
movl $0x2, %r13d
leaq 0x8a7d(%rip), %r14      # 0xca93
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22e0
movq 0x8(%rsp), %rcx
testl %eax, %eax
je 0x4049
movq %r12, %rdi
leaq 0x8a5e(%rip), %rsi      # 0xca99
callq 0x22e0
movq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x4055
leal 0x1(%r15), %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
cmpl %ebp, %r13d
jl 0x4016
jmp 0x40bf
cmpl $0x2, %ebp
je 0x40bf
movl $0x2, %r13d
leaq 0x8a22(%rip), %r14      # 0xca93
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22e0
movq 0x8(%rsp), %rcx
testl %eax, %eax
je 0x40a4
movq %r12, %rdi
leaq 0x8a03(%rip), %rsi      # 0xca99
callq 0x22e0
movq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x40b0
leal 0x1(%r15), %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
cmpl %ebp, %r13d
jl 0x4071
jmp 0x40bf
cmpl $0x2, %ebp
jne 0x40ce
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %r12d
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x897b(%rip), %rsi      # 0xca60
callq 0x22e0
testl %eax, %eax
je 0x4196
movq %r13, %rdi
leaq 0x8969(%rip), %rsi      # 0xca65
callq 0x22e0
testl %eax, %eax
je 0x41aa
movq %r13, %rdi
leaq 0x895a(%rip), %rsi      # 0xca6d
callq 0x22e0
testl %eax, %eax
je 0x41be
movq %r13, %rdi
leaq 0x8969(%rip), %rsi      # 0xca93
callq 0x22e0
testl %eax, %eax
je 0x41d2
movq %r13, %rdi
leaq 0x8958(%rip), %rsi      # 0xca99
callq 0x22e0
testl %eax, %eax
je 0x41e2
movq %r13, %rdi
leaq 0x8948(%rip), %rsi      # 0xcaa0
callq 0x22e0
testl %eax, %eax
je 0x4204
movq %r13, %rdi
leaq 0x8937(%rip), %rsi      # 0xcaa6
callq 0x22e0
testl %eax, %eax
je 0x4218
movq %r13, %rdi
leaq 0x8926(%rip), %rsi      # 0xcaac
callq 0x22e0
testl %eax, %eax
jne 0x41f3
movb $0x1, 0x2(%r14)
jmp 0x41f3
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x4(%r14)
jmp 0x41f3
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x8(%r14)
jmp 0x41f3
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0xc(%r14)
jmp 0x41f3
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x8(%rsp), %rcx
jmp 0x41f0
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
incl %r12d
cmpl %ebp, %r12d
jl 0x40d4
jmp 0x40bf
leal 0x1(%r15), %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2330
movl %eax, 0x30(%r14)
jmp 0x41f3
movl $0x2, 0x38(%r14)
jmp 0x41f3
nop