// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/src/varcall.cpp
// Function: largeDeletionPrint(std::__cxx11::list<BamTools::BamAlignment, std::allocator<BamTools::BamAlignment>>&, FastaReference&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool largeDeletionPrint(std::list<BamAlignment> & twoReads,
                        FastaReference & targetFasta,
                        std::string & refName ){

    if(twoReads.front().GetEndPosition() == twoReads.back().Position){
        return false;
    }

    if(twoReads.front().RefID != twoReads.back().RefID){
        return false;
    }

    /* start and end of the SV relative to query */

    int qStart ;
    int qEnd   ;

    int alA ;
    int alB ;

    float pctA;
    float pctB;

    int mbA;
    int mbB;


    twoReads.front().GetTag<int>("QE", qStart);
    twoReads.back().GetTag<int>("QS", qEnd);

    twoReads.front().GetTag<int>("AI", alA);
    twoReads.back().GetTag<int>("AI", alB);

    twoReads.front().GetTag<float>("PI", pctA);
    twoReads.back().GetTag<float>("PI", pctB);

    twoReads.front().GetTag<int>("MB", mbA);
    twoReads.back().GetTag<int>("MB", mbB);


    if(abs(alA - alB) > 1){
        return false;
    }

    int deletionL = abs( twoReads.back().Position -
                         twoReads.front().GetEndPosition());

    if(deletionL < 20){
        return false;
    }

    std::cout << refName
              << "\t" << twoReads.front().GetEndPosition()
              << "\t" << twoReads.back().Position
              << "\t" << "DEL:BETWEEN"
              << "\t" << deletionL
              << "\t" << pctA << "," << pctB
              << "\t" << mbA << "," << mbB
              << "\t" << twoReads.front().Name
              << "\t" << qStart
              << "\t" << qEnd
              << "\t" << targetFasta.getSubSequence(refName,
                                                   twoReads.front().GetEndPosition(),
                                                    deletionL) << std::endl;


    return true;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
addq $0x10, %rdi
xorl %r12d, %r12d
xorl %esi, %esi
xorl %edx, %edx
callq 0x11df4
movq 0x8(%r14), %rcx
cmpl 0xbc(%rcx), %eax
je 0xde3a
movq (%r14), %r12
movl 0xb8(%r12), %eax
cmpl 0xb8(%rcx), %eax
jne 0xde37
leaq 0x213c8(%rip), %rsi     # 0x2f029
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x44(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq 0x8(%r14), %r12
leaq 0x21385(%rip), %rsi     # 0x2f020
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq (%r14), %r12
leaq 0x2138f(%rip), %rsi     # 0x2f063
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x3c(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq 0x8(%r14), %r12
leaq 0x21355(%rip), %rsi     # 0x2f063
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq (%r14), %r12
leaq 0x2136f(%rip), %rsi     # 0x2f0b6
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x34(%rsp), %rdx
movq %r12, %rdi
callq 0xe916
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq 0x8(%r14), %r12
leaq 0x21335(%rip), %rsi     # 0x2f0b6
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0xe916
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq (%r14), %r12
leaq 0x2126c(%rip), %rsi     # 0x2f026
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x2c(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movq 0x8(%r14), %r12
leaq 0x21232(%rip), %rsi     # 0x2f026
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x96f2
addq $0x10, %r12
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x966e
leaq 0x8(%rsp), %rdi
callq 0x58f8
movl 0x3c(%rsp), %eax
subl 0x38(%rsp), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x1, %ecx
jbe 0xde4c
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
movq 0x8(%r14), %rax
movl 0xbc(%rax), %r13d
addq $0x10, %rdi
xorl %r12d, %r12d
xorl %esi, %esi
xorl %edx, %edx
callq 0x11df4
subl %eax, %r13d
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
cmpl $0x14, %ebp
jb 0xde3a
movq 0x3d14e(%rip), %rdi     # 0x4afd0
movq %r15, %rsi
callq 0x53b0
leaq 0x219ee(%rip), %r12     # 0x2f87f
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movq %rax, %r13
movq (%r14), %rdi
addq $0x10, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11df4
movq %r13, %rdi
movl %eax, %esi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movq 0x8(%r14), %rcx
movl 0xbc(%rcx), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
leaq 0x21384(%rip), %rsi     # 0x2f26c
movq %rax, %rdi
callq 0x5430
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movq %rax, %rdi
movl %ebp, %esi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movss 0x34(%rsp), %xmm0
movq %rax, %rdi
callq 0x5320
leaq 0x21353(%rip), %r13     # 0x2f278
movq %rax, %rdi
movq %r13, %rsi
callq 0x5430
movss 0x30(%rsp), %xmm0
movq %rax, %rdi
callq 0x5320
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movl 0x2c(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r13, %rsi
callq 0x5430
movl 0x28(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movq (%r14), %rsi
addq $0x10, %rsi
movq %rax, %rdi
callq 0x53b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movl 0x44(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movl 0x40(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5430
movq %rax, %r12
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x5600
movq (%r14), %rdi
addq $0x10, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11df4
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %rbx, %rsi
movl %eax, %ecx
movl %ebp, %r8d
callq 0xfbfe
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x53b0
movq %rax, %rdi
callq 0x51f0
leaq 0x8(%rsp), %rdi
callq 0x58f8
leaq 0x48(%rsp), %rdi
callq 0x58f8
movb $0x1, %r12b
jmp 0xde3a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x58f8
jmp 0xe039
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xe064
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
jmp 0xe05c
jmp 0xe06b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x58f8
jmp 0xe06e
movq %rax, %rbx
movq %rbx, %rdi
callq 0x57d0