// File: 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
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2cdf0
movl %eax, -0x1d4(%rbp)
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, %rcx
movl -0x1d4(%rbp), %eax
cmpl 0xac(%rcx), %eax
jne 0x22345
movb $0x0, -0x1(%rbp)
jmp 0x22ba7
movq -0x10(%rbp), %rdi
callq 0x23fd0
movl 0xa8(%rax), %eax
movl %eax, -0x1d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, %rcx
movl -0x1d8(%rbp), %eax
cmpl 0xa8(%rcx), %eax
je 0x2237d
movb $0x0, -0x1(%rbp)
jmp 0x22ba7
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, -0x1e8(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x6a20
movq -0x1e0(%rbp), %rdx
leaq 0x5dd36(%rip), %rsi     # 0x800e1
leaq -0x60(%rbp), %rdi
callq 0x11570
jmp 0x223b6
movq -0x1e8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x24(%rbp), %rdx
callq 0x111c0
jmp 0x223cc
leaq -0x60(%rbp), %rdi
callq 0x6ba8
leaq -0x61(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, -0x1f8(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x6a20
movq -0x1f0(%rbp), %rdx
leaq 0x5dcc9(%rip), %rsi     # 0x800d8
leaq -0x98(%rbp), %rdi
callq 0x11570
jmp 0x2241d
movq -0x1f8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x111c0
jmp 0x22436
leaq -0x98(%rbp), %rdi
callq 0x6ba8
leaq -0x99(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, -0x208(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x6a20
movq -0x200(%rbp), %rdx
leaq 0x5dc9c(%rip), %rsi     # 0x8011b
leaq -0xc0(%rbp), %rdi
callq 0x11570
jmp 0x2248d
movq -0x208(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x111c0
jmp 0x224a6
leaq -0xc0(%rbp), %rdi
callq 0x6ba8
leaq -0xc1(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, -0x218(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x6a20
movq -0x210(%rbp), %rdx
leaq 0x5dc2c(%rip), %rsi     # 0x8011b
leaq -0xe8(%rbp), %rdi
callq 0x11570
jmp 0x224fd
movq -0x218(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x111c0
jmp 0x22516
leaq -0xe8(%rbp), %rdi
callq 0x6ba8
leaq -0xe9(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, -0x228(%rbp)
leaq -0x111(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x6a20
movq -0x220(%rbp), %rdx
leaq 0x5dc0f(%rip), %rsi     # 0x8016e
leaq -0x110(%rbp), %rdi
callq 0x11570
jmp 0x2256d
movq -0x228(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x34(%rbp), %rdx
callq 0x23c20
jmp 0x22586
leaq -0x110(%rbp), %rdi
callq 0x6ba8
leaq -0x111(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, -0x238(%rbp)
leaq -0x139(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x6a20
movq -0x230(%rbp), %rdx
leaq 0x5db9f(%rip), %rsi     # 0x8016e
leaq -0x138(%rbp), %rdi
callq 0x11570
jmp 0x225dd
movq -0x238(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x23c20
jmp 0x225f6
leaq -0x138(%rbp), %rdi
callq 0x6ba8
leaq -0x139(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, -0x248(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x6a20
movq -0x240(%rbp), %rdx
leaq 0x5da9f(%rip), %rsi     # 0x800de
leaq -0x160(%rbp), %rdi
callq 0x11570
jmp 0x2264d
movq -0x248(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x111c0
jmp 0x22666
leaq -0x160(%rbp), %rdi
callq 0x6ba8
leaq -0x161(%rbp), %rdi
callq 0x6600
movq -0x10(%rbp), %rdi
callq 0x128a0
movq %rax, -0x258(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x6a20
movq -0x250(%rbp), %rdx
leaq 0x5da2f(%rip), %rsi     # 0x800de
leaq -0x188(%rbp), %rdi
callq 0x11570
jmp 0x226bd
movq -0x258(%rbp), %rdi
leaq -0x188(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x111c0
jmp 0x226d6
leaq -0x188(%rbp), %rdi
callq 0x6ba8
leaq -0x189(%rbp), %rdi
callq 0x6600
movl -0x2c(%rbp), %eax
subl -0x30(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
cmpl $0x1, %eax
jle 0x228bf
movb $0x0, -0x1(%rbp)
jmp 0x22ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x6ba8
leaq -0x61(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22764
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6ba8
leaq -0x99(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2279b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x6ba8
leaq -0xc1(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x227d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x6ba8
leaq -0xe9(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22809
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x6ba8
leaq -0x111(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22840
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x6ba8
leaq -0x139(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x6ba8
leaq -0x161(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x228ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x6ba8
leaq -0x189(%rbp), %rdi
callq 0x6600
jmp 0x22bb5
movq -0x10(%rbp), %rdi
callq 0x128a0
movl 0xac(%rax), %eax
movl %eax, -0x25c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2cdf0
movl %eax, %ecx
movl -0x25c(%rbp), %eax
subl %ecx, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, -0x190(%rbp)
cmpl $0x14, -0x190(%rbp)
jge 0x22912
movb $0x0, -0x1(%rbp)
jmp 0x22ba7
movq -0x20(%rbp), %rsi
movq 0x8b6b3(%rip), %rdi     # 0xadfd0
callq 0x64c0
movq %rax, %rdi
leaq 0x5e44b(%rip), %rsi     # 0x80d77
movq %rsi, -0x280(%rbp)
callq 0x6560
movq %rax, -0x2a0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq %rax, %rdi
xorl %edx, %edx
movl %edx, -0x264(%rbp)
movl %edx, %esi
callq 0x2cdf0
movq -0x2a0(%rbp), %rdi
movl %eax, %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, -0x298(%rbp)
movq -0x10(%rbp), %rdi
callq 0x128a0
movq -0x298(%rbp), %rdi
movl 0xac(%rax), %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
leaq 0x5dbfc(%rip), %rsi     # 0x805ae
callq 0x6560
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movl -0x190(%rbp), %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movss -0x34(%rbp), %xmm0
callq 0x63e0
movq %rax, %rdi
leaq 0x5dbc0(%rip), %rsi     # 0x805ba
movq %rsi, -0x290(%rbp)
callq 0x6560
movq %rax, %rdi
movss -0x38(%rbp), %xmm0
callq 0x63e0
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movl -0x3c(%rbp), %esi
callq 0x6a00
movq -0x290(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movl -0x40(%rbp), %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, -0x288(%rbp)
movq -0x10(%rbp), %rdi
callq 0x23fd0
movq -0x288(%rbp), %rdi
movq %rax, %rsi
callq 0x64c0
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movl -0x24(%rbp), %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, %rdi
movl -0x28(%rbp), %esi
callq 0x6a00
movq -0x280(%rbp), %rsi
movq %rax, %rdi
callq 0x6560
movq %rax, -0x278(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x270(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
callq 0x6200
movq -0x10(%rbp), %rdi
callq 0x23fd0
movl -0x264(%rbp), %edx
movq %rax, %rdi
movl %edx, %esi
callq 0x2cdf0
movl %eax, -0x260(%rbp)
jmp 0x22afb
movl -0x260(%rbp), %ecx
movq -0x270(%rbp), %rsi
movl -0x190(%rbp), %r8d
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
callq 0x26340
jmp 0x22b24
movq -0x278(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x64c0
movq %rax, -0x2a8(%rbp)
jmp 0x22b40
movq -0x2a8(%rbp), %rdi
movq 0x8b45a(%rip), %rsi     # 0xadfa8
callq 0x65c0
jmp 0x22b55
leaq -0x1b0(%rbp), %rdi
callq 0x6ba8
leaq -0x1d0(%rbp), %rdi
callq 0x6ba8
movb $0x1, -0x1(%rbp)
jmp 0x22ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22b99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x6ba8
leaq -0x1d0(%rbp), %rdi
callq 0x6ba8
jmp 0x22bb5
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x6a10
nop