// File: /workspace/github_cpp_makefile_star2_O2/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
orq $-0x1, 0x4(%rdi)
movl $0x3, 0xc(%rdi)
movb $0x1, 0x10(%rdi)
movl $0xa, 0x14(%rdi)
andw $0x0, 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq $0x36ee80, 0x30(%rdi)   # imm = 0x36EE80
movw $0x1, (%rdi)
andl $0x0, 0x38(%rdi)
movb $0x0, 0x2(%rdi)
cmpl $0x2, %esi
jl 0x2f2a
movq %rdi, %r14
movq %rdx, %rbx
movl %esi, %ebp
movq 0x8(%rdx), %r15
leaq 0x7beb(%rip), %rsi      # 0xaa5a
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x2f2a
leaq 0x20(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x71d7(%rip), %rsi      # 0xa066
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x2f3d
leaq 0x28(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x71bf(%rip), %rsi      # 0xa06e
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x30ae
leaq 0x71ad(%rip), %rsi      # 0xa073
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x3105
leaq 0x719e(%rip), %rsi      # 0xa07b
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x315c
leaq 0x7190(%rip), %rsi      # 0xa084
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x31b3
leaq 0x7182(%rip), %rsi      # 0xa08d
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x32ff
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2939
pushq $0x2
popq %r12
cmpl %ebp, %r12d
jge 0x2f1b
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x7b09(%rip), %rsi      # 0xaa60
callq 0x22d0
testl %eax, %eax
je 0x301a
movq %r13, %rdi
leaq 0x7af7(%rip), %rsi      # 0xaa65
callq 0x22d0
testl %eax, %eax
je 0x302d
movq %r13, %rdi
leaq 0x7ae8(%rip), %rsi      # 0xaa6d
callq 0x22d0
testl %eax, %eax
je 0x3040
movq %r13, %rdi
leaq 0x7add(%rip), %rsi      # 0xaa79
callq 0x22d0
testl %eax, %eax
je 0x3053
movq %r13, %rdi
leaq 0x7acb(%rip), %rsi      # 0xaa7e
callq 0x22d0
testl %eax, %eax
je 0x3069
movq %r13, %rdi
leaq 0x7abc(%rip), %rsi      # 0xaa86
callq 0x22d0
testl %eax, %eax
je 0x307c
movq %r13, %rdi
leaq 0x7aac(%rip), %rsi      # 0xaa8d
callq 0x22d0
testl %eax, %eax
je 0x3092
movq %r13, %rdi
leaq 0x7a9b(%rip), %rsi      # 0xaa93
callq 0x22d0
testl %eax, %eax
jne 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x4(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x8(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0xc(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
testl %eax, %eax
setne 0x10(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x14(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
testl %eax, %eax
setne 0x18(%r14)
jmp 0x30a6
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
testl %eax, %eax
setne 0x19(%r14)
incl %r12d
jmp 0x2f41
pushq $0x2
popq %r13
leaq 0x79da(%rip), %r14      # 0xaa93
cmpl %ebp, %r13d
jge 0x2f1b
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22d0
movq 0x10(%rsp), %rcx
testl %eax, %eax
je 0x30f5
movq %r12, %rdi
leaq 0x79b2(%rip), %rsi      # 0xaa99
callq 0x22d0
movq 0x8(%rsp), %rcx
testl %eax, %eax
jne 0x3100
incl %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
jmp 0x30b9
pushq $0x2
popq %r13
leaq 0x7983(%rip), %r14      # 0xaa93
cmpl %ebp, %r13d
jge 0x2f1b
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22d0
movq 0x10(%rsp), %rcx
testl %eax, %eax
je 0x314c
movq %r12, %rdi
leaq 0x795b(%rip), %rsi      # 0xaa99
callq 0x22d0
movq 0x8(%rsp), %rcx
testl %eax, %eax
jne 0x3157
incl %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
jmp 0x3110
pushq $0x2
popq %r13
leaq 0x792c(%rip), %r14      # 0xaa93
cmpl %ebp, %r13d
jge 0x2f1b
movslq %r13d, %r15
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22d0
movq 0x10(%rsp), %rcx
testl %eax, %eax
je 0x31a3
movq %r12, %rdi
leaq 0x7904(%rip), %rsi      # 0xaa99
callq 0x22d0
movq 0x8(%rsp), %rcx
testl %eax, %eax
jne 0x31ae
incl %r13d
movq 0x8(%rbx,%r15,8), %rax
movq %rax, (%rcx)
incl %r13d
jmp 0x3167
pushq $0x2
popq %r12
cmpl %ebp, %r12d
jge 0x2f1b
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x788f(%rip), %rsi      # 0xaa60
callq 0x22d0
testl %eax, %eax
je 0x3282
movq %r13, %rdi
leaq 0x787d(%rip), %rsi      # 0xaa65
callq 0x22d0
testl %eax, %eax
je 0x3295
movq %r13, %rdi
leaq 0x786e(%rip), %rsi      # 0xaa6d
callq 0x22d0
testl %eax, %eax
je 0x32a8
movq %r13, %rdi
leaq 0x787d(%rip), %rsi      # 0xaa93
callq 0x22d0
testl %eax, %eax
je 0x32bb
movq %r13, %rdi
leaq 0x786c(%rip), %rsi      # 0xaa99
callq 0x22d0
testl %eax, %eax
je 0x32ca
movq %r13, %rdi
leaq 0x785c(%rip), %rsi      # 0xaaa0
callq 0x22d0
testl %eax, %eax
je 0x32e2
movq %r13, %rdi
leaq 0x784b(%rip), %rsi      # 0xaaa6
callq 0x22d0
testl %eax, %eax
je 0x32f5
movq %r13, %rdi
leaq 0x783a(%rip), %rsi      # 0xaaac
callq 0x22d0
testl %eax, %eax
jne 0x32da
movb $0x1, 0x2(%r14)
jmp 0x32da
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x4(%r14)
jmp 0x32da
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x8(%r14)
jmp 0x32da
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0xc(%r14)
jmp 0x32da
incl %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x10(%rsp), %rcx
jmp 0x32d7
incl %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
incl %r12d
jmp 0x31b7
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x30(%r14)
jmp 0x32da
movl $0x2, 0x38(%r14)
jmp 0x32da
pushq $0x2
popq %r12
movl $0x0, 0x8(%rsp)
cmpl %ebp, %r12d
jge 0x2f1b
movslq %r12d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x7790(%rip), %rsi      # 0xaab5
callq 0x22d0
testl %eax, %eax
je 0x343e
movq %r13, %rdi
leaq 0x7770(%rip), %rsi      # 0xaaac
callq 0x22d0
testl %eax, %eax
je 0x3451
movq %r13, %rdi
leaq 0x776b(%rip), %rsi      # 0xaabe
callq 0x22d0
testl %eax, %eax
je 0x3458
movq %r13, %rdi
leaq 0x7758(%rip), %rsi      # 0xaac2
callq 0x22d0
testl %eax, %eax
je 0x3464
movq %r13, %rdi
leaq 0x7748(%rip), %rsi      # 0xaac9
callq 0x22d0
testl %eax, %eax
je 0x3470
movq %r13, %rdi
leaq 0x770e(%rip), %rsi      # 0xaaa6
callq 0x22d0
testl %eax, %eax
je 0x347c
movq %r13, %rdi
leaq 0x76ea(%rip), %rsi      # 0xaa99
callq 0x22d0
testl %eax, %eax
je 0x3493
movq %r13, %rdi
leaq 0x769a(%rip), %rsi      # 0xaa60
callq 0x22d0
testl %eax, %eax
je 0x3499
movq %r13, %rdi
leaq 0x7688(%rip), %rsi      # 0xaa65
callq 0x22d0
testl %eax, %eax
je 0x34ac
movq %r13, %rdi
leaq 0x7679(%rip), %rsi      # 0xaa6d
callq 0x22d0
testl %eax, %eax
je 0x34bf
movq %r13, %rdi
leaq 0x7688(%rip), %rsi      # 0xaa93
callq 0x22d0
testl %eax, %eax
je 0x34d2
movq %r13, %rdi
leaq 0x767e(%rip), %rsi      # 0xaaa0
callq 0x22d0
testl %eax, %eax
jne 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x30(%r14)
jmp 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x34(%r14)
jmp 0x348b
movb $0x1, 0x2(%r14)
jmp 0x348b
movb $0x1, 0x1(%r14)
cmpl $0x0, 0x8(%rsp)
jne 0x348b
movl $0x1, 0x38(%r14)
pushq $0x1
jmp 0x3486
movl $0x3, 0x38(%r14)
pushq $0x3
jmp 0x3486
movl $0x2, 0x38(%r14)
pushq $0x2
popq %rax
movl %eax, 0x8(%rsp)
incl %r12d
jmp 0x330b
movb $0x1, (%r14)
jmp 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x4(%r14)
jmp 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0x8(%r14)
jmp 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rdi
callq 0x2320
movl %eax, 0xc(%r14)
jmp 0x348b
incl %r12d
movq 0x8(%rbx,%r15,8), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x348b