// File: /workspace/github_cpp_makefile_star2_O3/readmapping[P]alfalfa/src/mapper.cpp
// Function: calculateDiscordantAlignments(sparseSA const&, read_t&, read_t&)
void calculateDiscordantAlignments(const sparseSA& sa, read_t & mate1, read_t & mate2){
    if(!mate1.alignments.empty() && !mate2.alignments.empty()){
        sort(mate1.alignments.begin(),mate1.alignments.end(), compAlignments);
        sort(mate2.alignments.begin(),mate2.alignments.end(), compAlignments);
        //FIND MAX SCORE OF BOTH MATES
        int maxScoreFirst = mate1.alignments[0]->alignmentScore;
        int maxScoreSecond = mate2.alignments[0]->alignmentScore;
        //DISCORDANT ONLY BETWEEN UNPAIRED MAX SCORE ALIGNMENTS
        size_t mate1AlnCount = mate1.alignments.size();
        size_t mate2AlnCount = mate2.alignments.size();
        size_t i = 0;
        while(i < mate1AlnCount && mate1.alignments[i]->alignmentScore == maxScoreFirst){
            if(!mate1.alignments[i]->concordant()){
                size_t j = i;
                while(j < mate2AlnCount && mate2.alignments[j]->alignmentScore == maxScoreSecond){
                    if(!mate2.alignments[j]->concordant())
                        setPaired(sa, mate1,mate2,i,j,false);
                    j++;
                }
            }
            i++;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0xb0(%rsi), %r12
movq %rsi, 0x18(%rsp)
movq 0xb8(%rsi), %r13
cmpq %r13, %r12
je 0x25e83
movq 0xb0(%rdx), %rax
cmpq 0xb8(%rdx), %rax
je 0x25e83
movq %rdx, 0x8(%rsp)
movq %r13, %rbx
subq %r12, %rbx
movq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x576f(%rip), %rcx     # 0x20395
movq %r12, %rdi
movq %r13, %rsi
callq 0x2f69f
leaq 0x8(%r12), %rbp
cmpq $0x81, %rbx
jl 0x25bda
movq %r13, 0x10(%rsp)
movl $0x8, %r15d
movq %rbp, %r14
movq %r12, %r13
movq %r13, %rcx
leaq (%r12,%r15), %r13
movq (%r12,%r15), %rbx
movq (%r12), %rdx
movl 0x70(%rbx), %eax
cmpl 0x70(%rdx), %eax
jle 0x25b5c
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x7570
movq %r12, %rcx
jmp 0x25b7a
movq (%rcx), %rdx
movq %r13, %rcx
cmpl 0x70(%rdx), %eax
jle 0x25b7a
movq %r14, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl 0x70(%rdx), %eax
jg 0x25b6a
movq %rbx, (%rcx)
addq $0x8, %r15
addq $0x8, %r14
cmpq $0x80, %r15
jne 0x25b32
subq $-0x80, %r12
movq 0x10(%rsp), %rdi
cmpq %rdi, %r12
movq 0x8(%rsp), %rbx
je 0x25c42
movq -0x8(%r12), %rcx
movq (%r12), %rax
movl 0x70(%rax), %edx
movq %r12, %rsi
cmpl 0x70(%rcx), %edx
jle 0x25bcc
movq %r12, %rsi
movq %rcx, (%rsi)
movq -0x10(%rsi), %rcx
addq $-0x8, %rsi
cmpl 0x70(%rcx), %edx
jg 0x25bbc
movq %rax, (%rsi)
addq $0x8, %r12
cmpq %rdi, %r12
jne 0x25ba5
jmp 0x25c42
cmpq %r13, %rbp
movq 0x8(%rsp), %rbx
je 0x25c42
movq %r12, %r14
movq %r14, %rdi
movq %rbp, %r14
movq (%rbp), %r15
movq (%r12), %rcx
movl 0x70(%r15), %eax
cmpl 0x70(%rcx), %eax
jle 0x25c18
movq %r14, %rdx
subq %r12, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x7570
movq %r12, %rcx
jmp 0x25c36
movq (%rdi), %rdx
movq %r14, %rcx
cmpl 0x70(%rdx), %eax
jle 0x25c36
movq %r14, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl 0x70(%rdx), %eax
jg 0x25c26
movq %r15, (%rcx)
leaq 0x8(%r14), %rbp
cmpq %r13, %rbp
jne 0x25be7
movq 0xb0(%rbx), %r12
movq 0xb8(%rbx), %r13
cmpq %r13, %r12
je 0x25db8
movq %r13, %rbx
subq %r12, %rbx
movq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x58e5(%rip), %rcx     # 0x20395
movq %r12, %rdi
movq %r13, %rsi
callq 0x2f69f
leaq 0x8(%r12), %rbp
cmpq $0x81, %rbx
jl 0x25d50
movq %r13, 0x10(%rsp)
movl $0x8, %r15d
movq %rbp, %r14
movq %r12, %r13
movq %r13, %rcx
leaq (%r12,%r15), %r13
movq (%r12,%r15), %rbx
movq (%r12), %rdx
movl 0x70(%rbx), %eax
cmpl 0x70(%rdx), %eax
jle 0x25cd2
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x7570
movq %r12, %rcx
jmp 0x25cf0
movq (%rcx), %rdx
movq %r13, %rcx
cmpl 0x70(%rdx), %eax
jle 0x25cf0
movq %r14, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl 0x70(%rdx), %eax
jg 0x25ce0
movq %rbx, (%rcx)
addq $0x8, %r15
addq $0x8, %r14
cmpq $0x80, %r15
jne 0x25ca8
subq $-0x80, %r12
movq 0x10(%rsp), %rdi
cmpq %rdi, %r12
movq 0x8(%rsp), %rbx
je 0x25db8
movq -0x8(%r12), %rcx
movq (%r12), %rax
movl 0x70(%rax), %edx
movq %r12, %rsi
cmpl 0x70(%rcx), %edx
jle 0x25d42
movq %r12, %rsi
movq %rcx, (%rsi)
movq -0x10(%rsi), %rcx
addq $-0x8, %rsi
cmpl 0x70(%rcx), %edx
jg 0x25d32
movq %rax, (%rsi)
addq $0x8, %r12
cmpq %rdi, %r12
jne 0x25d1b
jmp 0x25db8
cmpq %r13, %rbp
movq 0x8(%rsp), %rbx
je 0x25db8
movq %r12, %r14
movq %r14, %rdi
movq %rbp, %r14
movq (%rbp), %r15
movq (%r12), %rcx
movl 0x70(%r15), %eax
cmpl 0x70(%rcx), %eax
jle 0x25d8e
movq %r14, %rdx
subq %r12, %rdx
subq %rdx, %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x7570
movq %r12, %rcx
jmp 0x25dac
movq (%rdi), %rdx
movq %r14, %rcx
cmpl 0x70(%rdx), %eax
jle 0x25dac
movq %r14, %rcx
movq %rdx, (%rcx)
movq -0x10(%rcx), %rdx
addq $-0x8, %rcx
cmpl 0x70(%rdx), %eax
jg 0x25d9c
movq %r15, (%rcx)
leaq 0x8(%r14), %rbp
cmpq %r13, %rbp
jne 0x25d5d
movq 0x18(%rsp), %rcx
movq 0xb0(%rcx), %rax
movq 0xb8(%rcx), %r13
subq %rax, %r13
je 0x25e83
movq (%rax), %rax
movl 0x70(%rax), %eax
movl %eax, 0x8(%rsp)
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rbp
movq (%rax), %rcx
movl 0x70(%rcx), %r14d
subq %rax, %rbp
sarq $0x3, %rbp
sarq $0x3, %r13
cmpq $0x1, %r13
adcq $0x0, %r13
xorl %r12d, %r12d
movq 0x18(%rsp), %rax
movq 0xb0(%rax), %rax
movq (%rax,%r12,8), %rax
movl 0x8(%rsp), %ecx
cmpl %ecx, 0x70(%rax)
jne 0x25e83
movb 0xdc(%rax), %cl
andb 0x40(%rax), %cl
testb $0x1, %cl
jne 0x25e7b
cmpq %rbp, %r12
jae 0x25e7b
movq %r12, %r15
movq 0xb0(%rbx), %rax
movq (%rax,%r15,8), %rax
cmpl %r14d, 0x70(%rax)
jne 0x25e7b
testb $0x1, 0x40(%rax)
je 0x25e58
testb $0x1, 0xdc(%rax)
jne 0x25e73
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbx, %rdx
movl %r12d, %ecx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x25907
incq %r15
cmpq %rbp, %r15
jb 0x25e38
incq %r12
cmpq %r13, %r12
jne 0x25e09
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq