// File: FreeSlave[P]vhlt/common/cmdlinecfg.cpp
// Function: parsecommand(execute_t&, char*, char*, unsigned int)
void parsecommand (execute_t &e, char *cmdline, char *words, unsigned int n)
{
	command_t t;
	if (!pvalid (words))
		return;
	if (pmatch (words, "#ifdef" SEPSTR))
		t = IFDEF;
	else if (pmatch (words, "#ifndef" SEPSTR))
		t = IFNDEF;
	else if (pmatch (words, "#else" SEPSTR))
		t = ELSE;
	else if (pmatch (words, "#endif" SEPSTR))
		t = ENDIF;
	else if (pmatch (words, "#define" SEPSTR))
		t = DEFINE;
	else if (pmatch (words, "#undef" SEPSTR))
		t = UNDEF;
	else
		return;
	if (t == IFDEF || t == IFNDEF)
	{
		e.stack ++;
		if (!e.skip)
		{
			if (t == IFDEF && findparams (cmdline, pnext (words)) ||
				t == IFNDEF && !findparams (cmdline, pnext (words)))
				e.skip = false;
			else
			{
				e.skipstack = e.stack;
				e.skip = true;
			}
		}
	}
	else if (t == ELSE)
	{
		if (e.skip)
		{
			if (e.stack == e.skipstack)
				e.skip = false;
		}
		else
		{
			e.skipstack = e.stack;
			e.skip = true;
		}
	}
	else if (t == ENDIF)
	{
		if (e.skip)
		{
			if (e.stack == e.skipstack)
				e.skip = false;
		}
		e.stack --;
	}
	else
	{
		if (!e.skip)
		{
			if (t == DEFINE)
				addparams (cmdline, pnext(words), n);
			if (t == UNDEF)
				delparams (cmdline, pnext(words));
		}
	}
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %ecx, 0x2c(%rsp)
movq 0x30(%rsp), %rdi
callq 0x9df0
testb $0x1, %al
jne 0xa28a
jmp 0xa506
movq 0x30(%rsp), %rdi
leaq 0x205d2(%rip), %rsi     # 0x2a868
callq 0x9e10
testb $0x1, %al
jne 0xa2a1
jmp 0xa2ae
movl $0x0, 0x28(%rsp)
jmp 0xa365
movq 0x30(%rsp), %rdi
leaq 0x205b6(%rip), %rsi     # 0x2a870
callq 0x9e10
testb $0x1, %al
jne 0xa2c5
jmp 0xa2d2
movl $0x1, 0x28(%rsp)
jmp 0xa363
movq 0x30(%rsp), %rdi
leaq 0x2059b(%rip), %rsi     # 0x2a879
callq 0x9e10
testb $0x1, %al
jne 0xa2e9
jmp 0xa2f3
movl $0x2, 0x28(%rsp)
jmp 0xa361
movq 0x30(%rsp), %rdi
leaq 0x20581(%rip), %rsi     # 0x2a880
callq 0x9e10
testb $0x1, %al
jne 0xa30a
jmp 0xa314
movl $0x3, 0x28(%rsp)
jmp 0xa35f
movq 0x30(%rsp), %rdi
leaq 0x20568(%rip), %rsi     # 0x2a888
callq 0x9e10
testb $0x1, %al
jne 0xa32b
jmp 0xa335
movl $0x4, 0x28(%rsp)
jmp 0xa35d
movq 0x30(%rsp), %rdi
leaq 0x20550(%rip), %rsi     # 0x2a891
callq 0x9e10
testb $0x1, %al
jne 0xa34c
jmp 0xa356
movl $0x5, 0x28(%rsp)
jmp 0xa35b
jmp 0xa506
jmp 0xa35d
jmp 0xa35f
jmp 0xa361
jmp 0xa363
jmp 0xa365
cmpl $0x0, 0x28(%rsp)
je 0xa377
cmpl $0x1, 0x28(%rsp)
jne 0xa418
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x40(%rsp), %rax
testb $0x1, 0x4(%rax)
jne 0xa413
cmpl $0x0, 0x28(%rsp)
jne 0xa3c0
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa010
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xa050
cmpq $0x0, %rax
jne 0xa3ee
cmpl $0x1, 0x28(%rsp)
jne 0xa3f9
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa010
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xa050
cmpq $0x0, %rax
jne 0xa3f9
movq 0x40(%rsp), %rax
movb $0x0, 0x4(%rax)
jmp 0xa411
movq 0x40(%rsp), %rax
movl (%rax), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x40(%rsp), %rax
movb $0x1, 0x4(%rax)
jmp 0xa413
jmp 0xa506
cmpl $0x2, 0x28(%rsp)
jne 0xa463
movq 0x40(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0xa446
movq 0x40(%rsp), %rax
movl (%rax), %eax
movq 0x40(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jne 0xa444
movq 0x40(%rsp), %rax
movb $0x0, 0x4(%rax)
jmp 0xa45e
movq 0x40(%rsp), %rax
movl (%rax), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x40(%rsp), %rax
movb $0x1, 0x4(%rax)
jmp 0xa504
cmpl $0x3, 0x28(%rsp)
jne 0xa49f
movq 0x40(%rsp), %rax
testb $0x1, 0x4(%rax)
je 0xa491
movq 0x40(%rsp), %rax
movl (%rax), %eax
movq 0x40(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jne 0xa48f
movq 0x40(%rsp), %rax
movb $0x0, 0x4(%rax)
jmp 0xa491
movq 0x40(%rsp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
jmp 0xa502
movq 0x40(%rsp), %rax
testb $0x1, 0x4(%rax)
jne 0xa500
cmpl $0x4, 0x28(%rsp)
jne 0xa4d6
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa010
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movl 0x2c(%rsp), %edx
callq 0xa130
cmpl $0x5, 0x28(%rsp)
jne 0xa4fe
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa010
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xa190
jmp 0xa500
jmp 0xa502
jmp 0xa504
jmp 0xa506
addq $0x48, %rsp
retq
nopl (%rax,%rax)