// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]optimal-seed-solver/HashTree.cc
// Function: HashTree::generateTree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void HashTree::generateTree(string refName) {
	refdb.loadRefFile(refName);

	//Load all databases. This only works for 1TB machine.
	checkdb = new RefDB[refdb.getNumOfChromo()];
	for (int i = 0; i < static_cast<int>(refdb.getNumOfChromo() ); i++) {
		checkdb[i].loadRefFile(refName);
		checkdb[i].loadChromo(i);
	}

	string DNA;

	for (unsigned int chromoIter = 0; chromoIter < refdb.getNumOfChromo(); chromoIter++) {
		refdb.loadChromo(chromoIter);

		for (unsigned int location = 0; location < refdb.getChromoLength() - hashLength; location++){
			DNA = refdb.getRefSeq(location, fullLength);
			if (DNA.find('N') == string::npos)
				checkDouble(DNA, chromoIter, location);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq 0xa8(%rdi), %r14
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %rsi, 0x10(%rsp)
callq 0x3340
movq %r14, %rdi
movq %r12, %rsi
callq 0x7728
leaq 0x38(%rsp), %rdi
callq 0x3110
movq %r14, %rdi
callq 0x7b36
movl %eax, %ebp
movl %eax, %r15d
imulq $0x268, %r15, %rdi      # imm = 0x268
addq $0x8, %rdi
movq %rdi, 0x8(%rsp)
callq 0x3030
movq %r15, (%rax)
movq %rax, (%rsp)
leaq 0x8(%rax), %r13
testl %ebp, %ebp
je 0x4f07
imulq $-0x268, %r15, %r12     # imm = 0xFD98
xorl %r15d, %r15d
movq %r13, %rbp
movq %rbp, %rdi
callq 0x7698
addq $-0x268, %r15           # imm = 0xFD98
addq $0x268, %rbp            # imm = 0x268
cmpq %r15, %r12
jne 0x4eec
movq %r13, 0x310(%rbx)
xorl %r15d, %r15d
leaq 0x58(%rsp), %r12
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x7b36
cltq
cmpq %rax, %r13
jge 0x4f70
movq 0x310(%rbx), %rbp
addq %r15, %rbp
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x3340
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7728
movq %r12, %rdi
callq 0x3110
movq 0x310(%rbx), %rdi
addq %r15, %rdi
movl %r13d, %esi
callq 0x799c
incq %r13
addq $0x268, %r15            # imm = 0x268
jmp 0x4f19
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x78(%rsp), %r12
leaq 0x18(%rsp), %r13
movq %r14, %rdi
callq 0x7b36
cmpl %eax, %ebp
jae 0x5005
movq %r14, %rdi
movl %ebp, %esi
callq 0x799c
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x7b2e
subl (%rbx), %eax
cmpl %eax, %r15d
jae 0x5001
movl 0x4(%rbx), %ecx
movq %r12, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x7b60
movq %r13, %rdi
movq %r12, %rsi
callq 0x32b0
movq %r12, %rdi
callq 0x3110
movq %r13, %rdi
pushq $0x4e
popq %rsi
xorl %edx, %edx
callq 0x3300
cmpq $-0x1, %rax
jne 0x4ffc
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x4d6e
incl %r15d
jmp 0x4fa6
incl %ebp
jmp 0x4f8d
leaq 0x18(%rsp), %rdi
callq 0x3110
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x5079
movq %rax, %rbx
testq %r15, %r15
je 0x5053
negq %r15
movq (%rsp), %r14
addq $-0x260, %r14           # imm = 0xFDA0
leaq (%r14,%r15), %rdi
callq 0x76f6
addq $-0x268, %r15           # imm = 0xFD98
jne 0x5041
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3460
jmp 0x507e
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
jmp 0x5079
jmp 0x5071
jmp 0x5071
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3430