// File: 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
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x11e780
movq -0x120(%rbp), %rsi
movl 0x48(%rsi), %eax
movl %eax, -0x2c(%rbp)
addq $0x50, %rsi
leaq -0x50(%rbp), %rdi
callq 0xa250
jmp 0x1261b3
jmp 0x1261b5
movq -0x120(%rbp), %rdi
addq $0xd0, %rdi
callq 0xaefe0
cmpq $0x0, %rax
jbe 0x12651c
movq -0x120(%rbp), %rdi
addq $0xd0, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xada00
movsbl (%rax), %eax
addl $-0x44, %eax
movl %eax, %ecx
movq %rcx, -0x128(%rbp)
subl $0xf, %eax
ja 0x12645b
movq -0x128(%rbp), %rax
leaq 0x28a59(%rip), %rcx     # 0x14ec68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x12668a
movq -0x120(%rbp), %rdi
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4d100
movslq (%rax), %rdx
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq $-0x1, %rcx
callq 0xa5f0
jmp 0x126259
leaq -0x50(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xa710
leaq -0x80(%rbp), %rdi
callq 0xac88
jmp 0x12645b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x126681
jmp 0x12645b
movq -0x120(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0x12c(%rbp)
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4d100
movq %rax, %rcx
movl -0x12c(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12645b
movq -0x120(%rbp), %rdi
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4d100
movslq (%rax), %rdx
leaq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq $-0x1, %rcx
callq 0xa5f0
jmp 0x1262f0
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xa710
leaq -0xa0(%rbp), %rdi
callq 0xac88
jmp 0x12645b
movq -0x120(%rbp), %rdi
addq $0xb8, %rdi
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0x138(%rbp)
callq 0x4d100
movq -0x138(%rbp), %rdx
movslq (%rax), %rcx
leaq -0xc0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa5f0
jmp 0x12634b
movq -0x120(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rcx
leaq -0xc0(%rbp), %rsi
callq 0x125f70
jmp 0x126367
movq -0x120(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0x150(%rbp)
addq $0xb8, %rdi
movq %rdi, -0x148(%rbp)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0x140(%rbp)
callq 0x4d100
movl -0x150(%rbp), %ecx
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq %rax, %rdx
movq -0x120(%rbp), %rax
movl (%rdx), %edx
addl %edx, %ecx
movl %ecx, -0x2c(%rbp)
movl 0x100(%rax), %eax
movl %eax, -0x14c(%rbp)
callq 0x4d100
movl -0x14c(%rbp), %ecx
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq %rax, %rdx
movq -0x120(%rbp), %rax
movl (%rdx), %edx
addl %edx, %ecx
movl %ecx, 0x100(%rax)
callq 0x4d100
movslq (%rax), %rdx
leaq -0xe0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq $-0x1, %rcx
callq 0xa5f0
jmp 0x126414
leaq -0x50(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xa710
leaq -0xe0(%rbp), %rdi
callq 0xac88
leaq -0xc0(%rbp), %rdi
callq 0xac88
jmp 0x12645b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xac88
jmp 0x126681
movq -0x120(%rbp), %rdi
addq $0xd0, %rdi
movq %rdi, -0x160(%rbp)
callq 0xaeee0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x127120
movq -0x160(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x1270b0
movq %rax, -0x158(%rbp)
jmp 0x1264ab
movq -0x120(%rbp), %rdi
movq -0x158(%rbp), %rax
movq %rax, -0xf8(%rbp)
addq $0xb8, %rdi
movq %rdi, -0x170(%rbp)
callq 0x46a90
movq %rax, -0x108(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x83890
movq -0x170(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x127160
movq %rax, -0x168(%rbp)
jmp 0x126509
movq -0x168(%rbp), %rax
movq %rax, -0x110(%rbp)
jmp 0x1261b5
movl $0x0, -0x114(%rbp)
movq -0x120(%rbp), %rdi
movslq -0x114(%rbp), %rax
movq %rax, -0x178(%rbp)
addq $0x108, %rdi            # imm = 0x108
callq 0x11d780
movq %rax, %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
jae 0x126666
movq -0x120(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movslq -0x114(%rbp), %rsi
callq 0x11d7a0
movq -0x120(%rbp), %rdi
movq (%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x118(%rbp)
addq $0x120, %rdi            # imm = 0x120
leaq -0x118(%rbp), %rsi
callq 0x1271d0
movq %rax, -0x180(%rbp)
jmp 0x1265a3
movq -0x180(%rbp), %rax
cmpq $0x1, %rax
jne 0x126600
movq -0x120(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq -0x118(%rbp), %rsi
callq 0x127230
movq %rax, -0x188(%rbp)
jmp 0x1265d3
movq -0x120(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movslq -0x114(%rbp), %rsi
callq 0x11d7a0
movq -0x188(%rbp), %rdi
movq (%rax), %rsi
callq 0x6b600
jmp 0x1265fe
jmp 0x126650
movq -0x120(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq -0x118(%rbp), %rsi
callq 0xa54c0
movq %rax, -0x190(%rbp)
jmp 0x126623
movq -0x120(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movslq -0x114(%rbp), %rsi
callq 0x11d7a0
movq -0x190(%rbp), %rdi
movq (%rax), %rsi
callq 0x6b600
jmp 0x12664e
jmp 0x126650
jmp 0x126652
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x126526
leaq -0x50(%rbp), %rdi
callq 0xac88
leaq -0x28(%rbp), %rdi
callq 0x11e7a0
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0xac88
leaq -0x28(%rbp), %rdi
callq 0x11e7a0
movq -0x58(%rbp), %rdi
callq 0xab50
nopl (%rax)