// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]optimal-seed-solver/hobbesSolver.cc
// Function: HobbesSolver::solveDNA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
unsigned int HobbesSolver::solveDNA(string DNA) {
	assert(DNA.length() == readLength);
	reset();

	for (int i = 0; i < readLength - seedLength + 1; i++)
	{
		string seed = DNA.substr(i, seedLength);
		tree.query(seed);
		invertedList[i] = tree.frequency();
		cout << invertedList[i];
		cout << " ";
	}

	cout << "\n";

	for (int counter = 1; counter < seedNum + 1; counter++)
	{
		dynamicMatrix[counter][0] = invertedList[(counter-1) * this->seedLength] + dynamicMatrix[counter - 1][0];
		//cout << dynamicMatrix[counter][0];
		//cout << " ";
	}
	cout << "\n";
	cout << "\n";
	for (int heightCount = 1; heightCount < seedNum + 1; heightCount++)
	{
		for (int widthCount = 1; widthCount < dynamicMatrixWidth; widthCount++)
		{
			int indexNum = (heightCount - 1) * seedLength + widthCount;
			dynamicMatrix[heightCount][widthCount] = dynamicMatrix[heightCount-1][widthCount] + invertedList[indexNum];
			if (dynamicMatrix[heightCount][widthCount-1] < dynamicMatrix[heightCount][widthCount])
				dynamicMatrix[heightCount][widthCount] = dynamicMatrix[heightCount][widthCount-1];
			cout << dynamicMatrix[heightCount][widthCount-1];
			cout << " ";			
		}
		cout << dynamicMatrix[heightCount][dynamicMatrixWidth-1];
		cout << "\n";
	}
	cout << "\n";
	cout << dynamicMatrix[seedNum][dynamicMatrixWidth-1];
	cout << "\n";
	return dynamicMatrix[seedNum][dynamicMatrixWidth-1];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movslq 0x368(%rdi), %rax
cmpq %rax, 0x8(%rsi)
jne 0x4c5d
movq %rsi, %r14
movq %rdi, %rbx
movq 0x360(%rdi), %rax
movq 0x380(%rdi), %rsi
movq (%rax), %rdi
movslq 0x388(%rbx), %rax
movslq 0x36c(%rbx), %rdx
incq %rdx
imulq %rax, %rdx
callq 0x3200
movq 0x358(%rbx), %rdi
movq 0x378(%rbx), %rsi
movl 0x368(%rbx), %eax
subl 0x370(%rbx), %eax
incl %eax
movslq %eax, %rdx
callq 0x3200
movl 0x370(%rbx), %eax
cmpl %eax, 0x368(%rbx)
jl 0x4a64
leaq 0x38(%rsp), %r12
xorl %r15d, %r15d
leaq 0x28(%rsp), %r13
movq 0x9626(%rip), %rbp      # 0xdfc8
movslq %eax, %rcx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3290
movq %r12, 0x28(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x41d6
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x5d96
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x49f6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x5f34
movq 0x358(%rbx), %rcx
movl %eax, (%rcx,%r15,4)
movq %rbp, %rdi
movl %eax, %esi
callq 0x3430
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x599c(%rip), %rsi      # 0xa3be
callq 0x32d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4a43
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x1(%r15), %rcx
movslq 0x368(%rbx), %rdx
movslq 0x370(%rbx), %rax
subq %rax, %rdx
cmpq %rdx, %r15
movq %rcx, %r15
jl 0x49a2
movq 0x955d(%rip), %rdi      # 0xdfc8
leaq 0x55f4(%rip), %rsi      # 0xa066
movl $0x1, %edx
callq 0x32d0
cmpl $0x0, 0x36c(%rbx)
jle 0x4ac0
movq 0x358(%rbx), %rax
movq 0x360(%rbx), %rcx
xorl %edx, %edx
movslq 0x370(%rbx), %rsi
imulq %rdx, %rsi
movq (%rcx,%rdx,8), %rdi
movq 0x8(%rcx,%rdx,8), %r8
movl (%rdi), %edi
addl (%rax,%rsi,4), %edi
movl %edi, (%r8)
movslq 0x36c(%rbx), %rsi
incq %rdx
cmpq %rsi, %rdx
jl 0x4a95
movq 0x9501(%rip), %r14      # 0xdfc8
leaq 0x5598(%rip), %r15      # 0xa066
movl $0x1, %r13d
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
cmpl $0x0, 0x36c(%rbx)
jle 0x4bde
xorl %ebp, %ebp
movq 0x94be(%rip), %r14      # 0xdfc8
leaq 0x58ad(%rip), %r15      # 0xa3be
leaq 0x554e(%rip), %r12      # 0xa066
movl 0x388(%rbx), %eax
cmpl $0x2, %eax
jl 0x4b9c
movl $0x1, %r12d
movl %ebp, 0x4(%rsp)
movslq %ebp, %rbp
movslq 0x370(%rbx), %rax
imulq %rbp, %rax
movq 0x358(%rbx), %rcx
movq 0x360(%rbx), %rdx
addq %r12, %rax
movl (%rcx,%rax,4), %eax
movq -0x8(%rdx,%r13,8), %rcx
movq (%rdx,%r13,8), %rdx
addl (%rcx,%r12,4), %eax
movl -0x4(%rdx,%r12,4), %esi
cmpl %eax, %esi
cmovll %esi, %eax
movl %eax, (%rdx,%r12,4)
movq %r14, %rdi
callq 0x3430
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
incq %r12
movslq 0x388(%rbx), %rax
cmpq %rax, %r12
jl 0x4b30
movl 0x4(%rsp), %ebp
leaq 0x54ca(%rip), %r12      # 0xa066
movq 0x360(%rbx), %rcx
movq (%rcx,%r13,8), %rcx
cltq
movl -0x4(%rcx,%rax,4), %esi
movq %r14, %rdi
callq 0x3430
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
leaq 0x1(%r13), %rax
movslq 0x36c(%rbx), %rcx
incl %ebp
cmpq %rcx, %r13
movq %rax, %r13
jl 0x4b18
movq 0x93e3(%rip), %r14      # 0xdfc8
leaq 0x547a(%rip), %r15      # 0xa066
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
movq 0x360(%rbx), %rax
movslq 0x36c(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x388(%rbx), %rcx
movl -0x4(%rax,%rcx,4), %esi
movq %r14, %rdi
callq 0x3430
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
movq 0x360(%rbx), %rax
movslq 0x36c(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x388(%rbx), %rcx
movl -0x4(%rax,%rcx,4), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5451(%rip), %rdi      # 0xa0b5
leaq 0x5465(%rip), %rsi      # 0xa0d0
leaq 0x546e(%rip), %rcx      # 0xa0e0
movl $0x5c, %edx
callq 0x3190
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4c9b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4c9b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4cb7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
nop