// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %rax
movq %rdi, %rbx
leaq 0xa8(%rdi), %r14
leaq 0x68(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rsi), %rsi
movq %rax, 0x10(%rsp)
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0x41d6
movq %r14, %rdi
movq %r12, %rsi
callq 0x8092
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x557d
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x86b6
movl %eax, %ebp
movl %eax, %r12d
imulq $0x268, %r12, %r15      # imm = 0x268
addq $0x8, %r15
movq %r15, %rdi
callq 0x3030
movq %r12, (%rax)
movq %rax, (%rsp)
addq $0x8, %rax
movq %rax, 0x8(%rsp)
testl %ebp, %ebp
je 0x55db
imulq $-0x268, %r12, %r12     # imm = 0xFD98
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x7fd0
addq $-0x268, %r13           # imm = 0xFD98
addq $0x268, %rbp            # imm = 0x268
cmpq %r13, %r12
jne 0x55c0
movq 0x8(%rsp), %rax
movq %rax, 0x310(%rbx)
movq %r14, %rdi
callq 0x86b6
testl %eax, %eax
jle 0x567f
leaq 0x48(%rsp), %rbp
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x310(%rbx), %r15
addq %r12, %r15
movq %rbp, 0x38(%rsp)
movq 0x10(%rsp), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x41d6
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x8092
movq 0x38(%rsp), %rdi
movq %rbp, %r15
cmpq %rbp, %rdi
je 0x5651
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x310(%rbx), %rdi
addq %r12, %rdi
movl %r13d, %esi
callq 0x846c
incq %r13
movq %r14, %rdi
callq 0x86b6
cltq
addq $0x268, %r12            # imm = 0x268
cmpq %rax, %r13
movq %r15, %rbp
jl 0x5602
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r15d, %r15d
leaq 0x78(%rsp), %r12
leaq 0x18(%rsp), %r13
movq %r14, %rdi
callq 0x86b6
cmpl %eax, %r15d
jae 0x573a
movq %r14, %rdi
movl %r15d, %esi
callq 0x846c
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x86ae
subl (%rbx), %eax
cmpl %eax, %ebp
jae 0x5732
movl 0x4(%rbx), %ecx
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x86f4
movq %r13, %rdi
movq %r12, %rsi
callq 0x3300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x5709
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r13, %rdi
movl $0x4e, %esi
xorl %edx, %edx
callq 0x3340
cmpq $-0x1, %rax
jne 0x572e
movq %rbx, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x5412
incl %ebp
jmp 0x56be
incl %r15d
jmp 0x56a0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5756
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x57e9
movq 0x68(%rsp), %rsi
jmp 0x57e1
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x57e9
movq 0x48(%rsp), %rsi
jmp 0x57e1
movq %rax, %rbx
testq %r13, %r13
je 0x57b8
negq %r13
movq (%rsp), %r14
addq $-0x260, %r14           # imm = 0xFDA0
leaq (%r14,%r13), %rdi
callq 0x802e
addq $-0x268, %r13           # imm = 0xFD98
jne 0x57a6
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x3490
jmp 0x57e9
jmp 0x57ca
jmp 0x57ca
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x57e9
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
nop