// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_convert.cpp
// Function: BamTools::ConvertTool::ConvertToolPrivate::PrintFasta(BamTools::BamAlignment const&)
void ConvertTool::ConvertToolPrivate::PrintFasta(const BamAlignment& a) { 
    
    // >BamAlignment.Name
    // BamAlignment.QueryBases (up to FASTA_LINE_MAX bases per line)
    // ...
    //
    // N.B. - QueryBases are reverse-complemented if aligned to reverse strand
  
    // print header
    m_out << ">" << a.Name << endl;
    
    // handle reverse strand alignment - bases 
    string sequence = a.QueryBases;
    if ( a.IsReverseStrand() )
        Utilities::ReverseComplement(sequence);
    
    // if sequence fits on single line
    if ( sequence.length() <= FASTA_LINE_MAX )
        m_out << sequence << endl;
    
    // else split over multiple lines
    else {
      
        size_t position = 0;
        size_t seqLength = sequence.length(); // handle reverse strand alignment - bases & qualitiesth();
        
        // write subsequences to each line
        while ( position < (seqLength - FASTA_LINE_MAX) ) {
            m_out << sequence.substr(position, FASTA_LINE_MAX) << endl;
            position += FASTA_LINE_MAX;
        }
        
        // write final subsequence
        m_out << sequence.substr(position) << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x20, %rbx
leaq 0x48d4a(%rip), %rsi     # 0x740df
movl $0x1, %edx
movq %rbx, %rdi
callq 0x276c0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %r15, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x2f122
movq %r14, %rdi
callq 0x27800
testb %al, %al
je 0x2b40f
leaq 0x28(%rsp), %rdi
callq 0x66dc0
movq 0x30(%rsp), %r14
cmpq $0x33, %r14
jae 0x2b459
movq 0x28(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x276c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
jmp 0x2b545
xorl %r15d, %r15d
addq $-0x32, %r14
je 0x2b4d8
leaq 0x8(%rsp), %r12
leaq 0x28(%rsp), %r13
movl $0x32, %ecx
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x27600
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbp, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2b4cf
callq 0x27560
addq $0x32, %r15
cmpq %r14, %r15
jb 0x2b46c
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
movq $-0x1, %rcx
callq 0x27600
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
leaq 0x38(%rsp), %r15
callq 0x276c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b545
callq 0x27560
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x2b554
callq 0x27560
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b575
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x2b587
jmp 0x2b575
movq %rax, %rbx
jmp 0x2b591
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2b591
callq 0x27560
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2b5a5
callq 0x27560
movq %rbx, %rdi
callq 0x27b20
nop