// File: /workspace/github_cpp_makefile_star2_O1/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 0x4326
movq %r14, %rdi
movq %r15, %rsi
callq 0x8cee
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x47c2
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 0x47f9
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 0x47e2
jmp 0x47fc
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 0x4d84
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 0x4868
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
movq %r14, %rdi
callq 0x9312
testl %eax, %eax
je 0x499a
leaq 0x268(%r14), %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movl %ebp, %esi
callq 0x90c8
movq %r14, %rdi
callq 0x930a
movl %eax, %eax
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
je 0x4988
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x9350
movq %r15, %rdi
movl $0x4e, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x494f
movq %r15, %rdi
movl $0x4d, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x494f
movq %r15, %rdi
movl $0x52, %esi
xorl %edx, %edx
callq 0x3360
cmpq $-0x1, %rax
jne 0x494f
cmpq $0x0, 0x10(%rsp)
je 0x492e
xorl %eax, %eax
xorl %ecx, %ecx
movq (%rbx), %rdx
cmpb $0x31, (%rdx,%rax)
jne 0x4924
movq 0x8(%rsp), %rdx
movb (%rdx,%rax), %dl
movl %ecx, %esi
movq (%r12), %rdi
movb %dl, (%rdi,%rsi)
incl %ecx
incq %rax
cmpq %rax, 0x10(%rsp)
ja 0x4908
movl 0x278(%r14), %edx
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x97ce
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 0x496b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
incl %r13d
movq %r14, %rdi
callq 0x930a
movl %eax, %eax
movq 0x8(%rbx), %rcx
subq %rcx, %rax
cmpq %r13, %rax
ja 0x48af
incl %ebp
movq %r14, %rdi
callq 0x9312
cmpl %eax, %ebp
jb 0x488b
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 0x49dc
movq 0x48(%rsp), %rsi
jmp 0x49d4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x49dc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3480