// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]optimal-seed-solver/spacedSeedSolver.cc
// Function: SpacedSeedSolver::generateHash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void SpacedSeedSolver::generateHash(string refName, string mask) {
	refDB.loadRefFile(refName);

	this->mask = mask;

	unsigned int oneCount = 0;
	for (int i = 0; i < mask.length(); i++) {
		if (mask[i] == '1')
			oneCount++;
	}

	freqTable.resize( (1 << (2 * oneCount) ), 0);

	seed = string(oneCount, 'N');

	for (unsigned int chromoCount = 0; chromoCount < refDB.getNumOfChromo(); chromoCount++) {
		refDB.loadChromo(chromoCount);
		for (unsigned int refPos = 0; refPos < refDB.getChromoLength() - mask.length(); refPos++) {
			string spacedSeed = refDB.getRefSeq(refPos, mask.length() );
			if (spacedSeed.find('N') == string::npos && spacedSeed.find('M') == string::npos && spacedSeed.find('R') == string::npos) {
				oneCount = 0;
				for (int i = 0; i < spacedSeed.length(); i++) {
				   if (mask[i] == '1') {
						seed[oneCount] = spacedSeed[i];
						oneCount++;
				   }
				}
				unsigned int hash = hashGen.calculateHash(seed, seed.length() );
				freqTable[hash]++;
			}
		}
	}	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x432c
movq %r14, %rdi
movq %r15, %rsi
callq 0x8ca6
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x47d2
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x2a8(%r14), %rdi
movq %rbx, %rsi
callq 0x3150
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x4809
movq (%rbx), %rcx
xorl %edx, %edx
xorl %r15d, %r15d
xorl %esi, %esi
cmpb $0x31, (%rcx,%rdx)
sete %sil
addl %esi, %r15d
incq %rdx
cmpq %rdx, %rax
jne 0x47f2
jmp 0x480c
xorl %r15d, %r15d
leal (%r15,%r15), %ecx
movl $0x1, %esi
shll %cl, %esi
leaq 0x290(%r14), %rdi
leaq 0x8(%rsp), %rdx
movl $0x0, (%rdx)
movq %rdi, 0x30(%rsp)
callq 0x4da0
movl %r15d, %esi
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x4e, %edx
callq 0x32f0
leaq 0x270(%r14), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3310
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x4878
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
movq %r14, %rdi
callq 0x92de
testl %eax, %eax
je 0x49b3
leaq 0x268(%r14), %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movl %ebp, %esi
callq 0x9086
movq %r14, %rdi
callq 0x92d6
movl %eax, %eax
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
je 0x49a1
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x931c
movq %r15, %rdi
movl $0x4e, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x4968
movq %r15, %rdi
movl $0x4d, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x4968
movq %r15, %rdi
movl $0x52, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x4968
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0x4947
xorl %eax, %eax
xorl %ecx, %ecx
movq (%rbx), %rsi
cmpb $0x31, (%rsi,%rax)
jne 0x493f
movq 0x8(%rsp), %rdx
movb (%rdx,%rax), %dl
movl %ecx, %esi
movq (%r12), %rdi
movb %dl, (%rdi,%rsi)
incl %ecx
movq 0x10(%rsp), %rdx
incq %rax
cmpq %rax, %rdx
ja 0x491e
movl 0x278(%r14), %edx
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x979a
movl %eax, %eax
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
incl (%rcx,%rax,4)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4984
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
incl %r13d
movq %r14, %rdi
callq 0x92d6
movl %eax, %eax
movq 0x8(%rbx), %rcx
subq %rcx, %rax
cmpq %r13, %rax
ja 0x48bf
incl %ebp
movq %r14, %rdi
callq 0x92de
cmpl %eax, %ebp
jb 0x489b
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x49f5
movq 0x48(%rsp), %rsi
jmp 0x49ed
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x49f5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3480
nop