// File: /workspace/github_cpp_makefile_star2_O3/readmapping[P]alfalfa/src/mapper.cpp
// Function: pairedMatch6(sparseSA const&, read_t&, read_t&, align_opt const&, paired_opt const&)
void pairedMatch6(const sparseSA& sa, read_t & mate1, read_t & mate2, const align_opt & alnOptions, const paired_opt & pairedOpt){
    int editDist1 = (int)(alnOptions.errorPercent*mate1.sequence.length())+1;
    int editDist2 = (int)(alnOptions.errorPercent*mate2.sequence.length())+1;
    //FIND CANDIDATE REGIONS FOR BOTH MATES
    vector<lis_t>  lisIntervals1;
    vector<lis_t>  lisIntervals2;
    if(alnOptions.print >= 3) cerr << "calculate LIS of both mates"  << endl;
    calculateCandRegions(sa, mate1, alnOptions, lisIntervals1, alnOptions.errorPercent);
    calculateCandRegions(sa, mate2, alnOptions, lisIntervals2, alnOptions.errorPercent);
    //FILTER LIS: ONLY THOSE THAT PAIR : PUT IN LIST OF LISCOUPLE 
    vector<LIScouple_t>  lisIntervalsFiltered;
    if(alnOptions.print >= 3) cerr << "filter LIS of both mates using pairing"  << endl;
    for(size_t i = 0; i < lisIntervals1.size(); i++){
        for(size_t j = 0; j < lisIntervals2.size(); j++){
            if(!(lisIntervals1[i].extended && lisIntervals2[j].extended) && isConcordantLIS(lisIntervals1[i], lisIntervals2[j], editDist1, editDist2, pairedOpt, alnOptions.print))
                lisIntervalsFiltered.push_back(LIScouple_t(i,j,lisIntervals1[i].score+lisIntervals2[j].score));
        }
    }
    if(alnOptions.print >= 3) cerr << "number of paired LIS in filtered list " << lisIntervalsFiltered.size()  << endl;
    //RESCUE IF NO PAIRED LIS WERE FOUND
    if(lisIntervalsFiltered.empty()){
        if(alnOptions.print >= 2) cerr << "#EMPTYFILTEREDLIST"  << endl;
        pairedMatch1(sa, mate1, mate2, alnOptions, pairedOpt);
    }
    else{
        sort(lisIntervalsFiltered.begin(),lisIntervalsFiltered.end(),compLIScouple);
        //FIND ALIGNMENTS FOR FILTERED LIST OF ALIGNMENTS
        //BE NICE AND GIVE THE OPTION OF LOWER MINSCORE
        int minScore1 = (int) (mate1.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*(editDist1*1.5));
        int minScore2 = (int) (mate2.sequence.length()*alnOptions.match + (alnOptions.mismatch-alnOptions.match)*(editDist2*1.5));
        processLisIntervalsSimultaneous(sa, mate1, mate2, alnOptions, pairedOpt, lisIntervals1, lisIntervals2, lisIntervalsFiltered, 
                alnOptions.maxAlnCount, 0, minScore1, minScore2);
        if(alnOptions.print >= 3) cerr << "first  mate resulted in " << mate1.alignments.size() << " alignments" << endl;
        if(alnOptions.print >= 3) cerr << "second mate resulted in " << mate2.alignments.size() << " alignments" << endl;
        //FIND DISCORDANT ALIGNMENTS AMONGST HIGHEST SCORING UNPAIRED ALIGNMENTS
        int maxPairedAlignments = alnOptions.alignmentCount+1;
        int pairedAlignments = mate1.pairedAlignmentCount;
        if(alnOptions.print >= 2) cerr << "#CONCORDANTCOUNT " << pairedAlignments << endl;
        if(pairedOpt.discordant && pairedAlignments < maxPairedAlignments){
            if(alnOptions.print >= 3) cerr << "search discordant alignments" << endl;
            calculateDiscordantAlignments(sa, mate1, mate2);
        }
        if(alnOptions.print >= 2) cerr << "#DISCORDANTCOUNT " << mate1.pairedAlignmentCount-pairedAlignments << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, 0x38(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r13
movsd 0x30(%rcx), %xmm1
movsd 0x28(%rsi), %xmm0
movaps %xmm0, 0xa0(%rsp)
movsd 0x28(%rdx), %xmm0
movaps %xmm0, 0xb0(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq %rax, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
cmpl $0x3, 0x78(%rcx)
movsd %xmm1, 0x30(%rsp)
movapd %xmm1, %xmm0
jl 0x284fa
movq 0x2bb33(%rip), %rbx     # 0x53fe8
leaq 0x1d10d(%rip), %rsi     # 0x455c9
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x7340
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2bb01(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movsd 0x30(%r15), %xmm0
leaq 0x40(%rsp), %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x24d8b
movsd 0x30(%r15), %xmm0
leaq 0x80(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x24d8b
movq %r13, 0x60(%rsp)
movq %r12, 0x68(%rsp)
movq %r14, 0x28(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %r15, 0x8(%rsp)
cmpl $0x3, 0x78(%r15)
jl 0x2859d
movq 0x2ba8a(%rip), %rbx     # 0x53fe8
leaq 0x1d080(%rip), %rsi     # 0x455e5
movl $0x26, %edx
movq %rbx, %rdi
callq 0x7340
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2ba58(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movsd 0x1c76b(%rip), %xmm1    # 0x44d10
movapd 0xa0(%rsp), %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movapd 0x1c767(%rip), %xmm2    # 0x44d20
subpd %xmm2, %xmm3
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd %xmm3, %xmm0
movsd 0x30(%rsp), %xmm3
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %r12d
incl %r12d
movapd 0xb0(%rsp), %xmm4
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
subpd %xmm2, %xmm4
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
cvttsd2si %xmm0, %eax
incl %eax
movl %eax, 0x30(%rsp)
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
cmpq %rcx, %rdx
je 0x2872f
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rax
xorl %r15d, %r15d
movabsq $0x6db6db6db6db6db7, %rbx # imm = 0x6DB6DB6DB6DB6DB7
cmpq %rsi, %rax
je 0x28712
imulq $0x38, %r15, %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x40(%rsp), %rdi
cmpb $0x1, 0x18(%rdi,%r14)
jne 0x28660
cmpb $0x0, 0x18(%rsi,%r13)
jne 0x286e0
addq %r14, %rdi
addq %r13, %rsi
movq 0x8(%rsp), %rax
movl 0x78(%rax), %r9d
movl %r12d, %edx
movl 0x30(%rsp), %ecx
movq 0x38(%rsp), %r8
callq 0x27401
movq 0x80(%rsp), %rsi
testb %al, %al
je 0x286e0
movq 0x40(%rsp), %rax
movl (%rsi,%r13), %ecx
addl (%rax,%r14), %ecx
movl %r15d, 0x74(%rsp)
movl %ebp, 0x78(%rsp)
movl %ecx, 0x7c(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x286c9
movl 0x7c(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x74(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0x18(%rsp)
jmp 0x286d8
leaq 0x10(%rsp), %rdi
leaq 0x74(%rsp), %rdx
callq 0x321cc
movq 0x80(%rsp), %rsi
incq %rbp
movq 0x88(%rsp), %rax
movq %rax, %rcx
subq %rsi, %rcx
sarq $0x3, %rcx
imulq %rbx, %rcx
addq $0x38, %r13
cmpq %rcx, %rbp
jb 0x28647
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
jmp 0x28715
movq %rsi, %rax
incq %r15
movq %rdx, %rdi
subq %rcx, %rdi
sarq $0x3, %rdi
imulq %rbx, %rdi
cmpq %rdi, %r15
jb 0x28635
movq 0x8(%rsp), %rax
cmpl $0x2, 0x78(%rax)
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
jle 0x287a4
movq 0x2b89d(%rip), %rdi     # 0x53fe8
leaq 0x1cf5e(%rip), %rsi     # 0x456b0
movl $0x26, %edx
callq 0x7340
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x2, %rsi
imulq %r14, %rsi
movq 0x2b873(%rip), %rdi     # 0x53fe8
callq 0x71c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
cmpq %r15, %rbx
je 0x28b27
movq %r15, %rax
subq %rbx, %rax
sarq $0x2, %rax
imulq %r14, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x3a5(%rip), %rcx      # 0x28434
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3235b
leaq -0x3b7(%rip), %rdx      # 0x28434
movq %rbx, %rdi
movq %r15, %rsi
callq 0x324b6
movq 0x8(%rsp), %r14
movslq (%r14), %rcx
movq 0x28(%rsp), %r15
movq 0x28(%r15), %rax
imulq %rcx, %rax
movq %rax, %xmm0
movq 0x1c4f8(%rip), %xmm4    # 0x44d10
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
movapd 0x1c4fc(%rip), %xmm5    # 0x44d20
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movl 0x4(%r14), %eax
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
cvtsi2sd %r12d, %xmm2
movsd 0x1c342(%rip), %xmm3    # 0x44b90
mulsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %r10d
movl 0x60(%r14), %eax
movq 0x68(%rsp), %r12
imulq 0x28(%r12), %rcx
movq %rcx, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm5, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2sdl 0x30(%rsp), %xmm1
mulsd %xmm3, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
cvttsd2si %xmm1, %r11d
subq $0x8, %rsp
leaq 0x18(%rsp), %rbx
leaq 0x48(%rsp), %r9
xorpd %xmm0, %xmm0
movq 0x68(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq 0x40(%rsp), %r8
pushq %r11
pushq %r10
pushq %rax
pushq %rbx
leaq 0xa8(%rsp), %rax
pushq %rax
callq 0x2c796
addq $0x30, %rsp
movl 0x78(%r14), %eax
cmpl $0x3, %eax
jl 0x289e2
movq 0x2b6f6(%rip), %rdi     # 0x53fe8
leaq 0x1cd64(%rip), %rsi     # 0x4565d
movl $0x18, %edx
callq 0x7340
movq 0xb8(%r15), %rsi
subq 0xb0(%r15), %rsi
sarq $0x3, %rsi
movq 0x2b6cc(%rip), %rdi     # 0x53fe8
callq 0x71c0
movq %rax, %rbx
leaq 0x1cd5c(%rip), %rsi     # 0x45687
movl $0xb, %edx
movq %rax, %rdi
callq 0x7340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movl 0x78(%r14), %eax
cmpl $0x3, %eax
jl 0x289e2
movq 0x2b679(%rip), %rdi     # 0x53fe8
leaq 0x1cb4a(%rip), %rsi     # 0x454c0
movl $0x18, %edx
callq 0x7340
movq 0xb8(%r12), %rsi
subq 0xb0(%r12), %rsi
sarq $0x3, %rsi
movq 0x2b64d(%rip), %rdi     # 0x53fe8
callq 0x71c0
movq %rax, %rbx
leaq 0x1ccdd(%rip), %rsi     # 0x45687
movl $0xb, %edx
movq %rax, %rdi
callq 0x7340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movl 0x78(%r14), %eax
movl 0x50(%r14), %r14d
movl 0xc8(%r15), %ebp
cmpl $0x2, %eax
jl 0x28a4a
movq 0x2b5ef(%rip), %rdi     # 0x53fe8
leaq 0x1cb61(%rip), %rsi     # 0x45561
movl $0x11, %edx
callq 0x7340
movq 0x2b5d7(%rip), %rdi     # 0x53fe8
movl %ebp, %esi
callq 0x75d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x8(%rsp), %rax
movl 0x78(%rax), %eax
movq 0x38(%rsp), %rcx
cmpb $0x1, 0x9(%rcx)
jne 0x28ac1
cmpl %r14d, %ebp
jg 0x28ac1
cmpl $0x3, %eax
jl 0x28aa5
movq 0x2b582(%rip), %rbx     # 0x53fe8
leaq 0x1cc26(%rip), %rsi     # 0x45693
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x7340
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2b550(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x60(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x25a9b
movq 0x8(%rsp), %rax
movl 0x78(%rax), %eax
cmpl $0x2, %eax
jl 0x28b96
movq 0x2b517(%rip), %rdi     # 0x53fe8
leaq 0x1ca9b(%rip), %rsi     # 0x45573
movl $0x11, %edx
callq 0x7340
movq 0x28(%rsp), %rax
movl 0xc8(%rax), %esi
subl %ebp, %esi
movq 0x2b4f2(%rip), %rdi     # 0x53fe8
callq 0x75d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
jmp 0x28b96
movq 0x8(%rsp), %rax
cmpl $0x2, 0x78(%rax)
jl 0x28b78
movq 0x2b4af(%rip), %rbx     # 0x53fe8
leaq 0x1cb0a(%rip), %rsi     # 0x4564a
movl $0x12, %edx
movq %rbx, %rdi
callq 0x7340
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2b47d(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x60(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0x26c10
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x28bad
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
leaq 0x80(%rsp), %rdi
callq 0x2c640
leaq 0x40(%rsp), %rdi
callq 0x2c640
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28be3
movq %rax, %rbx
jmp 0x28bfd
jmp 0x28be3
jmp 0x28be3
jmp 0x28be3
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x28bfd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
leaq 0x80(%rsp), %rdi
callq 0x2c640
leaq 0x40(%rsp), %rdi
callq 0x2c640
movq %rbx, %rdi
callq 0x7600