LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3c9cc
addl $0x1249, %eax           # imm = 0x1249
retq
movl %esi, %eax
sarl $0x11, %eax
movl %edx, %ecx
sarl $0x11, %ecx
cmpl %ecx, %eax
jne 0x3c9e0
addl $0x249, %eax            # imm = 0x249
retq
movl %esi, %eax
sarl $0x14, %eax
movl %edx, %ecx
sarl $0x14, %ecx
cmpl %ecx, %eax
jne 0x3c9f2
addl $0x49, %eax
retq
movl %esi, %eax
sarl $0x17, %eax
movl %edx, %ecx
sarl $0x17, %ecx
cmpl %ecx, %eax
jne 0x3ca04
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_O1/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
movl $0x2, %edx
callq 0x28ae0
leaq 0x18610(%rip), %rsi     # 0x553bb
movl $0x4, %edx
movq %rbx, %rdi
callq 0x28ca0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x26b00
movb $0x1, %bpl
movq %rbx, %rdi
movq %r14, %rsi
callq 0x26730
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3ce17
movq %r14, %rdi
callq 0x267d0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x48, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x28000
callq 0x287e0
xorl %ebp, %ebp
jmp 0x3cdd1
movq %rax, %r14
callq 0x287e0
movq %r14, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3ce60
bswapl %eax
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x28ca0
testq %r14, %r14
je 0x3ce85
movq (%r15), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x28ca0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
subq (%rsi), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x40(%rdi)
jne 0x3cec5
bswapl %eax
movl %eax, 0x14(%rsp)
leaq 0x14(%rsp), %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x28ca0
movq (%r14), %r12
movq 0x8(%r14), %r13
cmpq %r13, %r12
je 0x3cf7c
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
movl 0x8(%r12), %ebp
incl %ebp
movl %ebp, 0x10(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x3cf0a
movl %ebp, %eax
bswapl %eax
movl %eax, 0x10(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x28ca0
movq (%r12), %rsi
movl %ebp, %edx
movq %rbx, %rdi
callq 0x28ca0
movl 0x20(%r12), %eax
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x40(%rbx)
jne 0x3cf5f
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, 0xc(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x28ca0
addq $0x28, %r12
cmpq %r13, %r12
jne 0x3cef1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3cfa9
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x26940
jmp 0x3cfb4
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x26c00
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3cff4
movq %r14, %rdi
callq 0x267d0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x48, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x28000
callq 0x287e0
xorl %ebp, %ebp
jmp 0x3cfb4
movq %rax, %r14
callq 0x287e0
movq %r14, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3d8a5
cmpl $0x1, %eax
jne 0x3d8d3
movq %rsp, %r15
movq %r15, %rdi
callq 0x27ff0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x29130
jmp 0x3d8be
movq %rsp, %r15
movq %r15, %rdi
callq 0x28610
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x29130
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d8e6
callq 0x27560
jmp 0x3d8e6
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x3d8f5
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d90b
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x27900
cmpq $0x0, 0x8(%r14)
je 0x3da05
movq %rsp, %rdi
callq 0x27ff0
movq 0x28(%rsp), %rdx
cmpq 0x8(%rsp), %rdx
jne 0x3d969
testq %rdx, %rdx
je 0x3d96d
movq (%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x277e0
testl %eax, %eax
sete %bpl
jmp 0x3d970
xorl %ebp, %ebp
jmp 0x3d970
movb $0x1, %bpl
leaq 0x10(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x3d983
callq 0x27560
testb %bpl, %bpl
je 0x3d9a2
movl $0x68, %edi
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x28010
jmp 0x3da08
movq %rsp, %rdi
callq 0x28610
movq 0x28(%rsp), %rdx
cmpq 0x8(%rsp), %rdx
jne 0x3d9d1
testq %rdx, %rdx
je 0x3d9d5
movq (%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0x277e0
testl %eax, %eax
sete %bpl
jmp 0x3d9d8
xorl %ebp, %ebp
jmp 0x3d9d8
movb $0x1, %bpl
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x3d9e6
callq 0x27560
testb %bpl, %bpl
je 0x3da05
movl $0x68, %edi
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x27a00
jmp 0x3da08
xorl %r14d, %r14d
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3da1b
callq 0x27560
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x3da29
movq %rax, %rbx
movq %r14, %rdi
callq 0x27560
jmp 0x3da3d
jmp 0x3da3a
jmp 0x3da3a
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3da50
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3da9a
movq %rsi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x29220
cmpq $-0x1, %rax
je 0x3da9a
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x277f0
jmp 0x3daad
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3db7e
movq %rdx, %r15
movq %rsi, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x26660
movq 0x8(%r12), %rdx
testq %rdx, %rdx
je 0x3dba0
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x8(%rsp), %rsi
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x267c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3db91
callq 0x27560
jmp 0x3db91
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq $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)
je 0x3dbee
leaq 0x4(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x26660
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x26b80
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3dbe0
callq 0x27560
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
jne 0x3db52
cmpl $0x0, (%r15)
je 0x3dc3c
leaq 0x4(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x26660
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x26b80
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3dc2e
callq 0x27560
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
jne 0x3db52
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
jmp 0x3db69
jmp 0x3dc58
jmp 0x3dc72
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3dc75
callq 0x27560
jmp 0x3dc75
jmp 0x3dc72
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3dc88
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3dcbf
movq (%rdi), %rax
callq *0x10(%rax)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3dcb8
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3dcd5
callq 0x27e70
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3de4a
movq (%rdi), %rax
callq *0x50(%rax)
testb %al, %al
je 0x3de4a
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x3de42
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x58(%rbx)
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x3de58
movq %rax, 0x40(%rbx)
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x3de66
callq 0x27e70
movq $0x0, 0x60(%rbx)
movl $0x0, 0x50(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x40, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq 0x8(%rdi), %rdi
callq 0x27c30
movslq (%r14), %rsi
movq (%rax), %rcx
movq 0x8(%rax), %rax
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x3df39
movl 0x4(%r14), %eax
leaq (%rsi,%rsi,4), %rsi
cmpl 0x20(%rcx,%rsi,8), %eax
jge 0x3df47
movl %eax, (%r15)
movl 0x8(%r14), %eax
testl %eax, %eax
js 0x3df13
cmpl $0x0, 0xc(%r14)
jle 0x3df13
cmpl %eax, (%r14)
jne 0x3df13
addq $0xc, %r14
jmp 0x3df27
movslq (%r14), %rsi
cmpq %rsi, %rdx
jbe 0x3df39
leaq (%rsi,%rsi,4), %rax
leaq (%rcx,%rax,8), %r14
addq $0x20, %r14
movl (%r14), %eax
movl %eax, (%rbx)
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17362(%rip), %rdi     # 0x552a2
xorl %eax, %eax
callq 0x284f0
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x17f2c(%rip), %rsi     # 0x55e90
leaq 0x17f43(%rip), %rdx     # 0x55eae
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1873c(%rip), %rsi     # 0x566c2
leaq 0x1874d(%rip), %rdx     # 0x566da
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2cf87(%rip), %rsi     # 0x6af38
movq 0x2cfc0(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3dfd9
callq 0x27560
jmp 0x3dfd9
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x3dff0
callq 0x27560
jmp 0x3dff0
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3dffd
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0x16(%rsp), %rsi
movw $0x0, (%rsi)
movq %rcx, %rdi
callq 0x272f0
movl (%r15), %r13d
shrl $0x1a, %r13d
movl (%r14), %eax
shrl $0x1a, %eax
cmpl %eax, %r13d
ja 0x3e06b
decl %r13d
leaq 0x14(%rsp), %r12
leal 0x2(%r13), %eax
movw %ax, 0x14(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x272f0
movl (%r14), %eax
shrl $0x1a, %eax
incl %r13d
cmpl %eax, %r13d
jb 0x3e049
movl (%r15), %ebp
shrl $0x17, %ebp
movl (%r14), %eax
shrl $0x17, %eax
cmpl %eax, %ebp
ja 0x3e0a2
addl $0x8, %ebp
leaq 0x12(%rsp), %r12
incl %ebp
movw %bp, 0x12(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x272f0
movl (%r14), %eax
shrl $0x17, %eax
addl $0x9, %eax
cmpl %eax, %ebp
jb 0x3e083
movl (%r15), %ebp
shrl $0x14, %ebp
movl (%r14), %eax
shrl $0x14, %eax
cmpl %eax, %ebp
ja 0x3e0d9
addl $0x48, %ebp
leaq 0x10(%rsp), %r12
incl %ebp
movw %bp, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x272f0
movl (%r14), %eax
shrl $0x14, %eax
addl $0x49, %eax
cmpl %eax, %ebp
jb 0x3e0ba
movl (%r15), %ebp
shrl $0x11, %ebp
movl (%r14), %eax
shrl $0x11, %eax
cmpl %eax, %ebp
ja 0x3e115
addl $0x248, %ebp            # imm = 0x248
leaq 0xe(%rsp), %r12
incl %ebp
movw %bp, 0xe(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x272f0
movl (%r14), %eax
shrl $0x11, %eax
addl $0x249, %eax            # imm = 0x249
cmpl %eax, %ebp
jb 0x3e0f4
movl (%r15), %ebp
shrl $0xe, %ebp
movl (%r14), %eax
shrl $0xe, %eax
cmpl %eax, %ebp
ja 0x3e151
addl $0x1248, %ebp           # imm = 0x1248
leaq 0xc(%rsp), %r15
incl %ebp
movw %bp, 0xc(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x272f0
movl (%r14), %eax
shrl $0xe, %eax
addl $0x1249, %eax           # imm = 0x1249
cmpl %eax, %ebp
jb 0x3e130
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x26f00
movq %r14, %rdi
movq %rbx, %rsi
callq 0x291e0
movl (%rbx), %eax
shll $0x4, %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0x27a40
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3e3fd
pushq %rax
movl (%rdx), %ecx
shrl $0xe, %ecx
movl %ecx, (%rsp)
cmpl %eax, %ecx
jge 0x3e400
movq %rsp, %rdx
jmp 0x3e409
xorl %eax, %eax
retq
decl %eax
leaq 0x4(%rsp), %rdx
movl %eax, (%rdx)
callq 0x263d0
addq $0x8, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x26a90
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x26cc0
movq (%r14), %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1c8, %rsp            # imm = 0x1C8
movl (%rdx), %eax
cmpl (%rsi), %eax
jbe 0x3e48d
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
addl $0xa, %eax
movl %eax, (%rsi)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x3e482
callq 0x27e70
movl (%r15), %edi
callq 0x26070
movq %rax, (%rbx)
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x3e5ef
movq %rbx, %rdi
callq 0x267d0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x179d0(%rip), %rdx     # 0x55e8f
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x26750
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
movl $0x18, %edx
callq 0x28750
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3e4ea
callq 0x27560
leaq 0x50(%rsp), %rbx
leaq 0x179b9(%rip), %rsi     # 0x55eaf
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x27a70
movl (%r14), %esi
movq %rbx, %rdi
callq 0x26fb0
leaq 0x18d06(%rip), %rsi     # 0x5721b
movl $0x6, %edx
movq %rax, %rdi
callq 0x27a70
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
movq %rsp, %rdi
movq %r15, (%rdi)
leaq 0x17992(%rip), %rsi     # 0x55ece
leaq 0x179ac(%rip), %rdx     # 0x55eef
callq 0x26750
leaq 0x58(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x28740
movb $0x1, %bpl
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2c9c5(%rip), %rsi     # 0x6af38
movq 0x2c9fe(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a30
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e5a0
callq 0x27560
jmp 0x3e5a0
movq %rax, %rbx
movb $0x1, %bpl
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3e5b6
callq 0x27560
jmp 0x3e5b6
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3e5c8
movq %r14, %rdi
callq 0x27070
jmp 0x3e5c8
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x270d0
jmp 0x3e5ea
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3e5ea
callq 0x27560
jmp 0x3e5ea
movq %rax, %rbx
callq 0x287e0
movq %rbx, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq 0x58(%rdi), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x28(%rax)
cmpq $0x4, %rax
jne 0x3e7ed
cmpl $0x1494142, 0xc(%rsp)   # imm = 0x1494142
jne 0x3e86c
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x176e6(%rip), %rsi     # 0x55ef0
leaq 0x17701(%rip), %rdx     # 0x55f12
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x176e7(%rip), %rsi     # 0x55f13
leaq 0x176ff(%rip), %rdx     # 0x55f32
leaq 0x10(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2c6dd(%rip), %rsi     # 0x6af38
movq 0x2c716(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
jmp 0x3e8e9
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x17667(%rip), %rsi     # 0x55ef0
leaq 0x17682(%rip), %rdx     # 0x55f12
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x17688(%rip), %rsi     # 0x55f33
leaq 0x17699(%rip), %rdx     # 0x55f4b
leaq 0x10(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2c65e(%rip), %rsi     # 0x6af38
movq 0x2c697(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
jmp 0x3e8ed
jmp 0x3e901
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x3e907
callq 0x27560
jmp 0x3e907
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x3e920
callq 0x27560
jmp 0x3e920
jmp 0x3e91a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3e92d
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::WriteHeader()
void BamStandardIndex::WriteHeader(void) {

    int64_t numBytesWritten = 0;

    // write magic number
    numBytesWritten += m_resources.Device->Write(BamStandardIndex::BAI_MAGIC, 4);

    // write number of reference sequences
    int32_t numReferences = m_indexFileSummary.size();
    if ( m_isBigEndian ) SwapEndian_32(numReferences);
    numBytesWritten += m_resources.Device->Write((const char*)&numReferences, sizeof(numReferences));

    if ( numBytesWritten != sizeof(numReferences)+4 )
        throw BamException("BamStandardIndex::WriteHeader", "could not write BAI header");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %r14
movq 0x58(%rdi), %rdi
movq (%rdi), %rax
leaq 0x165a2(%rip), %rsi     # 0x55e8b
movl $0x4, %edx
callq *0x40(%rax)
movq %rax, %rbx
movq 0x40(%r14), %rax
subq 0x38(%r14), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x30(%r14)
jne 0x3f939
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, 0xc(%rsp)
movq 0x58(%r14), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x40(%rax)
addq %rbx, %rax
cmpq $0x8, %rax
jne 0x3f963
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x16a35(%rip), %rsi     # 0x563b5
leaq 0x16a4b(%rip), %rdx     # 0x563d2
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x16a31(%rip), %rsi     # 0x563d3
leaq 0x16a44(%rip), %rdx     # 0x563ed
leaq 0x10(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2b567(%rip), %rsi     # 0x6af38
movq 0x2b5a0(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x3f9fa
callq 0x27560
jmp 0x3f9fa
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x3fa11
callq 0x27560
jmp 0x3fa11
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3fa1e
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::SaveLinearOffsetEntry(std::vector<unsigned long, std::allocator<unsigned long>>&, int const&, int const&, unsigned long const&)
void BamStandardIndex::SaveLinearOffsetEntry(BaiLinearOffsetVector& offsets,
                                             const int& alignmentStartPosition,
                                             const int& alignmentStopPosition,
                                             const uint64_t& lastOffset)
{
    // get converted offsets
    const int beginOffset = alignmentStartPosition >> BamStandardIndex::BAM_LIDX_SHIFT;
    const int endOffset   = (alignmentStopPosition - 1) >> BamStandardIndex::BAM_LIDX_SHIFT;

    // resize vector if necessary
    int oldSize = offsets.size();
    int newSize = endOffset + 1;
    if ( oldSize < newSize )
        offsets.resize(newSize, 0);

    // store offset
    for( int i = beginOffset + 1; i <= endOffset; ++i ) {
        if ( offsets[i] == 0 )
            offsets[i] = lastOffset;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rsi, %r14
movl (%rdx), %ebp
sarl $0xe, %ebp
movl (%rcx), %r15d
decl %r15d
sarl $0xe, %r15d
movq 0x8(%rsi), %rax
subq (%rsi), %rax
shrq $0x3, %rax
cmpl %eax, %r15d
jl 0x3fc03
leal 0x1(%r15), %eax
movslq %eax, %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x26c30
cmpl %r15d, %ebp
jge 0x3fc29
movq (%r14), %rax
movslq %ebp, %rcx
movslq %r15d, %rdx
cmpq $0x0, 0x8(%rax,%rcx,8)
jne 0x3fc21
movq (%rbx), %rsi
movq %rsi, 0x8(%rax,%rcx,8)
incq %rcx
cmpq %rcx, %rdx
jne 0x3fc11
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::HasAlignments(int const&) const
bool BamStandardIndex::HasAlignments(const int& referenceID) const {
    if ( referenceID < 0 || referenceID >= (int)m_indexFileSummary.size() )
        return false;
    const BaiReferenceSummary& refSummary = m_indexFileSummary.at(referenceID);
    return ( refSummary.NumBins > 0 );
}

// Assembly:
movslq (%rsi), %rsi
testq %rsi, %rsi
js 0x400ae
movq 0x38(%rdi), %rax
movq 0x40(%rdi), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpl %edx, %esi
jge 0x400ae
cmpq %rsi, %rdx
jbe 0x400b1
leaq (%rsi,%rsi,2), %rcx
cmpl $0x0, (%rax,%rcx,8)
setg %al
retq
xorl %eax, %eax
retq
pushq %rax
leaq 0x151e9(%rip), %rdi     # 0x552a2
xorl %eax, %eax
callq 0x284f0
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::Jump(BamTools::BamRegion const&, bool*)
bool BamStandardIndex::Jump(const BamRegion& region, bool* hasAlignmentsInRegion) {

    // clear out flag
    *hasAlignmentsInRegion = false;

    // skip if invalid reader or not open
    if ( m_reader == 0 || !m_reader->IsOpen() ) {
        SetErrorString("BamStandardIndex::Jump", "could not jump: reader is not open");
        return false;
    }

    // calculate nearest offset to jump to
    int64_t offset;
    try {
        GetOffset(region, offset, hasAlignmentsInRegion);
    } catch ( BamException& e ) {
        m_errorString = e.what();
        return false;
    }

    // if region has alignments, return success/fail of seeking there
    if ( *hasAlignmentsInRegion )
        return m_reader->Seek(offset);

    // otherwise, simply return true (but hasAlignmentsInRegion flag has been set to false)
    // (this is OK, BamReader will check this flag before trying to load data)
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movb $0x0, (%rdx)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x40118
movq %rdx, %r14
movq %rsi, %r15
callq 0x27b00
testb %al, %al
je 0x40118
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq 0x276e0
movb $0x1, %al
cmpb $0x1, (%r14)
jne 0x4018d
movq 0x8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x27710
jmp 0x4018d
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15f56(%rip), %rsi     # 0x5607e
leaq 0x15f65(%rip), %rdx     # 0x56094
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15f4b(%rip), %rsi     # 0x56095
leaq 0x15f66(%rip), %rdx     # 0x560b7
leaq 0x28(%rsp), %rdi
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x26370
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4017c
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4018b
callq 0x27560
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x40205
movq %r14, %rdi
callq 0x267d0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x10, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x28000
callq 0x287e0
jmp 0x4018b
movq %rax, %r14
callq 0x287e0
jmp 0x40205
movq %rax, %rdi
callq 0x2f0bd
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x401f1
callq 0x27560
jmp 0x401f1
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x40205
callq 0x27560
jmp 0x40205
movq %rax, %r14
movq %r14, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BamStandardIndex::Load(const std::string& filename) {

    try {

        // attempt to open file (read-only)
        OpenFile(filename, IBamIODevice::ReadOnly);

        // validate format
        CheckMagicNumber();

        // load in-memory summary of index data
        SummarizeIndexFile();

        // return success
        return true;

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %edx
callq 0x28810
movq %rbx, %rdi
callq 0x27690
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x28220
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x40272
movq %r14, %rdi
callq 0x267d0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
addq $0x10, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x28000
callq 0x287e0
xorl %ebp, %ebp
jmp 0x40232
movq %rax, %r14
callq 0x287e0
movq %r14, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::SummarizeIndexFile()
void BamStandardIndex::SummarizeIndexFile(void) {

    // load number of reference sequences
    int numReferences;
    ReadNumReferences(numReferences);

    // initialize file summary data
    ReserveForSummary(numReferences);

    // iterate over reference entries
    BaiFileSummary::iterator summaryIter = m_indexFileSummary.begin();
    BaiFileSummary::iterator summaryEnd  = m_indexFileSummary.end();
    for ( int i = 0; summaryIter != summaryEnd; ++summaryIter, ++i )
        SummarizeReference(*summaryIter);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
callq 0x28bb0
leaq 0x38(%rbx), %rdi
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x402aa
movq %rax, 0x40(%rbx)
movslq 0xc(%rsp), %rsi
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
callq 0x28640
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
cmpq %r15, %r14
je 0x402f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27790
movq %rbx, %rdi
movq %r14, %rsi
callq 0x26140
addq $0x18, %r14
jmp 0x402cf
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::ReadLinearOffset(unsigned long&)
void BamStandardIndex::ReadLinearOffset(uint64_t& linearOffset) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&linearOffset, sizeof(linearOffset));
    if ( m_isBigEndian ) SwapEndian_64(linearOffset);
    if ( numBytesRead != sizeof(linearOffset) )
        throw BamException("BamStandardIndex::ReadLinearOffset", "could not read BAI linear offset");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rdi), %rdi
movq (%rdi), %rax
movl $0x8, %edx
callq *0x28(%rax)
cmpb $0x1, 0x30(%r14)
jne 0x4032b
movq (%rbx), %rcx
bswapq %rcx
movq %rcx, (%rbx)
cmpq $0x8, %rax
jne 0x4033e
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15dfe(%rip), %rsi     # 0x56159
leaq 0x15e19(%rip), %rdx     # 0x5617b
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15dff(%rip), %rsi     # 0x5617c
leaq 0x15e18(%rip), %rdx     # 0x5619c
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2ab90(%rip), %rsi     # 0x6af38
movq 0x2abc9(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x403d0
callq 0x27560
jmp 0x403d0
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x403e7
callq 0x27560
jmp 0x403e7
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x403f4
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::ReadBinID(unsigned int&)
void BamStandardIndex::ReadBinID(uint32_t& binId) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&binId, sizeof(binId));
    if ( m_isBigEndian ) SwapEndian_32(binId);
    if ( numBytesRead != sizeof(binId) )
        throw BamException("BamStandardIndex::ReadBinID", "could not read BAI bin ID");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rdi), %rdi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
cmpb $0x1, 0x30(%r14)
jne 0x4052c
movl (%rbx), %ecx
bswapl %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x4053f
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15b77(%rip), %rsi     # 0x560d3
leaq 0x15b8b(%rip), %rdx     # 0x560ee
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15b71(%rip), %rsi     # 0x560ef
leaq 0x15b83(%rip), %rdx     # 0x56108
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a98f(%rip), %rsi     # 0x6af38
movq 0x2a9c8(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x405d1
callq 0x27560
jmp 0x405d1
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x405e8
callq 0x27560
jmp 0x405e8
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x405f5
movq %rbx, %rdi
callq 0x27070
movq %r14, %rdi
callq 0x28c20
nop