// File: /workspace/github_cpp_makefile_star2_O3/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 0x41dc
movq %r14, %rdi
movq %r12, %rsi
callq 0x803e
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x5533
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x8676
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 0x5591
imulq $-0x268, %r12, %r12     # imm = 0xFD98
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x7f7c
addq $-0x268, %r13           # imm = 0xFD98
addq $0x268, %rbp            # imm = 0x268
cmpq %r13, %r12
jne 0x5576
movq 0x8(%rsp), %rax
movq %rax, 0x310(%rbx)
movq %r14, %rdi
callq 0x8676
testl %eax, %eax
jle 0x5635
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 0x41dc
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x803e
movq 0x38(%rsp), %rdi
movq %rbp, %r15
cmpq %rbp, %rdi
je 0x5607
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x310(%rbx), %rdi
addq %r12, %rdi
movl %r13d, %esi
callq 0x841e
incq %r13
movq %r14, %rdi
callq 0x8676
cltq
addq $0x268, %r12            # imm = 0x268
cmpq %rax, %r13
movq %r15, %rbp
jl 0x55b8
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 0x8676
cmpl %eax, %r15d
jae 0x56f0
movq %r14, %rdi
movl %r15d, %esi
callq 0x841e
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x866e
subl (%rbx), %eax
cmpl %eax, %ebp
jae 0x56e8
movl 0x4(%rbx), %ecx
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x86b4
movq %r13, %rdi
movq %r12, %rsi
callq 0x3300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x56bf
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r13, %rdi
movl $0x4e, %esi
xorl %edx, %edx
callq 0x3340
cmpq $-0x1, %rax
jne 0x56e4
movq %rbx, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x53ce
incl %ebp
jmp 0x5674
incl %r15d
jmp 0x5656
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x570c
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 0x579f
movq 0x68(%rsp), %rsi
jmp 0x5797
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x579f
movq 0x48(%rsp), %rsi
jmp 0x5797
movq %rax, %rbx
testq %r13, %r13
je 0x576e
negq %r13
movq (%rsp), %r14
addq $-0x260, %r14           # imm = 0xFDA0
leaq (%r14,%r13), %rdi
callq 0x7fda
addq $-0x268, %r13           # imm = 0xFD98
jne 0x575c
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x3490
jmp 0x579f
jmp 0x5780
jmp 0x5780
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x579f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
nop