// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/evo_recombUtils.cpp
// Function: RecombRead::findHetsInRead(std::map<int, PhaseInfo*, std::less<int>, std::allocator<std::pair<int const, PhaseInfo*>>> const&)
void RecombRead::findHetsInRead(const std::map<int,PhaseInfo*>& positionToPhase) {
    std::vector<HetInfo*> hetsOnThisRead;
    
    int startPos = readPos; string processedReadSeq = readSeq;
    while (GIGARtypes.size() > 0) {
        switch (GIGARtypes[0])
        {
            case SOFT_CLIP_CIGAR:
                processedReadSeq = processedReadSeq.substr(GIGARnums[0]);
                break;
                
            case HARD_CLIP_CIGAR:
                break;
                
            case DELETION_CIGAR:
                startPos = startPos + GIGARnums[0];
                break;
                
            case INSERTION_CIGAR:
                processedReadSeq = processedReadSeq.substr(GIGARnums[0]);
                break;
                
            case MATCH_CIGAR:
                string matchSeq = processedReadSeq.substr(0, GIGARnums[0]);
                findHetsInMatchingString(matchSeq, startPos, positionToPhase);
                startPos = startPos + GIGARnums[0];
                usedLength = usedLength + GIGARnums[0];
                processedReadSeq = processedReadSeq.substr(GIGARnums[0]);
                
                break;
        }
        
        GIGARtypes.erase(GIGARtypes.begin());
        GIGARnums.erase(GIGARnums.begin());
        
    }
    
    for (int i = 0; i < hetSites.size(); i++) {
        int thisHetPhaseBlock = hetSites[i]->phaseBlock;
        if (BlockIDsToHetPos.count(thisHetPhaseBlock) == 1) {
            BlockIDsToHetPos.at(thisHetPhaseBlock).push_back(hetSites[i]->pos);
        } else {
            BlockIDsToHetPos[thisHetPhaseBlock].push_back(hetSites[i]->pos);
        }
        
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %rbx
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movl 0x48(%rdi), %eax
movl %eax, 0xc(%rsp)
leaq 0x50(%rdi), %rsi
leaq 0x58(%rsp), %rdi
callq 0x8600
leaq 0xd0(%rbx), %r15
leaq 0xb8(%rbx), %r12
leaq 0x38(%rsp), %rbp
leaq 0x58(%rsp), %r14
movq %r15, 0x10(%rsp)
movq 0xd0(%rbx), %rax
cmpq %rax, 0xd8(%rbx)
je 0x8f294
movzbl (%rax), %eax
cmpl $0x44, %eax
je 0x8f26a
cmpl $0x49, %eax
je 0x8f1c1
cmpl $0x4d, %eax
je 0x8f1ee
cmpl $0x53, %eax
jne 0x8f278
movq (%r12), %rax
movslq (%rax), %rdx
movq %rbp, %rdi
movq %r14, %rsi
pushq $-0x1
popq %rcx
callq 0x84b0
jmp 0x8f1d6
movq (%r12), %rax
movslq (%rax), %rdx
movq %rbp, %rdi
movq %r14, %rsi
pushq $-0x1
popq %rcx
callq 0x84b0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x8550
movq %rbp, %rdi
callq 0x8978
jmp 0x8f278
movq (%r12), %rax
movslq (%rax), %rcx
movq %rbp, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x84b0
movq %rbp, %rsi
movq %r14, %r13
movq %rbx, %rdi
movl 0xc(%rsp), %edx
movq 0x18(%rsp), %rcx
callq 0x8eff4
movq 0xb8(%rbx), %rax
movl (%rax), %r14d
addl %r14d, 0x100(%rbx)
movslq (%rax), %rdx
leaq 0x78(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
pushq $-0x1
popq %rcx
callq 0x84b0
addl %r14d, 0xc(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x8550
movq %r15, %rdi
callq 0x8978
movq %rbp, %rdi
callq 0x8978
movq %r13, %r14
movq 0x10(%rsp), %r15
jmp 0x8f278
movq (%r12), %rax
movl 0xc(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, 0xc(%rsp)
movq (%r15), %rsi
movq %r15, %rdi
callq 0x8f79a
movq (%r12), %rsi
movq %r12, %rdi
callq 0x8f7d2
jmp 0x8f177
leaq 0x120(%rbx), %r14
xorl %r12d, %r12d
leaq 0x38(%rsp), %r15
movq 0x108(%rbx), %rax
movq 0x110(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x8f309
movq (%rax,%r12,8), %rax
movl 0x4(%rax), %eax
movl %eax, 0x38(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x8f80c
cmpq $0x1, %rax
jne 0x8f2e6
movq %r14, %rdi
movq %r15, %rsi
callq 0x8f826
jmp 0x8f2f1
movq %r14, %rdi
movq %r15, %rsi
callq 0x50af6
movq 0x108(%rbx), %rcx
movq (%rcx,%r12,8), %rsi
movq %rax, %rdi
callq 0x3aca4
incq %r12
jmp 0x8f2a3
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x8d26e
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x8f35c
jmp 0x8f34f
jmp 0x8f338
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x8978
jmp 0x8f352
jmp 0x8f34f
jmp 0x8f34f
jmp 0x8f34f
jmp 0x8f34f
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x8d26e
movq %rbx, %rdi
callq 0x8870