// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Parser.cpp
// Function: Parser::Parser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char**)
Parser::Parser(string configFile, char** envp) {

	/*while (*envp) {
		string envEntry = *envp;
		size_t pos = envEntry.find('=');
		if (pos != string::npos) {
			string name = envEntry.substr(0, pos);
			string value = envEntry.substr(pos+1, string::npos);
			envSymbols[name] = value;
			logDebug(cout << "environment symbol: '" << name << "' = '" << value << "'" << endl);
		}
		++envp;
	}*/

	debugInfo = configFile;
	groupStack.push_front(this);

	FILE* in = fopen(configFile.c_str(), "r");
	if (!in) {
		cerr << "cannot open input file '" << configFile << "'" << endl;
		exit(2);
	}

	char buff[1024];
	while (fgets(buff, 1024, in)) {

		string line=buff;
		if ( (line.length() > 2) && (line[0] != '#') && (line.find(')') == string::npos) ) {
			string name;
			string value;
			split(line, name, value, '=');

			if (value == "(") {
				//logDebug(cout << "   config: new group '" << name << "'" << endl);
				Parser* newGroup = new Parser(name, debugInfo);
				groupStack.front()->groups[name] = newGroup;
				groupStack.push_front(newGroup);
			} else {
				for (list<Parser*>::reverse_iterator i = groupStack.rbegin(); i != groupStack.rend(); ++i) {
					(*i)->symbolExpand(value);
				}
				envSymbolExpand(value);
				//logDebug(cout << "   config: name = '" << name << "', value = '" << value << "'" << endl);
				groupStack.front()->add(name, value);
			}
		}
		if ( (line.length() > 0) && (line[0] != '#') && (line.find(')') != string::npos) ) {
			//logDebug(cout << "   end of group" << endl);
			groupStack.pop_front();
		}
	}

	fclose(in);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rcx, 0x28(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, 0x70(%rsp)
leaq 0x38(%rdi), %rax
movl %ecx, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movq %rcx, 0x58(%rdi)
leaq 0x68(%rdi), %rax
movl %ecx, 0x68(%rdi)
movq %rcx, 0x70(%rdi)
movq %rax, 0x78(%rdi)
movq %rax, 0x80(%rdi)
movq %rcx, 0x88(%rdi)
leaq 0x90(%rdi), %r14
movq %r14, 0x98(%rdi)
movq %r14, 0x90(%rdi)
movq %rcx, 0xa0(%rdi)
leaq 0xa8(%rdi), %r15
leaq 0xb8(%rdi), %rax
movq %rax, 0x68(%rsp)
movq %rax, 0xa8(%rdi)
movq %rcx, 0xb0(%rdi)
movb $0x0, 0xb8(%rdi)
movq %r15, %rdi
movq %r15, 0x118(%rsp)
callq 0x22500
movq (%r14), %r15
movl $0x18, %edi
callq 0x22980
movq %rbx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x220d0
incq 0xa0(%rbx)
movq (%r13), %rdi
leaq 0xacea0(%rip), %rsi     # 0xff293
callq 0x22b10
testq %rax, %rax
je 0x5280e
movq %rax, %r12
leaq 0x120(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x23000
testq %rax, %rax
je 0x527f4
leaq 0x120(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %r13, %rdi
callq 0x223a0
leaq (%rsp,%rax), %rdx
addq $0x120, %rdx            # imm = 0x120
movq %rbp, %rdi
movq %r13, %rsi
callq 0x321d2
movq 0x50(%rsp), %rdx
cmpq $0x3, %rdx
jb 0x52778
movq 0x48(%rsp), %rax
cmpb $0x23, (%rax)
je 0x5277d
movq %rbp, %rdi
movl $0x29, %esi
xorl %edx, %edx
callq 0x22c80
movq 0x50(%rsp), %rdx
cmpq $-0x1, %rax
jne 0x52778
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
movb %cl, 0x38(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movb %cl, 0x18(%rsp)
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0x48(%rsp), %rsi
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x3213c
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movl $0x3d, %r8d
callq 0x52a00
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x52524
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x8(%rsp), %rdi
leaq 0xa5eb4(%rip), %rsi     # 0xf83e4
callq 0x22250
testl %eax, %eax
je 0x52631
movq %r14, %r15
cmpq (%r14), %r14
je 0x52560
movq 0x8(%r15), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
callq 0x52db2
movq 0x8(%r15), %r15
cmpq (%r14), %r15
jne 0x52545
movq 0x70(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x52db2
movq (%r14), %rax
movq 0x10(%rax), %r15
leaq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0x3213c
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x3213c
movq %r15, %rdi
leaq 0x98(%rsp), %rsi
callq 0x532ca
movq %rax, %rdi
leaq 0x78(%rsp), %rsi
callq 0x22500
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x52603
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x5273b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x5273b
movl $0xc8, %edi
callq 0x22980
movq %rax, (%rsp)
leaq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0x3213c
leaq 0x108(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xa8(%rbx), %rsi
movq 0xb0(%rbx), %rdx
addq %rsi, %rdx
leaq 0xf8(%rsp), %r15
movq %r15, %rdi
callq 0x3213c
movq (%rsp), %rdi
leaq 0xb8(%rsp), %rsi
movq %r15, %rdx
callq 0x5211c
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x526d3
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x526f8
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x229c0
movq (%r14), %rax
movq 0x10(%rax), %rdi
addq $0x60, %rdi
leaq 0x28(%rsp), %rsi
callq 0x5324e
movq (%rsp), %rcx
movq %rcx, (%rax)
movq (%r14), %r15
movl $0x18, %edi
callq 0x22980
movq (%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x220d0
incq 0xa0(%rbx)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x52757
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x52773
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x50(%rsp), %rdx
testq %rdx, %rdx
je 0x527bf
movq 0x48(%rsp), %rax
cmpb $0x23, (%rax)
je 0x527bf
movq %rbp, %rdi
movl $0x29, %esi
xorl %edx, %edx
callq 0x22c80
cmpq $-0x1, %rax
je 0x527bf
movq 0x90(%rbx), %r15
decq 0xa0(%rbx)
movq %r15, %rdi
callq 0x230a0
movl $0x18, %esi
movq %r15, %rdi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x527db
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r12, %rdx
callq 0x23000
testq %rax, %rax
jne 0x5242f
movq %r12, %rdi
callq 0x22970
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1237db(%rip), %rdi    # 0x175ff0
leaq 0xa5a30(%rip), %rsi     # 0xf824c
movl $0x18, %edx
callq 0x22ab0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0x1237bb(%rip), %rdi    # 0x175ff0
callq 0x22ab0
movq %rax, %r15
leaq 0xa1473(%rip), %rsi     # 0xf3cb7
movl $0x1, %edx
movq %rax, %rdi
callq 0x22ab0
movq %r15, %rdi
callq 0x22430
movl $0x2, %edi
callq 0x22b90
movq %rax, %r15
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x52890
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x52890
movq %rax, %r15
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x528ba
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x528ba
movq %rax, %r15
movl $0xc8, %esi
movq (%rsp), %rdi
jmp 0x52939
jmp 0x52942
jmp 0x52942
jmp 0x52942
movq %rax, %r15
jmp 0x52919
movq %rax, %r15
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x5294a
movq 0xe8(%rsp), %rsi
jmp 0x52936
jmp 0x52947
movq %rax, %r15
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x52919
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x5294a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x5294a
jmp 0x52947
movq %rax, %r15
jmp 0x5299e
movq %rax, %r15
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x52966
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x52982
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x5299e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x118(%rsp), %rax
movq (%rax), %rdi
cmpq 0x68(%rsp), %rdi
je 0x529c0
movq 0x68(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x229c0
movq (%r14), %rdi
cmpq %r14, %rdi
je 0x529dd
movq (%rdi), %r12
movl $0x18, %esi
callq 0x229c0
movq %r12, %rdi
cmpq %r14, %r12
jne 0x529c8
leaq 0x60(%rbx), %rdi
callq 0x53346
movq 0x70(%rsp), %rdi
callq 0x341ac
movq %rbx, %rdi
callq 0x341ac
movq %r15, %rdi
callq 0x23240