// File: /workspace/github_cpp_makefile_star2_O3/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 0x4c71
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 0x4a82
leaq 0x38(%rsp), %r12
xorl %r15d, %r15d
leaq 0x28(%rsp), %r13
movq 0x9608(%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 0x41dc
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x5d50
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4a14
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x5ed8
movq 0x358(%rbx), %rcx
movl %eax, (%rcx,%r15,4)
movq %rbp, %rdi
movl %eax, %esi
callq 0x3430
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x596e(%rip), %rsi      # 0xa3ae
callq 0x32d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4a61
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 0x49c0
movq 0x953f(%rip), %rdi      # 0xdfc8
leaq 0x55d6(%rip), %rsi      # 0xa066
movl $0x1, %edx
callq 0x32d0
cmpl $0x0, 0x36c(%rbx)
jle 0x4adc
movq 0x358(%rbx), %rax
movq 0x360(%rbx), %rcx
movq (%rcx), %rdx
movl (%rdx), %edx
xorl %esi, %esi
movslq 0x370(%rbx), %rdi
imulq %rsi, %rdi
addl (%rax,%rdi,4), %edx
movq 0x8(%rcx,%rsi,8), %rdi
movl %edx, (%rdi)
movslq 0x36c(%rbx), %rdi
incq %rsi
cmpq %rdi, %rsi
jl 0x4ab8
movq 0x94e5(%rip), %r14      # 0xdfc8
leaq 0x557c(%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 0x4bf2
movl $0x0, 0x4(%rsp)
movq 0x949c(%rip), %r14      # 0xdfc8
leaq 0x587b(%rip), %r15      # 0xa3ae
movslq 0x388(%rbx), %rax
cmpq $0x1, %rax
jle 0x4bac
movl $0x1, %r12d
movslq 0x4(%rsp), %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 0x4b4b
movq 0x360(%rbx), %rcx
movq (%rcx,%r13,8), %rcx
movl -0x4(%rcx,%rax,4), %esi
movq %r14, %rdi
callq 0x3430
movl $0x1, %edx
movq %r14, %rdi
leaq 0x5494(%rip), %rsi      # 0xa066
callq 0x32d0
leaq 0x1(%r13), %rax
movslq 0x36c(%rbx), %rcx
incl 0x4(%rsp)
cmpq %rcx, %r13
movq %rax, %r13
jl 0x4b33
movq 0x93cf(%rip), %r14      # 0xdfc8
leaq 0x5466(%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 0x543d(%rip), %rdi      # 0xa0b5
leaq 0x5451(%rip), %rsi      # 0xa0d0
leaq 0x545a(%rip), %rcx      # 0xa0e0
movl $0x5c, %edx
callq 0x3190
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4caf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4caf
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4ccb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
nop