// File: /workspace/github_cpp_makefile_star2_O1/readmapping[P]alfalfa/src/mapper.cpp
// Function: pairedMatch1(sparseSA const&, read_t&, read_t&, align_opt const&, paired_opt const&)
void pairedMatch1(const sparseSA& sa, read_t & mate1, read_t & mate2, const align_opt & alnOptions, const paired_opt & pairedOpt){
    //Calculate the mappings for read 1 and 2
    if(alnOptions.print >= 3) cerr << "matching first mate ..." << endl;
    unpairedMatch(sa, mate1, alnOptions);
    if(alnOptions.print >= 3) cerr << "first mate resulted in " << mate1.alignments.size() << " alignments" << endl;
    if(alnOptions.print >= 3) cerr << "matching second mate ..." << endl;
    unpairedMatch(sa, mate2, alnOptions);
    if(alnOptions.print >= 3) cerr << "second mate resulted in " << mate2.alignments.size() << " alignments" << endl;
    int alnCount1 = mate1.alignmentCount();
    int alnCount2 = mate2.alignmentCount();
    int alnCount = 0;
    int maxPairedAlignments = alnOptions.alignmentCount+1;
    //ORDER ALIGNMENTS ACCORDING TO SCORE
    vector<alnScoreInfo_t> pairedOrder;
    pairedOrder.reserve(alnCount1+alnCount2);
    for(size_t i = 0; i < mate1.alignments.size(); i++)
        pairedOrder.push_back(alnScoreInfo_t(true, i,mate1.alignments[i]->alignmentScore ));
    for(size_t i = 0; i < mate2.alignments.size(); i++)
        pairedOrder.push_back(alnScoreInfo_t(false, i,mate2.alignments[i]->alignmentScore ));
    sort(pairedOrder.begin(),pairedOrder.end(),compAlnScorePaired);
    //TRY AND PAIR THE ALIGNMENTS
    if(alnCount1>0 && alnCount2>0){
        if(alnOptions.print >= 3) cerr << "search concordant alignments of " << pairedOrder.size() << " alignments" << endl;
        pairAlignmentsOrdered(sa, mate1, mate2, alnOptions, pairedOpt, 
        pairedOrder, alnCount, maxPairedAlignments);
        if(alnOptions.print >= 3) cerr << "found " << alnCount << " concordant alignments" << endl;
    }
    //RESCUE PROCEDURE IF NO CONCORDANT ALIGNMENTS WERE FOUND
    if(pairedOpt.pairedRescue && alnCount < maxPairedAlignments && max(alnCount1,alnCount2)>0){
        if(alnOptions.print >= 2) cerr << "#PAIREDRESCUE" << endl;
        if(alnOptions.print >= 3) cerr << "try to recover concordant alignments using windows " << endl;
        vector<alnScoreInfo_t> newAlnFromWindow;
        pairAlignmentToWindow(sa, mate1, mate2, alnOptions, pairedOpt, pairedOrder, 
        newAlnFromWindow, alnCount, maxPairedAlignments);
        if(alnOptions.print >= 3) cerr << "rescue procedure resulted in " << alnCount << " concordant alignments" << endl;
    }
    //FIND DISCORDANT ALIGNMENTS AMONGST HIGHEST SCORING UNPAIRED ALIGNMENTS
    int pairedAlignments = mate1.pairedAlignmentCount;
    if(alnOptions.print >= 2) cerr << "#CONCORDANTCOUNT " << pairedAlignments << endl;
    if(pairedOpt.discordant && alnCount < maxPairedAlignments)
        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 $0x78, %rsp
movq %r8, 0x50(%rsp)
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x3, 0x78(%rcx)
jl 0x26cb0
movq 0x2d374(%rip), %r13     # 0x53fe8
leaq 0x1e7fc(%rip), %rsi     # 0x45477
movl $0x17, %edx
movq %r13, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2522d
cmpl $0x3, 0x78(%r12)
jl 0x26d3a
movq 0x2d31b(%rip), %r13     # 0x53fe8
leaq 0x1e7bb(%rip), %rsi     # 0x4548f
movl $0x17, %edx
movq %r13, %rdi
callq 0x7340
movq 0xb8(%rbx), %rsi
subq 0xb0(%rbx), %rsi
sarq $0x3, %rsi
movq %r13, %rdi
callq 0x71c0
movq %rax, %r13
leaq 0x1e982(%rip), %rsi     # 0x45687
movl $0xb, %edx
movq %rax, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
cmpl $0x3, 0x78(%r12)
jl 0x26d85
movq 0x2d29f(%rip), %r13     # 0x53fe8
leaq 0x1e757(%rip), %rsi     # 0x454a7
movl $0x18, %edx
movq %r13, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq %r14, 0x58(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2522d
cmpl $0x3, 0x78(%r12)
jl 0x26e14
movq 0x2d241(%rip), %r13     # 0x53fe8
leaq 0x1e712(%rip), %rsi     # 0x454c0
movl $0x18, %edx
movq %r13, %rdi
callq 0x7340
movq 0xb8(%r15), %rsi
subq 0xb0(%r15), %rsi
sarq $0x3, %rsi
movq %r13, %rdi
callq 0x71c0
movq %rax, %r13
leaq 0x1e8a8(%rip), %rsi     # 0x45687
movl $0xb, %edx
movq %rax, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0xb8(%rbx), %rcx
subq 0xb0(%rbx), %rcx
shrq $0x3, %rcx
movq 0xb8(%r15), %r14
subq 0xb0(%r15), %r14
shrq $0x3, %r14
movl $0x0, 0xc(%rsp)
movl 0x50(%r12), %eax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rcx, 0x68(%rsp)
leal (%r14,%rcx), %eax
movslq %eax, %rsi
callq 0x2c7aa
movq %r12, 0x70(%rsp)
movq 0xb0(%rbx), %rax
cmpq %rax, 0xb8(%rbx)
je 0x26ef0
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbp
leaq 0x30(%rsp), %r13
movq (%rax,%r12,8), %rax
movl 0x70(%rax), %eax
movb $0x1, 0x30(%rsp)
movl %r12d, 0x34(%rsp)
movl %eax, 0x38(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x26ec8
movl 0x38(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x30(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0x18(%rsp)
jmp 0x26ed3
movq %rbp, %rdi
movq %r13, %rdx
callq 0x319e2
incq %r12
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r12
jb 0x26e90
movq 0xb0(%r15), %rax
cmpq %rax, 0xb8(%r15)
je 0x26f6d
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbp
leaq 0x30(%rsp), %r13
movq (%rax,%r12,8), %rax
movl 0x70(%rax), %eax
movb $0x0, 0x30(%rsp)
movl %r12d, 0x34(%rsp)
movl %eax, 0x38(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x26f45
movl 0x38(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x30(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0x18(%rsp)
jmp 0x26f50
movq %rbp, %rdi
movq %r13, %rdx
callq 0x319e2
incq %r12
movq 0xb0(%r15), %rax
movq 0xb8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r12
jb 0x26f0d
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rbp
cmpq %rbp, %r13
movq 0x70(%rsp), %r12
je 0x26fca
movq %rbp, %rax
subq %r13, %rax
sarq $0x2, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
bsrq %rcx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0xf37(%rip), %rcx      # 0x26076
movq %r13, %rdi
movq %rbp, %rsi
callq 0x31b71
leaq -0xf49(%rip), %rdx      # 0x26076
movq %r13, %rdi
movq %rbp, %rsi
callq 0x31ccc
movq 0x60(%rsp), %rax
leal 0x1(%rax), %ebp
cmpl $0x0, 0x68(%rsp)
jle 0x27104
testl %r14d, %r14d
jle 0x27104
cmpl $0x3, 0x78(%r12)
jl 0x2706d
movq 0x2cff3(%rip), %rdi     # 0x53fe8
leaq 0x1e4dd(%rip), %rsi     # 0x454d9
movl $0x20, %edx
callq 0x7340
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq 0x2cfbf(%rip), %rdi     # 0x53fe8
callq 0x71c0
movq %rax, %r13
leaq 0x1e64f(%rip), %rsi     # 0x45687
movl $0xb, %edx
movq %rax, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0xc(%rsp), %rax
leaq 0x10(%rsp), %r9
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq 0x50(%rsp), %r8
pushq %rbp
pushq %rax
callq 0x26902
addq $0x10, %rsp
cmpl $0x3, 0x78(%r12)
jl 0x27104
movq 0x2cf44(%rip), %rdi     # 0x53fe8
leaq 0x1e44f(%rip), %rsi     # 0x454fa
movl $0x6, %edx
callq 0x7340
movl 0xc(%rsp), %esi
movq 0x2cf28(%rip), %rdi     # 0x53fe8
callq 0x75d0
movq %rax, %r13
leaq 0x1e5ad(%rip), %rsi     # 0x4567c
movl $0x16, %edx
movq %rax, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x68(%rsp), %rax
cmpl %r14d, %eax
cmovgl %eax, %r14d
testl %r14d, %r14d
jle 0x2729c
movq 0x50(%rsp), %rax
cmpb $0x0, 0x14(%rax)
je 0x2729c
movq 0x60(%rsp), %rax
cmpl %eax, 0xc(%rsp)
jg 0x2729c
cmpl $0x2, 0x78(%r12)
jl 0x27186
movq 0x2cea2(%rip), %r13     # 0x53fe8
leaq 0x1e3b4(%rip), %rsi     # 0x45501
movl $0xd, %edx
movq %r13, %rdi
callq 0x7340
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2ce6f(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
cmpl $0x3, 0x78(%r12)
jl 0x271d5
movq 0x2ce53(%rip), %r13     # 0x53fe8
leaq 0x1e373(%rip), %rsi     # 0x4550f
movl $0x33, %edx
movq %r13, %rdi
callq 0x7340
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq 0x2ce20(%rip), %rdi     # 0x53fe8
callq 0x7040
movq %rax, %rdi
callq 0x71d0
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq $0x8, %rsp
leaq 0x14(%rsp), %r10
leaq 0x18(%rsp), %r9
movq 0x60(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq 0x58(%rsp), %r8
pushq %rbp
pushq %r10
pushq %rax
callq 0x2610c
addq $0x20, %rsp
cmpl $0x3, 0x78(%r12)
jl 0x27285
movq 0x2cdc3(%rip), %rdi     # 0x53fe8
leaq 0x1e317(%rip), %rsi     # 0x45543
movl $0x1d, %edx
callq 0x7340
movl 0xc(%rsp), %esi
movq 0x2cda7(%rip), %rdi     # 0x53fe8
callq 0x75d0
movq %rax, %r13
leaq 0x1e42c(%rip), %rsi     # 0x4567c
movl $0x16, %edx
movq %rax, %rdi
callq 0x7340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2729c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
movl 0xc8(%rbx), %ebp
cmpl $0x2, 0x78(%r12)
jl 0x272fa
movq 0x2cd37(%rip), %rdi     # 0x53fe8
leaq 0x1e2a9(%rip), %rsi     # 0x45561
movl $0x11, %edx
callq 0x7340
movq 0x2cd1f(%rip), %rdi     # 0x53fe8
movl %ebp, %esi
callq 0x75d0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq 0x50(%rsp), %rax
cmpb $0x1, 0x9(%rax)
jne 0x27320
movq 0x60(%rsp), %rax
cmpl %eax, 0xc(%rsp)
jg 0x27320
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x25b75
cmpl $0x2, 0x78(%r12)
jl 0x2737e
movq 0x2ccb9(%rip), %rdi     # 0x53fe8
leaq 0x1e23d(%rip), %rsi     # 0x45573
movl $0x11, %edx
callq 0x7340
movl 0xc8(%rbx), %esi
subl %ebp, %esi
movq 0x2cc99(%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
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x27395
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x273c9
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
jmp 0x273c9
jmp 0x273c6
jmp 0x273c6
jmp 0x273c6
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x273e0
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
movq %rbx, %rdi
callq 0x7600