// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/src/varcall.cpp
// Function: alignmentInternalPrint(BamTools::BamAlignment&, FastaReference&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void alignmentInternalPrint(BamAlignment & al,
                            FastaReference & targetFa,
                            std::string & refName )
{

    long int qPos = 0;
    long int rPos = al.Position;

    float pctA;
    int mbA;
    int qStart;
    int qEnd;

    al.GetTag<float>("PI", pctA);
    al.GetTag<int>("MB", mbA   );
    al.GetTag<int>("QE", qStart);
    al.GetTag<int>("QS", qEnd  );


    for(std::vector< CigarOp >::iterator it = al.CigarData.begin();
        it != al.CigarData.end(); it++){

        if(it->Length > 20){

            if(it->Type == 'I'){
                std::cout << refName
                          << "\t" << rPos
                          << "\t" << rPos
                          << "\t" << "INS:INTERNAL"
                          << "\t" << it->Length
                          << "\t" << pctA
                          << "\t" << mbA
                          << "\t" << al.Name
                          << "\t" << qStart
                          << "\t" << qEnd
                          << "\t" << al.QueryBases.substr(qPos, it->Length)
                          << std::endl;
            }
            if(it->Type == 'D'){
                std::cout << refName
                          << "\t" << rPos
                          << "\t" << (rPos + it->Length)
                          << "\t" << "DEL:INTERNAL"
                          << "\t" << it->Length
                          << "\t" << pctA
                          << "\t" << mbA
                          << "\t" << al.Name
                          << "\t" << qStart
                          << "\t" << qEnd
                          << "\t" << targetFa.getSubSequence(refName,
                                                             rPos, it->Length)
                          << std::endl;
            }
        }
        advanceQuery(it->Type,     it->Length, &qPos);
        advanceReference(it->Type, it->Length, &rPos);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, 0x50(%rsp)
andq $0x0, 0x48(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %r15
movslq 0xac(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x218ab(%rip), %rsi     # 0x2f0b6
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x96f2
leaq 0x28(%rsp), %rsi
leaq 0x24(%rsp), %rdx
movq %r15, %rdi
callq 0xe916
leaq 0x28(%rsp), %rdi
callq 0x58f8
leaq 0x217e9(%rip), %rsi     # 0x2f026
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x96f2
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x966e
leaq 0x28(%rsp), %rdi
callq 0x58f8
leaq 0x217ba(%rip), %rsi     # 0x2f029
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x96f2
leaq 0x28(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
movq %r15, %rdi
callq 0x966e
leaq 0x28(%rsp), %rdi
callq 0x58f8
leaq 0x2177f(%rip), %rsi     # 0x2f020
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x96f2
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x966e
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x58f8
movq 0xb8(%r15), %rbp
leaq 0x28(%r15), %rax
movq %rax, 0x58(%rsp)
leaq 0x21f99(%rip), %r14     # 0x2f87f
leaq 0x48(%rsp), %rbx
cmpq 0xc0(%r15), %rbp
je 0xdbb6
cmpl $0x15, 0x4(%rbp)
movb (%rbp), %al
jb 0xdb8e
cmpb $0x49, %al
jne 0xda33
movq 0x3d6bc(%rip), %rdi     # 0x4afd0
movq 0x50(%rsp), %rsi
callq 0x53b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %rdi
leaq 0x218ef(%rip), %rsi     # 0x2f252
callq 0x5430
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x4(%rbp), %esi
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movss 0x24(%rsp), %xmm0
movq %rax, %rdi
callq 0x5320
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x20(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %rdi
movq %r15, %rsi
callq 0x53b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x1c(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x18(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %r13
movq 0x48(%rsp), %rdx
movl 0x4(%rbp), %ecx
movq %r12, %rdi
movq 0x58(%rsp), %rsi
callq 0x5470
movq %r13, %rdi
movq %r12, %rsi
callq 0x53b0
movq %rax, %rdi
callq 0x51f0
movq %r12, %rdi
callq 0x58f8
movb (%rbp), %al
cmpb $0x44, %al
jne 0xdb8e
movq 0x3d58e(%rip), %rdi     # 0x4afd0
movq 0x50(%rsp), %r12
movq %r12, %rsi
callq 0x53b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x4(%rbp), %esi
addq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %rdi
leaq 0x217c8(%rip), %rsi     # 0x2f25f
callq 0x5430
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x4(%rbp), %esi
movq %rax, %rdi
callq 0x52c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movss 0x24(%rsp), %xmm0
movq %rax, %rdi
callq 0x5320
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x20(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %rdi
movq %r15, %rsi
callq 0x53b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x1c(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movl 0x18(%rsp), %esi
movq %rax, %rdi
callq 0x57b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x5430
movq %rax, %r13
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x28(%rsp), %r12
callq 0x5600
movl 0x10(%rsp), %ecx
movl 0x4(%rbp), %r8d
movq %r12, %rdi
movq 0x60(%rsp), %rsi
movq %rbx, %rdx
callq 0xfbfe
movq %r13, %rdi
movq %r12, %rsi
callq 0x53b0
movq %rax, %rdi
callq 0x51f0
movq %r12, %rdi
callq 0x58f8
leaq 0x68(%rsp), %rdi
callq 0x58f8
movb (%rbp), %al
leaq 0x48(%rsp), %rbx
movl 0x4(%rbp), %esi
movsbl %al, %edi
movq %rbx, %rdx
callq 0xc726
movsbl (%rbp), %edi
movl 0x4(%rbp), %esi
leaq 0x10(%rsp), %rdx
callq 0xc76e
addq $0x8, %rbp
jmp 0xd8eb
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xdbe0
jmp 0xdbd6
jmp 0xdbe0
jmp 0xdbd6
jmp 0xdbe0
jmp 0xdbd6
jmp 0xdbe0
movq %rax, %rbx
jmp 0xdc01
movq %rax, %rbx
jmp 0xdbf7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0xdbfc
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x58f8
leaq 0x68(%rsp), %rdi
callq 0x58f8
movq %rbx, %rdi
callq 0x57d0