LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BamReaderPrivate::Open(const string& filename) {

    try {

        // make sure we're starting with fresh state
        Close();

        // open BgzfStream
        m_stream.Open(filename, IBamIODevice::ReadOnly);

        // load BAM metadata
        LoadHeaderData();
        LoadReferenceData();

        // store filename & offset of first alignment
        m_filename = filename;
        m_alignmentsBeginOffset = m_stream.Tell();

        // return success
        return true;

    } catch ( BamException& e ) {
        const string error = e.what();
        const string message = string("could not open file: ") + filename +
                               "\n\t" + error;
        SetErrorString("BamReader::Open", message);
        return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x33a50
leaq 0x1e8(%rbx), %r14
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x34d60
movq %rbx, %rdi
callq 0x31be0
movq %rbx, %rdi
callq 0x34790
leaq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0x32060
movq %r14, %rdi
callq 0x33900
movq %rax, (%rbx)
movb $0x1, %al
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x44c09
movq %r14, %rdi
callq 0x31bb0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %rax, %rsi
callq 0x31b30
leaq 0x16ab7(%rip), %rsi     # 0x5b596
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq %r15, %rdx
callq 0x355e0
leaq 0x1702d(%rip), %rdx     # 0x5bb34
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x33c40
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x355e0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rdi
callq 0x33a00
leaq 0x70(%rsp), %rdi
callq 0x33a00
leaq 0x17089(%rip), %rsi     # 0x5bbdb
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x31b30
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x335a0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x50(%rsp), %rdi
callq 0x33a00
leaq 0x90(%rsp), %rdi
callq 0x33a00
callq 0x34970
xorl %eax, %eax
jmp 0x44a99
jmp 0x44bc2
jmp 0x44bd6
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x44bca
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x44be3
movq %rax, %r14
jmp 0x44c04
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x33a00
jmp 0x44bf7
movq %rax, %r14
jmp 0x44bf7
movq %rax, %r14
jmp 0x44bed
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x33a00
leaq 0x70(%rsp), %rdi
callq 0x33a00
leaq 0x90(%rsp), %rdi
callq 0x33a00
callq 0x34970
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::OpenIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BamReaderPrivate::OpenIndex(const std::string& indexFilename) {

    if ( m_randomAccessController.OpenIndex(indexFilename, this) )
        return true;
    else {
        const string bracError = m_randomAccessController.GetErrorString();
        const string message = string("could not open index: \n\t") + bracError;
        SetErrorString("BamReader::OpenIndex", message);
        return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %r14
leaq 0x1a8(%rdi), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x32c00
movl %eax, %ebx
testb %al, %al
jne 0x44cc9
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x34660
leaq 0x16f95(%rip), %rsi     # 0x5bbeb
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x355e0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x16f7a(%rip), %rsi     # 0x5bc04
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %r14, %rdi
callq 0x335a0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rdi
callq 0x33a00
leaq 0x50(%rsp), %rdi
callq 0x33a00
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x44d04
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x44cf8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x44d07
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x33a00
jmp 0x44d07
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::Rewind()
bool BamReaderPrivate::Rewind(void) {

    // reset region
    m_randomAccessController.ClearRegion();

    // return status of seeking back to first alignment
    if ( Seek(m_alignmentsBeginOffset) )
        return true;
    else {
        const string currentError = m_errorString;
        const string message = string("could not rewind: \n\t") + currentError;
        SetErrorString("BamReader::Rewind", message);
        return false;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x32ff0
movq %r14, %rdi
movq %r14, %rsi
callq 0x33190
movl %eax, %ebx
testb %al, %al
jne 0x44dd8
leaq 0x228(%r14), %rsi
leaq 0x48(%rsp), %rdi
callq 0x33ff0
leaq 0x16eb4(%rip), %rsi     # 0x5bc19
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x355e0
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x16e95(%rip), %rsi     # 0x5bc2e
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x335a0
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x48(%rsp), %rdi
callq 0x33a00
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
jmp 0x44e11
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x44e05
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x44e14
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x44e14
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::Seek(long const&)
bool BamReaderPrivate::Seek(const int64_t& position) {

    // skip if BAM file not open
    if ( !IsOpen() ) {
        SetErrorString("BamReader::Seek", "cannot seek on unopened BAM file");
        return false;
    }

    try {
        m_stream.Seek(position);
        return true;
    }
    catch ( BamException& e ) {
        const string streamError = e.what();
        const string message = string("could not seek in BAM file: \n\t") + streamError;
        SetErrorString("BamReader::Seek", message);
        return false;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1e8(%rdi), %r15
movq %r15, %rdi
callq 0x349d0
testb %al, %al
je 0x44e61
movb $0x1, %bpl
movq %r15, %rdi
movq %r14, %rsi
callq 0x32df0
jmp 0x44eb5
leaq 0x16dd8(%rip), %rsi     # 0x5bc40
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x31b30
leaq 0x16dd2(%rip), %rsi     # 0x5bc50
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x335a0
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x48(%rsp), %rdi
callq 0x33a00
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x44fd9
movq %rax, %r14
cmpl $0x1, %edx
jne 0x44fe3
movq %r14, %rdi
callq 0x31bb0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rax, %rsi
callq 0x31b30
leaq 0x16d67(%rip), %rsi     # 0x5bc71
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x355e0
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x16d02(%rip), %rsi     # 0x5bc40
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x335a0
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x48(%rsp), %rdi
callq 0x33a00
callq 0x34970
jmp 0x44eb3
jmp 0x44fa9
jmp 0x44fbd
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x44fb1
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x44fc0
movq %rax, %r14
jmp 0x44fca
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x44fc0
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x33a00
callq 0x34970
jmp 0x44fe3
movq %rax, %r14
jmp 0x44fe3
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x33a00
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::SetRegion(BamTools::BamRegion const&)
bool BamReaderPrivate::SetRegion(const BamRegion& region) {

    if ( m_randomAccessController.SetRegion(region, m_references.size()) )
        return true;
    else {
        const string bracError = m_randomAccessController.GetErrorString();
        const string message = string("could not set region: \n\t") + bracError;
        SetErrorString("BamReader::SetRegion", message);
        return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %r14
movq 0x30(%rdi), %rax
subq 0x28(%rdi), %rax
leaq 0x1a8(%rdi), %r15
pushq $0x28
popq %rcx
cqto
idivq %rcx
leaq 0x30(%rsp), %rdx
movl %eax, (%rdx)
movq %r15, %rdi
callq 0x32610
movl %eax, %ebx
testb %al, %al
jne 0x450c3
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x34660
leaq 0x16c40(%rip), %rsi     # 0x5bc90
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x355e0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x16c25(%rip), %rsi     # 0x5bca9
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rdi
callq 0x335a0
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x50(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rdi
callq 0x33a00
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x450fe
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x450f2
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x45101
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x33a00
jmp 0x45101
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/BamAux.h
// Function: BamTools::SwapEndian_32(int&)
API_EXPORT inline void SwapEndian_32(int32_t& x) {
    x = ( (x >> 24) | 
         ((x << 8) & 0x00FF0000) | 
         ((x >> 8) & 0x0000FF00) | 
          (x << 24)
        );
}

// Assembly:
movl (%rdi), %eax
movl %eax, %ecx
sarl $0x18, %ecx
movl %eax, %edx
shll $0x8, %edx
andl $0xff0000, %edx         # imm = 0xFF0000
movl %eax, %esi
shrl $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl %eax, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::Close()
void BamWriterPrivate::Close(void) {

    // skip if file not open
    if ( !IsOpen() ) return;

    // close output stream
    try {
        m_stream.Close();
    } catch ( BamException& e ) {
        m_errorString = e.what();
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x349d0
testb %al, %al
je 0x457a6
movq %rbx, %rdi
callq 0x329a0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x457ea
movq %r14, %rdi
callq 0x31bb0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x48, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x35550
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x34970
movq %rax, %r14
callq 0x34970
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::CalculateMinimumBin(int, int) const
uint32_t BamWriterPrivate::CalculateMinimumBin(const int begin, int end) const {
    --end;
    if ( (begin >> 14) == (end >> 14) ) return 4681 + (begin >> 14);
    if ( (begin >> 17) == (end >> 17) ) return  585 + (begin >> 17);
    if ( (begin >> 20) == (end >> 20) ) return   73 + (begin >> 20);
    if ( (begin >> 23) == (end >> 23) ) return    9 + (begin >> 23);
    if ( (begin >> 26) == (end >> 26) ) return    1 + (begin >> 26);
    return 0;
}

// Assembly:
decl %edx
movl %esi, %eax
sarl $0xe, %eax
movl %edx, %ecx
sarl $0xe, %ecx
cmpl %ecx, %eax
jne 0x45810
addl $0x1249, %eax           # imm = 0x1249
retq
movl %esi, %eax
sarl $0x11, %eax
movl %edx, %ecx
sarl $0x11, %ecx
cmpl %ecx, %eax
jne 0x45824
addl $0x249, %eax            # imm = 0x249
retq
movl %esi, %eax
sarl $0x14, %eax
movl %edx, %ecx
sarl $0x14, %ecx
cmpl %ecx, %eax
jne 0x45836
addl $0x49, %eax
retq
movl %esi, %eax
sarl $0x17, %eax
movl %edx, %ecx
sarl $0x17, %ecx
cmpl %ecx, %eax
jne 0x45848
addl $0x9, %eax
retq
sarl $0x1a, %esi
sarl $0x1a, %edx
leal 0x1(%rsi), %ecx
xorl %eax, %eax
cmpl %edx, %esi
cmovel %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<BamTools::RefData, std::allocator<BamTools::RefData>> const&)
bool BamWriterPrivate::Open(const string& filename,
                            const string& samHeaderText,
                            const RefVector& referenceSequences)
{
    try {

        // open the BGZF file for writing
        m_stream.Open(filename, IBamIODevice::WriteOnly);

        // write BAM file 'metadata' components
        WriteMagicNumber();
        WriteSamHeaderText(samHeaderText);
        WriteReferences(referenceSequences);

        // return success
        return true;

    } catch ( BamException& e ) {
        m_errorString = e.what();
        return false;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
pushq $0x2
popq %rdx
callq 0x34d60
movq %rbx, %rdi
callq 0x356a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31fd0
movb $0x1, %bpl
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31ae0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x45c17
movq %r14, %rdi
callq 0x31bb0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x48, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x35550
callq 0x34970
xorl %ebp, %ebp
jmp 0x45bd1
movq %rax, %r14
callq 0x34970
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::WriteSamHeaderText(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void BamWriterPrivate::WriteSamHeaderText(const std::string& samHeaderText) {

    // write the SAM header  text length
    const uint32_t actualHeaderLen = samHeaderText.size();
    uint32_t maybeSwappedHeaderLen = samHeaderText.size();
    if ( m_isBigEndian ) BamTools::SwapEndian_32(maybeSwappedHeaderLen);
    m_stream.Write((char*)&maybeSwappedHeaderLen, Constants::BAM_SIZEOF_INT);

    // write the SAM header text
    if ( actualHeaderLen > 0 )
        m_stream.Write(samHeaderText.data(), actualHeaderLen);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movl %eax, %r14d
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x40(%rdi)
jne 0x45c5e
bswapl %eax
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x34f70
testq %r14, %r14
je 0x45c81
movq (%r15), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x34f70
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::WriteReferences(std::vector<BamTools::RefData, std::allocator<BamTools::RefData>> const&)
void BamWriterPrivate::WriteReferences(const BamTools::RefVector& referenceSequences) {

    // write the number of reference sequences
    uint32_t numReferenceSequences = referenceSequences.size();
    if ( m_isBigEndian ) BamTools::SwapEndian_32(numReferenceSequences);
    m_stream.Write((char*)&numReferenceSequences, Constants::BAM_SIZEOF_INT);

    // foreach reference sequence
    RefVector::const_iterator rsIter = referenceSequences.begin();
    RefVector::const_iterator rsEnd  = referenceSequences.end();
    for ( ; rsIter != rsEnd; ++rsIter ) {

        // write the reference sequence name length (+1 for terminator)
        const uint32_t actualNameLen = rsIter->RefName.size() + 1;
        uint32_t maybeSwappedNameLen = actualNameLen;
        if ( m_isBigEndian ) BamTools::SwapEndian_32(maybeSwappedNameLen);
        m_stream.Write((char*)&maybeSwappedNameLen, Constants::BAM_SIZEOF_INT);

        // write the reference sequence name
        m_stream.Write(rsIter->RefName.c_str(), actualNameLen);

        // write the reference sequence length
        int32_t referenceLength = rsIter->RefLength;
        if ( m_isBigEndian ) BamTools::SwapEndian_32(referenceLength);
        m_stream.Write((char*)&referenceLength, Constants::BAM_SIZEOF_INT);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rsi), %rax
subq (%rsi), %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
movl %eax, 0x10(%rsp)
cmpb $0x1, 0x40(%rdi)
jne 0x45cbf
bswapl %eax
movl %eax, 0x10(%rsp)
leaq 0x10(%rsp), %rsi
pushq $0x4
popq %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x34f70
movq (%r15), %r13
movq 0x8(%r15), %rbp
leaq 0x14(%rsp), %r12
cmpq %rbp, %r13
je 0x45d48
movl 0x8(%r13), %r15d
incl %r15d
movl %r15d, 0xc(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x45cff
movl %r15d, %eax
bswapl %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
movq %r14, %rdx
callq 0x34f70
movq (%r13), %rsi
movl %r15d, %edx
movq %rbx, %rdi
callq 0x34f70
movl 0x20(%r13), %eax
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x45d34
movq %r12, %rdi
callq 0x32c90
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x34f70
addq $0x28, %r13
jmp 0x45cdf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::SaveAlignment(BamTools::BamAlignment const&)
bool BamWriterPrivate::SaveAlignment(const BamAlignment& al) {

    try {

        // if BamAlignment contains only the core data and a raw char data buffer
        // (as a result of BamReader::GetNextAlignmentCore())
        if ( al.SupportData.HasCoreOnly )
            WriteCoreAlignment(al);

        // otherwise, BamAlignment should contain character in the standard fields: Name, QueryBases, etc
        // (resulting from BamReader::GetNextAlignment() *OR* being generated directly by client code)
        else WriteAlignment(al);

        // if we get here, everything OK
        return true;

    } catch ( BamException& e ) {
        m_errorString = e.what();
        return false;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x130(%rsi)
jne 0x45d75
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x31de0
jmp 0x45d80
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x32140
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x45dc0
movq %r14, %rdi
callq 0x31bb0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x48, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x35550
callq 0x34970
xorl %ebp, %ebp
jmp 0x45d80
movq %rax, %r14
callq 0x34970
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamWriter_p.cpp
// Function: BamTools::Internal::BamWriterPrivate::WriteCoreAlignment(BamTools::BamAlignment const&)
void BamWriterPrivate::WriteCoreAlignment(const BamAlignment& al) {

    // write the block size
    unsigned int blockSize = al.SupportData.BlockLength;
    if ( m_isBigEndian ) BamTools::SwapEndian_32(blockSize);
    m_stream.Write((char*)&blockSize, Constants::BAM_SIZEOF_INT);

    // re-calculate bin (in case BamAlignment's position has been previously modified)
    const uint32_t alignmentBin = CalculateMinimumBin(al.Position, al.GetEndPosition());

    // assign the BAM core data
    uint32_t buffer[Constants::BAM_CORE_BUFFER_SIZE];
    buffer[0] = al.RefID;
    buffer[1] = al.Position;
    buffer[2] = (alignmentBin << 16) | (al.MapQuality << 8) | al.SupportData.QueryNameLength;
    buffer[3] = (al.AlignmentFlag << 16) | al.SupportData.NumCigarOperations;
    buffer[4] = al.SupportData.QuerySequenceLength;
    buffer[5] = al.MateRefID;
    buffer[6] = al.MatePosition;
    buffer[7] = al.InsertSize;

    // swap BAM core endian-ness, if necessary
    if ( m_isBigEndian ) {
        for ( int i = 0; i < 8; ++i )
            BamTools::SwapEndian_32(buffer[i]);
    }

    // write the BAM core
    m_stream.Write((char*)&buffer, Constants::BAM_CORE_SIZE);

    // write the raw char data
    m_stream.Write((char*)al.SupportData.AllCharData.data(),
                   al.SupportData.BlockLength-Constants::BAM_CORE_SIZE);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x120(%rsi), %eax
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x40(%rdi)
jne 0x45df4
bswapl %eax
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x34f70
movl 0xac(%r14), %ebp
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32eb0
movl %ebp, %esi
movl %eax, %edx
callq 0x31e00
movq 0xa8(%r14), %rcx
movq %rcx, 0x10(%rsp)
shll $0x10, %eax
movzwl 0xb2(%r14), %ecx
orl 0x128(%r14), %eax
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, 0x18(%rsp)
movl 0xb4(%r14), %eax
shll $0x10, %eax
orl 0x124(%r14), %eax
movl %eax, 0x1c(%rsp)
movl 0x12c(%r14), %eax
movl %eax, 0x20(%rsp)
movq 0xd0(%r14), %rax
movq %rax, 0x24(%rsp)
movl 0xd8(%r14), %eax
movl %eax, 0x2c(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x45e9b
xorl %eax, %eax
cmpq $0x8, %rax
je 0x45e9b
movl 0x10(%rsp,%rax,4), %ecx
bswapl %ecx
movl %ecx, 0x10(%rsp,%rax,4)
incq %rax
jmp 0x45e86
leaq 0x10(%rsp), %rsi
pushq $0x20
popq %rdx
movq %rbx, %rdi
callq 0x34f70
movq 0x100(%r14), %rsi
movl 0x120(%r14), %edx
addl $-0x20, %edx
movq %rbx, %rdi
callq 0x34f70
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamIndexFactory_p.cpp
// Function: BamTools::Internal::BamIndexFactory::CreateIndexFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::BamIndex::IndexType const&)
const string BamIndexFactory::CreateIndexFilename(const string& bamFilename,
                                                  const BamIndex::IndexType& type)
{
    switch ( type ) {
        case ( BamIndex::STANDARD ) : return ( bamFilename + BamStandardIndex::Extension() );
        case ( BamIndex::BAMTOOLS ) : return ( bamFilename + BamToolsIndex::Extension() );
        default :
            return string();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdx), %eax
testl %eax, %eax
je 0x465e5
cmpl $0x1, %eax
jne 0x46608
movq %rsp, %r15
movq %r15, %rdi
callq 0x33ea0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x355e0
jmp 0x465fe
movq %rsp, %r15
movq %r15, %rdi
callq 0x346c0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x355e0
movq %rsp, %rdi
callq 0x33a00
jmp 0x46618
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x4663d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamIndexFactory_p.cpp
// Function: BamTools::Internal::BamIndexFactory::CreateIndexFromFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::Internal::BamReaderPrivate*)
BamIndex* BamIndexFactory::CreateIndexFromFilename(const string& indexFilename, BamReaderPrivate* reader) {

    // get file extension from index filename, including dot (".EXT")
    // if can't get file extension, return null index
    const string extension = FileExtension(indexFilename);
    if ( extension.empty() )
        return 0;

    // create index based on extension
    if      ( extension == BamStandardIndex::Extension() ) return new BamStandardIndex(reader);
    else if ( extension == BamToolsIndex::Extension()    ) return new BamToolsIndex(reader);
    else
        return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x33420
cmpq $0x0, 0x8(%r14)
je 0x466e8
movq %rsp, %rdi
callq 0x33ea0
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x32220
movl %eax, %ebp
movq %rsp, %rdi
callq 0x33a00
testb %bpl, %bpl
je 0x466ac
pushq $0x68
popq %rdi
callq 0x33130
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x33ec0
jmp 0x466eb
movq %rsp, %rdi
callq 0x346c0
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x32220
movl %eax, %ebp
movq %rsp, %rdi
callq 0x33a00
testb %bpl, %bpl
je 0x466e8
pushq $0x68
popq %rdi
callq 0x33130
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x33590
jmp 0x466eb
xorl %r14d, %r14d
leaq 0x20(%rsp), %rdi
callq 0x33a00
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x46710
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x46731
movq %rax, %rbx
movq %r14, %rdi
callq 0x32fa0
jmp 0x46731
jmp 0x4672e
jmp 0x4672e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x46731
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamIndexFactory_p.cpp
// Function: BamTools::Internal::BamIndexFactory::FileExtension(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
const string BamIndexFactory::FileExtension(const string& filename) {

    // if filename cannot contain valid path + extension, return empty string
    if ( filename.empty() || filename.length() <= 4 )
        return string();

    // look for last dot in filename
    const size_t lastDotPosition = filename.find_last_of('.');

    // if none found, return empty string
    if ( lastDotPosition == string::npos )
        return string();

    // return substring from last dot position
    return filename.substr(lastDotPosition);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x4, 0x8(%rsi)
jbe 0x46784
movq %rsi, %r14
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x35710
cmpq $-0x1, %rax
je 0x46784
pushq $-0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x332a0
jmp 0x46794
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamIndexFactory_p.cpp
// Function: BamTools::Internal::BamIndexFactory::FindIndexFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::BamIndex::IndexType const&)
const string BamIndexFactory::FindIndexFilename(const string& bamFilename,
                                                const BamIndex::IndexType& preferredType)
{
    // skip if BAM filename provided is empty
    if ( bamFilename.empty() )
        return string();

    // try to find index of preferred type first
    // return index filename if found
    string indexFilename = CreateIndexFilename(bamFilename, preferredType);
    if ( !indexFilename.empty() )
        return indexFilename;

    // couldn't find preferred type, try the other supported types
    // return index filename if found
    if ( preferredType != BamIndex::STANDARD ) {
        indexFilename = CreateIndexFilename(bamFilename, BamIndex::STANDARD);
        if ( !indexFilename.empty() )
            return indexFilename;
    }
    if ( preferredType != BamIndex::BAMTOOLS ) {
        indexFilename = CreateIndexFilename(bamFilename, BamIndex::BAMTOOLS);
        if ( !indexFilename.empty() )
            return indexFilename;
    }

    // otherwise couldn't find any index matching this filename
    return string();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x8(%rsi)
je 0x4684d
movq %rdx, %r15
movq %rsi, %r14
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x31970
cmpq $0x0, 0x8(%r12)
je 0x4686c
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x33ff0
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x4685d
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $0x1, (%r15)
jne 0x468aa
leaq 0x4(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x31970
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x32060
leaq 0x8(%rsp), %rdi
callq 0x33a00
cmpq $0x0, 0x30(%rsp)
jne 0x46834
jmp 0x468ed
leaq 0x4(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x31970
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x32060
leaq 0x8(%rsp), %rdi
callq 0x33a00
cmpq $0x0, 0x30(%rsp)
jne 0x46834
cmpl $0x0, (%r15)
jne 0x46872
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
jmp 0x46841
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x46927
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x46927
jmp 0x46924
jmp 0x46924
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::RaiiWrapper::~RaiiWrapper()
BamStandardIndex::RaiiWrapper::~RaiiWrapper(void) {

    if ( Device ) {
        Device->Close();
        delete Device;
        Device = 0;
    }

    if ( Buffer ) {
        delete[] Buffer;
        Buffer = 0;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x46970
movq (%rdi), %rax
callq *0x10(%rax)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4696c
movq (%rdi), %rax
callq *0x8(%rax)
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x46983
callq 0x33c60
andq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CloseFile()
void BamStandardIndex::CloseFile(void) {

    // close file stream
    if ( IsDeviceOpen() ) {
        m_resources.Device->Close();
        delete m_resources.Device;
        m_resources.Device = 0;
    }

    // clear index file summary data
    m_indexFileSummary.clear();

    // clean up I/O buffer
    delete[] m_resources.Buffer;
    m_resources.Buffer = 0;
    m_bufferLength = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
testq %rdi, %rdi
je 0x46a9d
movq (%rdi), %rax
callq *0x50(%rax)
testb %al, %al
je 0x46a9d
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x46a98
movq (%rdi), %rax
callq *0x8(%rax)
andq $0x0, 0x58(%rbx)
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x46aab
movq %rax, 0x40(%rbx)
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x46ab9
callq 0x33c60
andq $0x0, 0x60(%rbx)
andl $0x0, 0x50(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::AdjustRegion(BamTools::BamRegion const&, unsigned int&, unsigned int&)
void BamStandardIndex::AdjustRegion(const BamRegion& region, uint32_t& begin, uint32_t& end) {

    // retrieve references from reader
    const RefVector& references = m_reader->GetReferenceData();

    // LeftPosition cannot be greater than or equal to reference length
    if ( region.LeftPosition >= references.at(region.LeftRefID).RefLength )
        throw BamException("BamStandardIndex::AdjustRegion", "invalid region requested");

    // set region 'begin'
    begin = (unsigned int)region.LeftPosition;

    // if right bound specified AND left&right bounds are on same reference
    // OK to use right bound position as region 'end'
    if ( region.isRightBoundSpecified() && ( region.LeftRefID == region.RightRefID ) )
        end = (unsigned int)region.RightPosition;

    // otherwise, set region 'end' to last reference base
    else end = (unsigned int)references.at(region.LeftRefID).RefLength;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq 0x8(%rdi), %rdi
callq 0x33960
movq %rax, %r14
movl 0x4(%r15), %ebp
movslq (%r15), %rsi
movq %rax, %rdi
callq 0x34a10
cmpl 0x20(%rax), %ebp
jge 0x46b70
movl 0x4(%r15), %eax
movl %eax, (%r12)
movl (%r15), %eax
movl 0x8(%r15), %edx
testl %edx, %edx
setns %sil
movl 0xc(%r15), %ecx
testl %ecx, %ecx
setg %dil
andb %sil, %dil
cmpl %edx, %eax
sete %dl
testb %dl, %dil
jne 0x46b61
movslq %eax, %rsi
movq %r14, %rdi
callq 0x34a10
movl 0x20(%rax), %ecx
movl %ecx, (%rbx)
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x31e70
movq %rax, %rbx
leaq 0x152e3(%rip), %rsi     # 0x5be65
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x15b1b(%rip), %rsi     # 0x5c6b3
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x31b30
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x344c0
xorl %ebp, %ebp
movq 0x2e373(%rip), %rsi     # 0x74f38
movq 0x2e3ac(%rip), %rdx     # 0x74f78
movq %rbx, %rdi
callq 0x34c90
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x46be9
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x33a00
testb %bpl, %bpl
jne 0x46c05
jmp 0x46c0d
movq %rax, %rdi
callq 0x39b2f
movq %rax, %r14
movq %rbx, %rdi
callq 0x327c0
movq %r14, %rdi
callq 0x34ed0
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CalculateCandidateBins(unsigned int const&, unsigned int const&, std::set<unsigned short, std::less<unsigned short>, std::allocator<unsigned short>>&)
void BamStandardIndex::CalculateCandidateBins(const uint32_t& begin,
                                              const uint32_t& end,
                                              set<uint16_t>& candidateBins)
{
    // initialize list, bin '0' is always a valid bin
    candidateBins.insert(0);

    // get rest of bins that contain this region
    unsigned int k;
    for (k =    1 + (begin>>26); k <=    1 + (end>>26); ++k) { candidateBins.insert(k); }
    for (k =    9 + (begin>>23); k <=    9 + (end>>23); ++k) { candidateBins.insert(k); }
    for (k =   73 + (begin>>20); k <=   73 + (end>>20); ++k) { candidateBins.insert(k); }
    for (k =  585 + (begin>>17); k <=  585 + (end>>17); ++k) { candidateBins.insert(k); }
    for (k = 4681 + (begin>>14); k <= 4681 + (end>>14); ++k) { candidateBins.insert(k); }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0xe(%rsp), %rsi
andw $0x0, (%rsi)
movq %rcx, %rdi
callq 0x32c60
movl (%r15), %ebp
shrl $0x1a, %ebp
leaq 0xc(%rsp), %r12
movl (%r14), %eax
movl %eax, %ecx
shrl $0x1a, %ecx
cmpl %ecx, %ebp
ja 0x46c67
incl %ebp
movw %bp, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32c60
jmp 0x46c47
movl (%r15), %ebp
shrl $0x17, %ebp
addl $0x9, %ebp
leaq 0xa(%rsp), %r12
movl %eax, %ecx
shrl $0x17, %ecx
addl $0x9, %ecx
cmpl %ecx, %ebp
ja 0x46c98
movw %bp, 0xa(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32c60
incl %ebp
movl (%r14), %eax
jmp 0x46c75
movl (%r15), %ebp
shrl $0x14, %ebp
addl $0x49, %ebp
leaq 0x8(%rsp), %r12
movl %eax, %ecx
shrl $0x14, %ecx
addl $0x49, %ecx
cmpl %ecx, %ebp
ja 0x46cc9
movw %bp, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32c60
incl %ebp
movl (%r14), %eax
jmp 0x46ca6
movl (%r15), %ebp
shrl $0x11, %ebp
addl $0x249, %ebp            # imm = 0x249
leaq 0x6(%rsp), %r12
movl %eax, %ecx
shrl $0x11, %ecx
addl $0x249, %ecx            # imm = 0x249
cmpl %ecx, %ebp
ja 0x46d00
movw %bp, 0x6(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32c60
incl %ebp
movl (%r14), %eax
jmp 0x46cda
movl (%r15), %ebp
shrl $0xe, %ebp
addl $0x1249, %ebp           # imm = 0x1249
leaq 0x4(%rsp), %r15
shrl $0xe, %eax
addl $0x1249, %eax           # imm = 0x1249
cmpl %eax, %ebp
ja 0x46d34
movw %bp, 0x4(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32c60
incl %ebp
movl (%r14), %eax
jmp 0x46d11
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::ReadBinIntoBuffer(unsigned int&, int&)
void BamStandardIndex::ReadBinIntoBuffer(uint32_t& binId, int32_t& numAlignmentChunks) {

    // read bin header
    ReadBinID(binId);
    ReadNumAlignmentChunks(numAlignmentChunks);

    // read bin contents
    const unsigned int bytesRequested = numAlignmentChunks*BamStandardIndex::SIZEOF_ALIGNMENTCHUNK;
    ReadIntoBuffer(bytesRequested);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
callq 0x325e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x356c0
movl (%rbx), %eax
shll $0x4, %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0x33610
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CalculateMinOffset(BamTools::Internal::BaiReferenceSummary const&, unsigned int const&)
uint64_t BamStandardIndex::CalculateMinOffset(const BaiReferenceSummary& refSummary,
                                              const uint32_t& begin)
{
    // if no linear offsets exist, return 0
    if ( refSummary.NumLinearOffsets == 0 )
        return 0;

    // if 'begin' starts beyond last linear offset, use the last linear offset as minimum
    // else use the offset corresponding to the requested start position
    const int shiftedBegin = begin>>BamStandardIndex::BAM_LIDX_SHIFT;
    if ( shiftedBegin >= refSummary.NumLinearOffsets )
        return LookupLinearOffset( refSummary, refSummary.NumLinearOffsets-1 );
    else
        return LookupLinearOffset( refSummary, shiftedBegin );
}

// Assembly:
movl 0x4(%rsi), %eax
testl %eax, %eax
je 0x46f6d
pushq %rax
movl (%rdx), %ecx
shrl $0xe, %ecx
movl %ecx, (%rsp)
cmpl %eax, %ecx
jge 0x46f70
movq %rsp, %rdx
jmp 0x46f79
xorl %eax, %eax
retq
decl %eax
leaq 0x4(%rsp), %rdx
movl %eax, (%rdx)
callq 0x31580
addq $0x8, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::LookupLinearOffset(BamTools::Internal::BaiReferenceSummary const&, int const&)
uint64_t BamStandardIndex::LookupLinearOffset(const BaiReferenceSummary& refSummary, const int& index) {

    // attempt seek to proper index file position
    const int64_t linearOffsetFilePosition = (int64_t)refSummary.FirstLinearOffsetFilePosition +
                                             index*BamStandardIndex::SIZEOF_LINEAROFFSET;
    Seek(linearOffsetFilePosition, SEEK_SET);

    // read linear offset from BAI file
    uint64_t linearOffset;
    ReadLinearOffset(linearOffset);
    return linearOffset;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq (%rdx), %rax
shlq $0x3, %rax
addq 0x10(%rsi), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
xorl %edx, %edx
callq 0x31f60
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32280
movq (%r14), %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CheckBufferSize(char*&, unsigned int&, unsigned int const&)
void BamStandardIndex::CheckBufferSize(char*& buffer,
                                       unsigned int& bufferLength,
                                       const unsigned int& requestedBytes)
{
    try {
        if ( requestedBytes > bufferLength ) {
            bufferLength = requestedBytes + 10;
            delete[] buffer;
            buffer = new char[bufferLength];
        }
    } catch ( std::bad_alloc&  ) {
        stringstream s("");
        s << "out of memory when allocating " << requestedBytes << " bytes";
        throw BamException("BamStandardIndex::CheckBufferSize", s.str());
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movl (%rdx), %eax
cmpl (%rsi), %eax
jbe 0x46fff
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
addl $0xa, %eax
movl %eax, (%rsi)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x46ff5
callq 0x33c60
movl (%r15), %eax
movl %eax, %edi
callq 0x31080
movq %rax, (%r14)
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x47133
movq %r14, %rdi
callq 0x31bb0
leaq 0x14e3c(%rip), %rsi     # 0x5be64
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x31b30
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0x34880
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x60(%rsp), %rdi
leaq 0x14e25(%rip), %rsi     # 0x5be84
callq 0x330f0
movl (%rbx), %esi
movq %rax, %rdi
callq 0x326a0
leaq 0x161d8(%rip), %rsi     # 0x5d24d
movq %rax, %rdi
callq 0x330f0
pushq $0x28
popq %rdi
callq 0x31e70
movq %rax, %rbx
leaq 0x14e14(%rip), %rsi     # 0x5bea3
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x34870
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x344c0
xorl %ebp, %ebp
movq 0x2de6d(%rip), %rsi     # 0x74f38
movq 0x2dea6(%rip), %rdx     # 0x74f78
movq %rbx, %rdi
callq 0x34c90
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x33a00
jmp 0x470ef
movq %rax, %r14
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x33a00
testb %bpl, %bpl
jne 0x47103
jmp 0x47110
movq %rax, %r14
movq %rbx, %rdi
callq 0x327c0
jmp 0x47110
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x32870
jmp 0x4712e
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x4712e
movq %rax, %r14
callq 0x34970
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::CheckMagicNumber()
void BamStandardIndex::CheckMagicNumber(void) {

    // check 'magic number' to see if file is BAI index
    char magic[4];
    const int64_t numBytesRead = m_resources.Device->Read(magic, sizeof(magic));
    if ( numBytesRead != 4 )
        throw BamException("BamStandardIndex::CheckMagicNumber", "could not read BAI magic number");

    // compare to expected value
    if ( strncmp(magic, BamStandardIndex::BAI_MAGIC, 4) != 0 )
        throw BamException("BamStandardIndex::CheckMagicNumber", "invalid BAI magic number");
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq 0x58(%rdi), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
callq *0x28(%rax)
cmpq $0x4, %rax
jne 0x472f7
cmpl $0x1494142, 0xc(%rsp)   # imm = 0x1494142
jne 0x4735d
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x31e70
movq %rax, %rbx
leaq 0x14bbc(%rip), %rsi     # 0x5bec5
leaq 0x30(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x31b30
leaq 0x14bc9(%rip), %rsi     # 0x5bee8
leaq 0x10(%rsp), %rdi
leaq 0xa(%rsp), %rdx
callq 0x31b30
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x344c0
xorl %ebp, %ebp
movq 0x2dbec(%rip), %rsi     # 0x74f38
movq 0x2dc25(%rip), %rdx     # 0x74f78
movq %rbx, %rdi
callq 0x34c90
jmp 0x473c1
pushq $0x28
popq %rdi
callq 0x31e70
movq %rax, %rbx
leaq 0x14b56(%rip), %rsi     # 0x5bec5
leaq 0x30(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x31b30
leaq 0x14b83(%rip), %rsi     # 0x5bf08
leaq 0x10(%rsp), %rdi
leaq 0xa(%rsp), %rdx
callq 0x31b30
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x344c0
xorl %ebp, %ebp
movq 0x2db86(%rip), %rsi     # 0x74f38
movq 0x2dbbf(%rip), %rdx     # 0x74f78
movq %rbx, %rdi
callq 0x34c90
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x473d6
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x33a00
jmp 0x47401
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x473f7
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x33a00
testb %bpl, %bpl
jne 0x4740d
jmp 0x47415
jmp 0x4740a
movq %rax, %r14
movq %rbx, %rdi
callq 0x327c0
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop