// File: /workspace/github_cpp_makefile_star2_O2/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 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x3360
movq %r14, %rdi
movq %r15, %rsi
callq 0x7e64
leaq 0x38(%rsp), %rdi
callq 0x3110
leaq 0x2a8(%r14), %rdi
movq %rbx, %rsi
callq 0x3140
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
xorl %r15d, %r15d
cmpq %rcx, %rax
je 0x42ea
movq (%rbx), %rdx
xorl %esi, %esi
cmpb $0x31, (%rdx,%rcx)
sete %sil
addl %esi, %r15d
incq %rcx
jmp 0x42d0
leaq 0x290(%r14), %rdi
leal (%r15,%r15), %ecx
pushq $0x1
popq %rsi
shll %cl, %esi
leaq 0x18(%rsp), %r12
andl $0x0, (%r12)
movq %rdi, (%rsp)
movq %r12, %rdx
callq 0x472a
movl %r15d, %esi
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x18(%rsp), %r15
pushq $0x4e
popq %rdx
movq %r15, %rdi
callq 0x3290
leaq 0x270(%r14), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x32c0
movq %r15, %rdi
callq 0x3110
leaq 0x268(%r14), %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x8272
cmpl %eax, %r15d
jae 0x4446
movq %r14, %rdi
movq %r15, 0x10(%rsp)
movl %r15d, %esi
callq 0x80d8
xorl %r15d, %r15d
movl %r15d, %ebp
movq %r14, %rdi
callq 0x826a
movl %eax, %eax
movq 0x8(%rbx), %rcx
subq %rcx, %rax
cmpq %rbp, %rax
jbe 0x4439
movq %r12, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x829c
movq %r12, %rdi
pushq $0x4e
popq %rsi
xorl %edx, %edx
callq 0x3320
cmpq $-0x1, %rax
jne 0x4429
movq %r12, %rdi
pushq $0x4d
popq %rsi
xorl %edx, %edx
callq 0x3320
cmpq $-0x1, %rax
jne 0x4429
movq %r12, %rdi
pushq $0x52
popq %rsi
xorl %edx, %edx
callq 0x3320
cmpq $-0x1, %rax
jne 0x4429
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rax, 0x20(%rsp)
jbe 0x4409
movq (%rbx), %rdx
cmpb $0x31, (%rdx,%rax)
jne 0x4404
movq 0x18(%rsp), %rdx
movb (%rdx,%rax), %dl
movl %ecx, %esi
movq (%r13), %rdi
movb %dl, (%rdi,%rsi)
incl %ecx
incq %rax
jmp 0x43e1
movl 0x278(%r14), %edx
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x86c6
movl %eax, %eax
movq (%rsp), %rcx
movq (%rcx), %rcx
incl (%rcx,%rax,4)
movq %r12, %rdi
callq 0x3110
incl %r15d
jmp 0x4379
movq 0x10(%rsp), %r15
incl %r15d
jmp 0x4355
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x4467
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3460