// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rsi, 0x40(%rsp)
movq %rdi, %rbx
movl 0x48(%rdi), %r12d
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x50(%rdi), %rsi
movq 0x58(%rdi), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x2e45c
movq 0xd0(%rbx), %rax
cmpq %rax, 0xd8(%rbx)
je 0xc5931
leaq 0x10(%rsp), %r13
movq %rsp, %r15
leaq 0x48(%rsp), %r14
movzbl (%rax), %eax
cmpl $0x4c, %eax
jg 0xc57c0
cmpl $0x44, %eax
je 0xc5819
cmpl $0x49, %eax
jne 0xc58d0
movq 0xb8(%rbx), %rax
movslq (%rax), %rdx
movq %r15, %rdi
leaq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq $-0x1, %rcx
callq 0x84a0
jmp 0xc57ef
cmpl $0x4d, %eax
je 0xc5828
cmpl $0x53, %eax
jne 0xc58d0
movq 0xb8(%rbx), %rax
movslq (%rax), %rdx
movq %r15, %rdi
leaq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq $-0x1, %rcx
callq 0x84a0
movq %rbp, %rdi
movq %r15, %rsi
callq 0x8540
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0xc58d0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xc58d0
movq 0xb8(%rbx), %rax
addl (%rax), %r12d
jmp 0xc58d0
movq 0xb8(%rbx), %rax
movslq (%rax), %rcx
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0x84a0
movq %r15, %rsi
movq %r14, %r15
movq %rbx, %rdi
movl %r12d, %edx
movq 0x40(%rsp), %rcx
callq 0xc5560
movq 0xb8(%rbx), %rax
movl (%rax), %r14d
addl %r14d, 0x100(%rbx)
movslq (%rax), %rdx
movq %r15, %r13
movq %r15, %rdi
leaq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq $-0x1, %rcx
callq 0x84a0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x8540
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xc58ac
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %r13
cmpq %r13, %rdi
je 0xc58c7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
addl %r14d, %r12d
movq %r15, %r14
movq %rsp, %r15
movq 0xd0(%rbx), %rdi
movq 0xd8(%rbx), %rdx
leaq 0x1(%rdi), %rsi
cmpq %rdx, %rsi
je 0xc58ef
subq %rsi, %rdx
callq 0x8750
decq 0xd8(%rbx)
movq 0xb8(%rbx), %rdi
movq 0xc0(%rbx), %rdx
leaq 0x4(%rdi), %rsi
cmpq %rdx, %rsi
je 0xc5915
subq %rsi, %rdx
callq 0x8750
addq $-0x4, 0xc0(%rbx)
movq 0xd0(%rbx), %rax
cmpq %rax, 0xd8(%rbx)
jne 0xc5783
movq 0x108(%rbx), %rax
cmpq %rax, 0x110(%rbx)
je 0xc5a0a
leaq 0x120(%rbx), %r14
leaq 0x128(%rbx), %r12
xorl %r13d, %r13d
movq %rsp, %r15
movq (%rax,%r13,8), %rax
movl 0x4(%rax), %eax
movl %eax, (%rsp)
movq 0x130(%rbx), %rdx
movq %r12, %rcx
testq %rdx, %rdx
je 0xc598c
movq %r12, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0xc5975
movq %r12, %rdx
cmpq %r12, %rcx
je 0xc599e
cmpl 0x20(%rcx), %eax
cmovlq %r12, %rcx
movq %rcx, %rdx
cmpq %r12, %rdx
je 0xc59b0
movq %r14, %rdi
movq %r15, %rsi
callq 0xc5f86
jmp 0xc59bb
movq %r14, %rdi
movq %r15, %rsi
callq 0x672f4
movq 0x108(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc59e1
addq $0x8, %rax
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0xc59e9
movq %rax, %rdi
callq 0x4bc3a
incq %r13
movq 0x108(%rbx), %rax
movq 0x110(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0xc5959
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc5a26
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc5a5d
jmp 0xc5a39
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xc5a60
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xc5a60
jmp 0xc5a5d
jmp 0xc5a5d
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc5a7c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840