// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ba06
movq 0xd0(%rbx), %rax
cmpq %rax, 0xd8(%rbx)
je 0xc4cb1
leaq 0x10(%rsp), %r13
movq %rsp, %r15
leaq 0x48(%rsp), %r14
movzbl (%rax), %eax
cmpl $0x4c, %eax
jg 0xc4b26
cmpl $0x44, %eax
je 0xc4b7f
cmpl $0x49, %eax
jne 0xc4c36
movq 0xb8(%rbx), %rax
movslq (%rax), %rdx
movq %r15, %rdi
leaq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq $-0x1, %rcx
callq 0x84a0
jmp 0xc4b55
cmpl $0x4d, %eax
je 0xc4b8e
cmpl $0x53, %eax
jne 0xc4c36
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 0xc4c36
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xc4c36
movq 0xb8(%rbx), %rax
addl (%rax), %r12d
jmp 0xc4c36
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 0xc48cc
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 0xc4c12
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %r13
cmpq %r13, %rdi
je 0xc4c2d
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 0xc4c5c
subq %rsi, %rdx
callq 0x8750
movq 0xd8(%rbx), %rdx
decq %rdx
movq %rdx, 0xd8(%rbx)
movq 0xb8(%rbx), %rdi
movq 0xc0(%rbx), %rax
leaq 0x4(%rdi), %rsi
cmpq %rax, %rsi
je 0xc4c96
subq %rsi, %rax
movq %rax, %rdx
callq 0x8750
movq 0xc0(%rbx), %rax
movq 0xd8(%rbx), %rdx
addq $-0x4, %rax
movq %rax, 0xc0(%rbx)
movq 0xd0(%rbx), %rax
cmpq %rax, %rdx
jne 0xc4ae9
movq 0x108(%rbx), %rax
cmpq %rax, 0x110(%rbx)
je 0xc4d7c
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), %rcx
testq %rcx, %rcx
je 0xc4d13
movq %r12, %rdx
xorl %esi, %esi
cmpl %eax, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rdx
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0xc4cf2
cmpq %r12, %rdx
je 0xc4d13
cmpl 0x20(%rdx), %eax
jge 0xc4d6f
movq %r14, %rdi
movq %r15, %rsi
callq 0x66fae
movq 0x108(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0xc4d44
addq $0x8, %rax
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0xc4d4c
movq %rax, %rdi
callq 0x48c2e
incq %r13
movq 0x108(%rbx), %rax
movq 0x110(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0xc4cd9
jmp 0xc4d7c
movq %r14, %rdi
movq %r15, %rsi
callq 0xc5302
jmp 0xc4d1e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc4d98
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 0xc4dcf
jmp 0xc4dab
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xc4dd2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xc4dd2
jmp 0xc4dcf
jmp 0xc4dcf
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xc4dee
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq %rbx, %rdi
callq 0x8840