// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]optimal-seed-solver/HashTree.cc
// Function: HashTree::test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void HashTree::test(string DNA) {
	hashVal = hashgen.calculateHash(DNA, hashLength);

	queryCursor = root[hashVal];

	if (queryCursor == NULL) {
		cout << "NULL pointer detected" << endl;
		cout << "DNA: " << DNA << endl;
		cout << "hashLength: " << hashLength << endl;

	}

	TreeNode* nextCursor = queryCursor;

	int i;
	//The depth depends on the length of the string: DNA
	for (i = hashLength; i < DNA.length(); i++) {
		cout << "TreeNode: " << DNA.substr(0, i)
			<< " of frequency: " << queryCursor->getLocNum()
			<< " from chromosome: " << queryCursor->getChrNum()
			<< " at location: " << queryCursor->getLocation()
			<< " isLeaf: " << queryCursor->isLeaf() << endl;

		if (!queryCursor->isLeaf() ) {
			switch (DNA[i]) {
				case 'A':
					nextCursor = queryCursor->getA();
					break;
				case 'C':
					nextCursor = queryCursor->getC();
					break;
				case 'G':
					nextCursor = queryCursor->getG();
					break;
				case 'T':
					nextCursor = queryCursor->getT();
					break;
				default:
					cerr << "unrecognized character: " << DNA[i] << endl;
					break;
			}
		}

		queryCursor = nextCursor;

		if (queryCursor == NULL || queryCursor->isLeaf() )
			break;
	}

	cout << "LastNode: " << DNA.substr(0, i);
		if (queryCursor != NULL)
			cout << " of frequency: " << queryCursor->getLocNum()
				<< " from chromosome: " << queryCursor->getChrNum()
				<< " at location: " << queryCursor->getLocation()
				<< " isLeaf: " << queryCursor->isLeaf() << endl;
		else
			cout << " is NULL." << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x318, %rdi            # imm = 0x318
movl (%rbx), %edx
callq 0x7f8a
movl %eax, 0x340(%rbx)
movq 0x320(%rbx), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r15
movq %r15, 0x348(%rbx)
testq %r15, %r15
jne 0x5d15
movq 0x8314(%rip), %r15      # 0xdfc8
leaq 0x3601(%rip), %rsi      # 0x92bc
movq %r15, %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3120
leaq 0x3600(%rip), %rsi      # 0x92d2
movq %r15, %rdi
callq 0x3220
movq %rax, %rdi
movq %r14, %rsi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x35e4(%rip), %rsi      # 0x92d8
movq %r15, %rdi
callq 0x3220
movl (%rbx), %esi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
callq 0x3120
movq 0x348(%rbx), %r15
movslq (%rbx), %rcx
leaq 0x8(%rsp), %r13
movq %rcx, %r12
cmpq %rcx, 0x8(%r14)
jbe 0x5ec4
movq 0x8297(%rip), %rdi      # 0xdfc8
leaq 0x35ad(%rip), %rsi      # 0x92e5
callq 0x3220
movq %rax, %rbp
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x3250
movq %rbp, %rdi
movq %r13, %rsi
callq 0x31f0
movq %rax, %rdi
leaq 0x358b(%rip), %rsi      # 0x92f0
callq 0x3220
movq 0x348(%rbx), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
callq 0x3190
movq %rax, %rdi
leaq 0x357a(%rip), %rsi      # 0x9300
callq 0x3220
movq %rax, %rbp
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, %esi
movq %rbp, %rdi
callq 0x3190
movq %rax, %rdi
leaq 0x3564(%rip), %rsi      # 0x9313
callq 0x3220
movq %rax, %rbp
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %esi
movq %rbp, %rdi
callq 0x3190
movq %rax, %rdi
leaq 0x354a(%rip), %rsi      # 0x9322
callq 0x3220
movq %rax, %rbp
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movzbl %al, %esi
movq %rbp, %rdi
callq 0x33e0
movq %rax, %rdi
callq 0x3120
movq %r13, %rdi
callq 0x3110
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
je 0x5e44
movq %r15, 0x348(%rbx)
testq %r15, %r15
je 0x5ec4
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
leaq 0x1(%r12), %rcx
testb %al, %al
je 0x5d1d
jmp 0x5ec4
movq (%r14), %rax
movzbl (%rax,%r12), %eax
cmpl $0x41, %eax
je 0x5e87
cmpl $0x43, %eax
je 0x5e6d
cmpl $0x47, %eax
je 0x5e7a
cmpl $0x54, %eax
jne 0x5e94
movq 0x348(%rbx), %rax
movq 0x30(%rax), %r15
jmp 0x5e19
movq 0x348(%rbx), %rax
movq 0x20(%rax), %r15
jmp 0x5e19
movq 0x348(%rbx), %rax
movq 0x28(%rax), %r15
jmp 0x5e19
movq 0x348(%rbx), %rax
movq 0x18(%rax), %r15
jmp 0x5e19
movq 0x8155(%rip), %rdi      # 0xdff0
leaq 0x3334(%rip), %rsi      # 0x91d6
callq 0x3220
movq (%r14), %rcx
movsbl (%rcx,%r12), %esi
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3120
jmp 0x5e19
movq 0x80fd(%rip), %rdi      # 0xdfc8
leaq 0x345a(%rip), %rsi      # 0x932c
callq 0x3220
movq %rax, %r15
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x3250
movq %r15, %rdi
movq %r13, %rsi
callq 0x31f0
leaq 0x8(%rsp), %rdi
callq 0x3110
cmpq $0x0, 0x348(%rbx)
je 0x5fb5
movq 0x80af(%rip), %rdi      # 0xdfc8
leaq 0x33d0(%rip), %rsi      # 0x92f0
callq 0x3220
movq 0x348(%rbx), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
callq 0x3190
leaq 0x33c2(%rip), %rsi      # 0x9300
movq %rax, %rdi
callq 0x3220
movq %rax, %r14
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, %esi
movq %r14, %rdi
callq 0x3190
leaq 0x33ac(%rip), %rsi      # 0x9313
movq %rax, %rdi
callq 0x3220
movq %rax, %r14
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %esi
movq %r14, %rdi
callq 0x3190
leaq 0x3392(%rip), %rsi      # 0x9322
movq %rax, %rdi
callq 0x3220
movq %rax, %r14
movq 0x348(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movzbl %al, %esi
movq %r14, %rdi
callq 0x33e0
jmp 0x5fc8
movq 0x800c(%rip), %rdi      # 0xdfc8
leaq 0x3374(%rip), %rsi      # 0x9337
callq 0x3220
movq %rax, %rdi
callq 0x3120
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5fe1
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3430