LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::ReadNumAlignmentChunks(int&)
void BamStandardIndex::ReadNumAlignmentChunks(int& numAlignmentChunks) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numAlignmentChunks, sizeof(numAlignmentChunks));
    if ( m_isBigEndian ) SwapEndian_32(numAlignmentChunks);
    if ( numBytesRead != sizeof(numAlignmentChunks) )
        throw BamException("BamStandardIndex::ReadNumAlignmentChunks", "could not read BAI chunk count");
}

// 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 0x4064e
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x40661
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 0x15b1f(%rip), %rsi     # 0x5619d
leaq 0x15b40(%rip), %rdx     # 0x561c5
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15b26(%rip), %rsi     # 0x561c6
leaq 0x15b3d(%rip), %rdx     # 0x561e4
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a86d(%rip), %rsi     # 0x6af38
movq 0x2a8a6(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x406f3
callq 0x27560
jmp 0x406f3
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4070a
callq 0x27560
jmp 0x4070a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x40717
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::ReadIntoBuffer(unsigned int const&)
void BamStandardIndex::ReadIntoBuffer(const unsigned int& bytesRequested) {

    // ensure that our buffer is big enough for request
    BamStandardIndex::CheckBufferSize(m_resources.Buffer, m_bufferLength, bytesRequested);

    // read from BAI file stream
    const int64_t bytesRead = m_resources.Device->Read(m_resources.Buffer, bytesRequested);
    if ( bytesRead != (int64_t)bytesRequested ) {
        stringstream s("");
        s << "expected to read: " << bytesRequested << " bytes, "
          << "but instead read: " << bytesRead;
        throw BamException("BamStandardIndex::ReadIntoBuffer", s.str());
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rsi, %r14
movq %rdi, %rbx
addq $0x60, %rdi
leaq 0x50(%rbx), %rsi
movq %r14, %rdx
callq 0x263e0
movq 0x58(%rbx), %rdi
movq 0x60(%rbx), %rsi
movl (%r14), %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq %rax, %rbx
movl (%r14), %eax
cmpq %rax, %rbx
jne 0x40771
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1570d(%rip), %rdx     # 0x55e8f
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x18, %edx
callq 0x28750
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x407b2
callq 0x27560
leaq 0x58(%rsp), %r15
leaq 0x1594b(%rip), %rsi     # 0x56109
movl $0x12, %edx
movq %r15, %rdi
callq 0x27a70
movl (%r14), %esi
movq %r15, %rdi
callq 0x26fb0
movq %rax, %r14
leaq 0x1593c(%rip), %rsi     # 0x5611c
movl $0x8, %edx
movq %rax, %rdi
callq 0x27a70
leaq 0x15931(%rip), %rsi     # 0x56125
movl $0x12, %edx
movq %r14, %rdi
callq 0x27a70
movq %r14, %rdi
movq %rbx, %rsi
callq 0x27570
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x15910(%rip), %rsi     # 0x56138
leaq 0x15929(%rip), %rdx     # 0x56158
callq 0x26750
leaq 0x60(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x28740
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a6d7(%rip), %rsi     # 0x6af38
movq 0x2a710(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4088e
callq 0x27560
jmp 0x4088e
movq %rax, %r14
movb $0x1, %bpl
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x408a5
callq 0x27560
jmp 0x408a5
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x408b7
movq %rbx, %rdi
callq 0x27070
jmp 0x408b7
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x270d0
jmp 0x408e2
movq %rax, %rdi
callq 0x2f0bd
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x408e2
callq 0x27560
jmp 0x408e2
movq %rax, %r14
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::ReadNumBins(int&)
void BamStandardIndex::ReadNumBins(int& numBins) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numBins, sizeof(numBins));
    if ( m_isBigEndian ) SwapEndian_32(numBins);
    if ( numBytesRead != sizeof(numBins) )
        throw BamException("BamStandardIndex::ReadNumBins", "could not read BAI bin count");
}

// 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 0x4093a
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x4094d
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 0x1587b(%rip), %rsi     # 0x561e5
leaq 0x15891(%rip), %rdx     # 0x56202
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15877(%rip), %rsi     # 0x56203
leaq 0x1588c(%rip), %rdx     # 0x5621f
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a581(%rip), %rsi     # 0x6af38
movq 0x2a5ba(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x409df
callq 0x27560
jmp 0x409df
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x409f6
callq 0x27560
jmp 0x409f6
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x40a03
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::ReadNumLinearOffsets(int&)
void BamStandardIndex::ReadNumLinearOffsets(int& numLinearOffsets) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numLinearOffsets, sizeof(numLinearOffsets));
    if ( m_isBigEndian ) SwapEndian_32(numLinearOffsets);
    if ( numBytesRead != sizeof(numLinearOffsets) )
        throw BamException("BamStandardIndex::ReadNumAlignmentChunks", "could not read BAI linear offset count");
}

// 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 0x40a5c
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x40a6f
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 0x15711(%rip), %rsi     # 0x5619d
leaq 0x15732(%rip), %rdx     # 0x561c5
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15772(%rip), %rsi     # 0x56220
leaq 0x15791(%rip), %rdx     # 0x56246
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a45f(%rip), %rsi     # 0x6af38
movq 0x2a498(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x40b01
callq 0x27560
jmp 0x40b01
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x40b18
callq 0x27560
jmp 0x40b18
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x40b25
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::ReadNumReferences(int&)
void BamStandardIndex::ReadNumReferences(int& numReferences) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numReferences, sizeof(numReferences));
    if ( m_isBigEndian ) SwapEndian_32(numReferences);
    if ( numBytesRead != sizeof(numReferences) )
        throw BamException("BamStandardIndex::ReadNumReferences", "could not read reference count");
}

// 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 0x40b7e
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x40b91
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 0x15699(%rip), %rsi     # 0x56247
leaq 0x156b5(%rip), %rdx     # 0x5626a
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1569b(%rip), %rsi     # 0x5626b
leaq 0x156b2(%rip), %rdx     # 0x56289
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2a33d(%rip), %rsi     # 0x6af38
movq 0x2a376(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x40c23
callq 0x27560
jmp 0x40c23
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x40c3a
callq 0x27560
jmp 0x40c3a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x40c47
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::SummarizeBins(BamTools::Internal::BaiReferenceSummary&)
void BamStandardIndex::SummarizeBins(BaiReferenceSummary& refSummary) {

    // load number of bins
    int numBins;
    ReadNumBins(numBins);

    // store bins summary for this reference
    refSummary.NumBins = numBins;
    refSummary.FirstBinFilePosition = Tell();

    // skip this reference's bins
    SkipBins(numBins);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc(%rsp), %r15
movq %r15, %rsi
callq 0x27730
movl (%r15), %eax
movl %eax, (%r14)
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, 0x8(%r14)
cmpl $0x0, (%r15)
jle 0x40e0f
xorl %ebp, %ebp
leaq 0x14(%rsp), %r14
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x27860
incl %ebp
cmpl 0xc(%rsp), %ebp
jl 0x40df9
addq $0x18, %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::SummarizeLinearOffsets(BamTools::Internal::BaiReferenceSummary&)
void BamStandardIndex::SummarizeLinearOffsets(BaiReferenceSummary& refSummary) {

    // load number of linear offsets
    int numLinearOffsets;
    ReadNumLinearOffsets(numLinearOffsets);

    // store bin summary data for this reference
    refSummary.NumLinearOffsets = numLinearOffsets;
    refSummary.FirstLinearOffsetFilePosition = Tell();

    // skip linear offsets in index file
    SkipLinearOffsets(numLinearOffsets);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x26e00
movl (%r15), %eax
movl %eax, 0x4(%rbx)
movq 0x58(%r14), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, 0x10(%rbx)
movl (%r15), %eax
shll $0x3, %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0x27a40
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/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::WriteAlignmentChunk(BamTools::Internal::BaiAlignmentChunk const&)
void BamStandardIndex::WriteAlignmentChunk(const BaiAlignmentChunk& chunk) {

    // localize alignment chunk offsets
    uint64_t start = chunk.Start;
    uint64_t stop  = chunk.Stop;

    // swap endian-ness if necessary
    if ( m_isBigEndian ) {
        SwapEndian_64(start);
        SwapEndian_64(stop);
    }

    // write to index file
    int64_t numBytesWritten = 0;
    numBytesWritten += m_resources.Device->Write((const char*)&start, sizeof(start));
    numBytesWritten += m_resources.Device->Write((const char*)&stop, sizeof(stop));
    if ( numBytesWritten != (sizeof(start)+sizeof(stop)) )
        throw BamException("BamStandardIndex::WriteAlignmentChunk", "could not write BAI alignment chunk");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq (%rsi), %rcx
movq %rcx, 0x8(%rsp)
movq 0x8(%rsi), %rax
movq %rax, (%rsp)
cmpb $0x1, 0x30(%rdi)
jne 0x40ec0
bswapq %rcx
movq %rcx, 0x8(%rsp)
bswapq %rax
movq %rax, (%rsp)
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq *0x40(%rax)
movq %rax, %r14
movq 0x58(%rbx), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
movl $0x8, %edx
callq *0x40(%rax)
addq %r14, %rax
cmpq $0x10, %rax
jne 0x40eff
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 0x153a0(%rip), %rsi     # 0x562bc
leaq 0x153be(%rip), %rdx     # 0x562e1
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x153a4(%rip), %rsi     # 0x562e2
leaq 0x153c0(%rip), %rdx     # 0x56305
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 0x29fcb(%rip), %rsi     # 0x6af38
movq 0x2a004(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x40f96
callq 0x27560
jmp 0x40f96
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x40fad
callq 0x27560
jmp 0x40fad
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x40fba
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::WriteAlignmentChunks(std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>&)
void BamStandardIndex::WriteAlignmentChunks(BaiAlignmentChunkVector& chunks) {

    // make sure chunks are merged (simplified) before writing & saving summary
    MergeAlignmentChunks(chunks);

    // write chunks
    int32_t chunkCount = chunks.size();
    if ( m_isBigEndian ) SwapEndian_32(chunkCount);
    const int64_t numBytesWritten = m_resources.Device->Write((const char*)&chunkCount, sizeof(chunkCount));
    if ( numBytesWritten != sizeof(chunkCount) )
        throw BamException("BamStandardIndex::WriteAlignmentChunks", "could not write BAI chunk count");

    // iterate over chunks
    BaiAlignmentChunkVector::const_iterator chunkIter = chunks.begin();
    BaiAlignmentChunkVector::const_iterator chunkEnd  = chunks.end();
    for ( ; chunkIter != chunkEnd; ++chunkIter )
        WriteAlignmentChunk( (*chunkIter) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x29030
movq 0x8(%r14), %rax
subq (%r14), %rax
shrq $0x4, %rax
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x30(%rbx)
jne 0x41016
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(%rbx), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x40(%rax)
cmpq $0x4, %rax
jne 0x4105a
movq (%r14), %r15
movq 0x8(%r14), %r14
cmpq %r14, %r15
je 0x4104d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x290c0
addq $0x10, %r15
jmp 0x41037
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 0x1528f(%rip), %rsi     # 0x56306
leaq 0x152ae(%rip), %rdx     # 0x5632c
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15294(%rip), %rsi     # 0x5632d
leaq 0x152ac(%rip), %rdx     # 0x5634c
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 0x29e70(%rip), %rsi     # 0x6af38
movq 0x29ea9(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x410f1
callq 0x27560
jmp 0x410f1
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x41108
callq 0x27560
jmp 0x41108
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x41115
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::WriteBin(unsigned int const&, std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>&)
void BamStandardIndex::WriteBin(const uint32_t& binId, BaiAlignmentChunkVector& chunks) {

    // write BAM bin ID
    uint32_t binKey = binId;
    if ( m_isBigEndian ) SwapEndian_32(binKey);
    const int64_t numBytesWritten = m_resources.Device->Write((const char*)&binKey, sizeof(binKey));
    if ( numBytesWritten != sizeof(binKey) )
        throw BamException("BamStandardIndex::WriteBin", "could not write bin ID");

    // write bin's alignment chunks
    WriteAlignmentChunks(chunks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movl (%rsi), %eax
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x30(%rdi)
jne 0x41142
bswapl %eax
movl %eax, 0xc(%rsp)
movq 0x58(%r14), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x40(%rax)
cmpq $0x4, %rax
jne 0x41174
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28920
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 0x151bc(%rip), %rsi     # 0x5634d
leaq 0x151cf(%rip), %rdx     # 0x56367
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x151b5(%rip), %rsi     # 0x56368
leaq 0x151c4(%rip), %rdx     # 0x5637e
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 0x29d56(%rip), %rsi     # 0x6af38
movq 0x29d8f(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x4120b
callq 0x27560
jmp 0x4120b
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x41222
callq 0x27560
jmp 0x41222
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4122f
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::WriteBins(int const&, std::map<unsigned int, std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<BamTools::Internal::BaiAlignmentChunk, std::allocator<BamTools::Internal::BaiAlignmentChunk>>>>>&)
void BamStandardIndex::WriteBins(const int& refId, BaiBinMap& bins) {

    // write number of bins
    int32_t binCount = bins.size();
    if ( m_isBigEndian ) SwapEndian_32(binCount);
    const int64_t numBytesWritten = m_resources.Device->Write((const char*)&binCount, sizeof(binCount));
    if ( numBytesWritten != sizeof(binCount) )
        throw BamException("BamStandardIndex::WriteBins", "could not write bin count");

    // save summary for reference's bins
    SaveBinsSummary(refId, bins.size());

    // iterate over bins
    BaiBinMap::iterator binIter = bins.begin();
    BaiBinMap::iterator binEnd  = bins.end();
    for ( ; binIter != binEnd; ++binIter )
        WriteBin( (*binIter).first, (*binIter).second );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl 0x28(%rdx), %eax
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x30(%rdi)
jne 0x41282
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)
cmpq $0x4, %rax
jne 0x412eb
movl 0x28(%rbx), %eax
leaq 0x10(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x262e0
movq 0x18(%rbx), %r15
addq $0x8, %rbx
cmpq %rbx, %r15
je 0x412de
leaq 0x20(%r15), %rsi
leaq 0x28(%r15), %rdx
movq %r14, %rdi
callq 0x28420
movq %r15, %rdi
callq 0x27030
movq %rax, %r15
cmpq %rbx, %rax
jne 0x412be
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15077(%rip), %rsi     # 0x5637f
leaq 0x1508b(%rip), %rdx     # 0x5639a
leaq 0x10(%rsp), %rdi
callq 0x26750
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15071(%rip), %rsi     # 0x5639b
leaq 0x15083(%rip), %rdx     # 0x563b4
leaq 0x30(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x29bdf(%rip), %rsi     # 0x6af38
movq 0x29c18(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x41382
callq 0x27560
jmp 0x41382
movq %rax, %r14
movb $0x1, %bpl
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x41399
callq 0x27560
jmp 0x41399
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x413a6
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::RaiiWrapper::~RaiiWrapper()
BamToolsIndex::RaiiWrapper::~RaiiWrapper(void) {
    if ( Device ) {
        Device->Close();
        delete Device;
        Device = 0;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x42ae3
movq (%rdi), %rax
callq *0x10(%rax)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x42adc
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::CloseFile()
void BamToolsIndex::CloseFile(void) {
    if ( IsDeviceOpen() ) {
        m_resources.Device->Close();
        delete m_resources.Device;
        m_resources.Device = 0;
    }
    m_indexFileSummary.clear();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0x42c66
movq (%rdi), %rax
callq *0x50(%rax)
testb %al, %al
je 0x42c66
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x42c5e
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x60(%rbx)
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x42c74
movq %rax, 0x40(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::CheckMagicNumber()
void BamToolsIndex::CheckMagicNumber(void) {

    // read magic number
    char magic[4];
    const int64_t numBytesRead = m_resources.Device->Read(magic, 4);
    if ( numBytesRead != 4 )
        throw BamException("BamToolsIndex::CheckMagicNumber", "could not read BTI magic number");

    // validate expected magic number
    if ( strncmp(magic, BamToolsIndex::BTI_MAGIC, 4) != 0 )
        throw BamException("BamToolsIndex::CheckMagicNumber", "invalid BTI magic number");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq 0x60(%rdi), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x28(%rax)
cmpq $0x4, %rax
jne 0x42ce5
cmpl $0x1495442, 0xc(%rsp)   # imm = 0x1495442
jne 0x42d64
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 0x13793(%rip), %rsi     # 0x56495
leaq 0x137ab(%rip), %rdx     # 0x564b4
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13791(%rip), %rsi     # 0x564b5
leaq 0x137a9(%rip), %rdx     # 0x564d4
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 0x281e5(%rip), %rsi     # 0x6af38
movq 0x2821e(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
jmp 0x42de1
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x13714(%rip), %rsi     # 0x56495
leaq 0x1372c(%rip), %rdx     # 0x564b4
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13732(%rip), %rsi     # 0x564d5
leaq 0x13743(%rip), %rdx     # 0x564ed
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 0x28166(%rip), %rsi     # 0x6af38
movq 0x2819f(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
jmp 0x42de5
jmp 0x42df9
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x42dff
callq 0x27560
jmp 0x42dff
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x42e18
callq 0x27560
jmp 0x42e18
jmp 0x42e12
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x42e25
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::WriteReferenceEntry(BamTools::Internal::BtiReferenceEntry const&)
void BamToolsIndex::WriteReferenceEntry(const BtiReferenceEntry& refEntry) {

    // write number of blocks this reference
    uint32_t numBlocks = refEntry.Blocks.size();
    if ( m_isBigEndian ) SwapEndian_32(numBlocks);
    const int64_t numBytesWritten = m_resources.Device->Write((const char*)&numBlocks, sizeof(numBlocks));
    if ( numBytesWritten != sizeof(numBlocks) )
        throw BamException("BamToolsIndex::WriteReferenceEntry", "could not write number of blocks");

    // write actual block entries
    WriteBlocks(refEntry.Blocks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rax
subq 0x8(%rsi), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
movl %eax, 0xc(%rsp)
cmpb $0x1, 0x30(%rdi)
jne 0x43d88
bswapl %eax
movl %eax, 0xc(%rsp)
movq 0x60(%rbx), %rdi
movq (%rdi), %rax
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *0x40(%rax)
cmpq $0x4, %rax
jne 0x43dcd
movq 0x8(%r14), %r15
movq 0x10(%r14), %r14
cmpq %r14, %r15
je 0x43dc0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x26910
addq $0x18, %r15
jmp 0x43daa
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 0x12ab1(%rip), %rsi     # 0x5689b
leaq 0x12acc(%rip), %rdx     # 0x568bd
leaq 0x30(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x12ab2(%rip), %rsi     # 0x568be
leaq 0x12acb(%rip), %rdx     # 0x568de
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 0x270fd(%rip), %rsi     # 0x6af38
movq 0x27136(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x43e64
callq 0x27560
jmp 0x43e64
movq %rax, %r14
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x43e7b
callq 0x27560
jmp 0x43e7b
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x43e88
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::ReadReferenceEntry(BamTools::Internal::BtiReferenceEntry&)
void BamToolsIndex::ReadReferenceEntry(BtiReferenceEntry& refEntry) {

    // return false if refId not valid index in file summary structure
    if ( refEntry.ID < 0 || refEntry.ID >= (int)m_indexFileSummary.size() )
        throw BamException("BamToolsIndex::ReadReferenceEntry", "invalid reference requested");

    // use index summary to assist reading the reference's BTI blocks
    const BtiReferenceSummary& refSummary = m_indexFileSummary.at(refEntry.ID);
    ReadBlocks(refSummary, refEntry.Blocks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rcx
movslq (%rsi), %rsi
testq %rsi, %rsi
js 0x440d7
movq 0x38(%rdi), %rax
movq 0x40(%rdi), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
cmpl %edx, %esi
jge 0x440d7
cmpq %rsi, %rdx
jbe 0x44150
shlq $0x4, %rsi
addq %rsi, %rax
addq $0x8, %rcx
movq %rax, %rsi
movq %rcx, %rdx
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x280e0
movl $0x28, %edi
callq 0x269d0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x126eb(%rip), %rsi     # 0x567df
leaq 0x12705(%rip), %rdx     # 0x56800
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x126eb(%rip), %rsi     # 0x56801
leaq 0x126ff(%rip), %rdx     # 0x5681c
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x26df7(%rip), %rsi     # 0x6af38
movq 0x26e30(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
leaq 0x1114b(%rip), %rdi     # 0x552a2
xorl %eax, %eax
callq 0x284f0
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x44177
callq 0x27560
jmp 0x44177
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4418e
callq 0x27560
jmp 0x4418e
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4419b
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::HasAlignments(int const&) const
bool BamToolsIndex::HasAlignments(const int& referenceID) const {
    if ( referenceID < 0 || referenceID >= (int)m_indexFileSummary.size() )
        return false;
    const BtiReferenceSummary& refSummary = m_indexFileSummary.at(referenceID);
    return ( refSummary.NumBlocks > 0 );
}

// Assembly:
movslq (%rsi), %rsi
testq %rsi, %rsi
js 0x441d0
movq 0x38(%rdi), %rax
movq 0x40(%rdi), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
cmpl %edx, %esi
jge 0x441d0
cmpq %rsi, %rdx
jbe 0x441d3
shlq $0x4, %rsi
cmpl $0x0, (%rax,%rsi)
setg %al
retq
xorl %eax, %eax
retq
pushq %rax
leaq 0x110c7(%rip), %rdi     # 0x552a2
xorl %eax, %eax
callq 0x284f0
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BamToolsIndex::Load(const std::string& filename) {

    try {

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

        // load metadata & generate in-memory summary
        LoadHeader();
        LoadFileSummary();

        // 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 0x26d80
movq %rbx, %rdi
callq 0x27b70
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x27f30
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x4443e
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 0x443fe
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::LoadHeader()
void BamToolsIndex::LoadHeader(void) {

    // check BTI file metadata
    CheckMagicNumber();
    CheckVersion();

    // use file's BTI block size to set member variable
    const int64_t numBytesRead = m_resources.Device->Read((char*)&m_blockSize, sizeof(m_blockSize));
    if ( m_isBigEndian ) SwapEndian_32(m_blockSize);
    if ( numBytesRead != sizeof(m_blockSize) )
        throw BamException("BamToolsIndex::LoadHeader", "could not read BTI block size");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %r14
callq 0x28a80
movq %r14, %rdi
callq 0x28b70
movq 0x60(%r14), %rdi
leaq 0x50(%r14), %rbx
movq (%rdi), %rax
movq %rbx, %rsi
movl $0x4, %edx
callq *0x28(%rax)
cmpb $0x1, 0x30(%r14)
jne 0x4448d
movl (%rbx), %ecx
bswapl %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x444a0
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 0x1221e(%rip), %rsi     # 0x566db
leaq 0x12230(%rip), %rdx     # 0x566f4
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x12216(%rip), %rsi     # 0x566f5
leaq 0x1222c(%rip), %rdx     # 0x56712
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x26a2e(%rip), %rsi     # 0x6af38
movq 0x26a67(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x44532
callq 0x27560
jmp 0x44532
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x44549
callq 0x27560
jmp 0x44549
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x44556
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::LoadFileSummary()
void BamToolsIndex::LoadFileSummary(void) {

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

    // initialize file summary data
    InitializeFileSummary(numReferences);

    // load summary for each reference
    BtiFileSummary::iterator summaryIter = m_indexFileSummary.begin();
    BtiFileSummary::iterator summaryEnd  = m_indexFileSummary.end();
    for ( ; summaryIter != summaryEnd; ++summaryIter )
        LoadReferenceSummary(*summaryIter);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq %r14, %rsi
callq 0x28cb0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x28cd0
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
cmpq %r15, %r14
je 0x445a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27220
addq $0x10, %r14
jmp 0x4458a
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::LoadNumReferences(int&)
void BamToolsIndex::LoadNumReferences(int& numReferences) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numReferences, sizeof(numReferences));
    if ( m_isBigEndian ) SwapEndian_32(numReferences);
    if ( numBytesRead != sizeof(numReferences) )
        throw BamException("BamToolsIndex::LoadNumReferences", "could not read number of references");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x60(%rdi), %rdi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
cmpb $0x1, 0x30(%r14)
jne 0x445fa
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x4460d
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 0x1212a(%rip), %rsi     # 0x56754
leaq 0x12143(%rip), %rdx     # 0x56774
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x12129(%rip), %rsi     # 0x56775
leaq 0x12145(%rip), %rdx     # 0x56798
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x268c1(%rip), %rsi     # 0x6af38
movq 0x268fa(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4469f
callq 0x27560
jmp 0x4469f
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x446b6
callq 0x27560
jmp 0x446b6
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x446c3
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::LoadReferenceSummary(BamTools::Internal::BtiReferenceSummary&)
void BamToolsIndex::LoadReferenceSummary(BtiReferenceSummary& refSummary) {

    // load number of blocks
    int numBlocks;
    LoadNumBlocks(numBlocks);

    // store block summary data for this reference
    refSummary.NumBlocks = numBlocks;
    refSummary.FirstBlockFilePosition = Tell();

    // skip reference's blocks
    SkipBlocks(numBlocks);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %r15
movq %r15, %rsi
callq 0x26790
movl (%r15), %eax
movl %eax, (%rbx)
movq 0x60(%r14), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, 0x8(%rbx)
movslq (%r15), %rax
shlq $0x4, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
movl $0x1, %edx
callq 0x279c0
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/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::LoadNumBlocks(int&)
void BamToolsIndex::LoadNumBlocks(int& numBlocks) {
    const int64_t numBytesRead = m_resources.Device->Read((char*)&numBlocks, sizeof(numBlocks));
    if ( m_isBigEndian ) SwapEndian_32(numBlocks);
    if ( numBytesRead != sizeof(numBlocks) )
        throw BamException("BamToolsIndex::LoadNumBlocks", "could not read number of BTI blocks");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x60(%rdi), %rdi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
cmpb $0x1, 0x30(%r14)
jne 0x44772
movl (%rbx), %ecx
movl %ecx, %edx
sarl $0x18, %edx
movl %ecx, %esi
shll $0x8, %esi
andl $0xff0000, %esi         # imm = 0xFF0000
movl %ecx, %edi
shrl $0x8, %edi
andl $0xff00, %edi           # imm = 0xFF00
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl %ecx, (%rbx)
cmpq $0x4, %rax
jne 0x44785
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 0x11f71(%rip), %rsi     # 0x56713
leaq 0x11f86(%rip), %rdx     # 0x5672f
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x11f6c(%rip), %rsi     # 0x56730
leaq 0x11f88(%rip), %rdx     # 0x56753
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x26749(%rip), %rsi     # 0x6af38
movq 0x26782(%rip), %rdx     # 0x6af78
movq %rbx, %rdi
callq 0x28a30
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x44817
callq 0x27560
jmp 0x44817
movq %rax, %r14
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4482e
callq 0x27560
jmp 0x4482e
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4483b
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/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::ReadBlocks(BamTools::Internal::BtiReferenceSummary const&, std::vector<BamTools::Internal::BtiBlock, std::allocator<BamTools::Internal::BtiBlock>>&)
void BamToolsIndex::ReadBlocks(const BtiReferenceSummary& refSummary, BtiBlockVector& blocks) {

    // prep blocks container
    blocks.clear();
    blocks.reserve(refSummary.NumBlocks);

    // skip to first block entry
    Seek( refSummary.FirstBlockFilePosition, SEEK_SET );

    // read & store block entries
    BtiBlock block;
    for ( int i = 0; i < refSummary.NumBlocks; ++i ) {
        ReadBlock(block);
        blocks.push_back(block);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x44a8e
movq %rax, 0x8(%rbx)
movslq (%r14), %rsi
movq %rbx, %rdi
callq 0x28d90
movq 0x8(%r14), %rax
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x279c0
movl %ebp, (%r12)
movq $0x0, 0x8(%r12)
movl %ebp, 0x10(%r12)
cmpl %ebp, (%r14)
jle 0x44b10
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x280c0
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x44afe
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rbx)
jmp 0x44b09
movq %rbx, %rdi
movq %r12, %rdx
callq 0x26100
incl %ebp
cmpl (%r14), %ebp
jl 0x44ad1
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/BamDeviceFactory_p.cpp
// Function: BamTools::Internal::BamDeviceFactory::CreateDevice(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
IBamIODevice* BamDeviceFactory::CreateDevice(const string& source) {

    // check for requested pipe
    if ( source == "-" || source == "stdin" || source == "stdout" )
        return new BamPipe;

    // check for HTTP prefix
    if ( source.find("http://") == 0 )
        return new BamHttp(source);

    // check for FTP prefix
    if ( source.find("ftp://") == 0 )
        return new BamFtp(source);

    // otherwise assume a "normal" file
    return new BamFile(source);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x11701(%rip), %rsi     # 0x568df
callq 0x264c0
testl %eax, %eax
je 0x4525d
leaq 0x116f3(%rip), %rsi     # 0x568e1
movq %rbx, %rdi
callq 0x264c0
testl %eax, %eax
je 0x4525d
leaq 0x116e6(%rip), %rsi     # 0x568e7
movq %rbx, %rdi
callq 0x264c0
testl %eax, %eax
je 0x4525d
leaq 0x116da(%rip), %rsi     # 0x568ee
movl $0x7, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x28b00
testq %rax, %rax
je 0x4527d
leaq 0x116c7(%rip), %rsi     # 0x568f6
movl $0x6, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x28b00
testq %rax, %rax
je 0x45297
movl $0x58, %edi
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x27990
jmp 0x45272
movl $0x38, %edi
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
callq 0x26e10
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0xc8, %edi
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x278e0
jmp 0x45272
movl $0x120, %edi            # imm = 0x120
callq 0x276b0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x280d0
jmp 0x45272
jmp 0x452b7
jmp 0x452b7
jmp 0x452b7
movq %rax, %rbx
movq %r14, %rdi
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/BamFtp_p.cpp
// Function: BamTools::Internal::BamFtp::~BamFtp()
BamFtp::~BamFtp(void) {

    // close connection & clean up
    Close();
    if ( m_commandSocket )
        delete m_commandSocket;
    if ( m_dataSocket )
        delete m_dataSocket;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x2548b(%rip), %rax     # 0x6afd0
addq $0x10, %rax
movq %rax, (%rdi)
callq 0x26670
movq 0x30(%rbx), %r15
testq %r15, %r15
je 0x45b6a
movq %r15, %rdi
callq 0x26880
movq %r15, %rdi
callq 0x27560
movq 0x38(%rbx), %r15
testq %r15, %r15
je 0x45b83
movq %r15, %rdi
callq 0x26880
movq %r15, %rdi
callq 0x27560
movq 0xf0(%rbx), %rdi
leaq 0x100(%rbx), %rax
cmpq %rax, %rdi
je 0x45b9b
callq 0x27560
movq 0xd0(%rbx), %rdi
leaq 0xe0(%rbx), %rax
cmpq %rax, %rdi
je 0x45bb3
callq 0x27560
movq 0xb0(%rbx), %rdi
leaq 0xc0(%rbx), %rax
cmpq %rax, %rdi
je 0x45bcb
callq 0x27560
movq 0x90(%rbx), %rdi
leaq 0xa0(%rbx), %rax
cmpq %rax, %rdi
je 0x45be3
callq 0x27560
movq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
cmpq %rax, %rdi
je 0x45bf5
callq 0x27560
movq 0x40(%rbx), %rdi
leaq 0x50(%rbx), %rax
cmpq %rax, %rdi
je 0x45c07
callq 0x27560
movq 0x2530a(%rip), %rax     # 0x6af18
addq $0x10, %rax
movq %rax, (%rbx)
movq 0x10(%rbx), %rdi
addq $0x20, %rbx
cmpq %rbx, %rdi
je 0x45c2c
popq %rbx
popq %r14
popq %r15
jmp 0x27560
popq %rbx
popq %r14
popq %r15
retq
jmp 0x45c34
movq %rax, %r14
movq %r15, %rdi
callq 0x27560
jmp 0x45c44
movq %rax, %r14
movq 0xf0(%rbx), %rdi
leaq 0x100(%rbx), %rax
cmpq %rax, %rdi
je 0x45c5c
callq 0x27560
movq 0xd0(%rbx), %rdi
leaq 0xe0(%rbx), %rax
cmpq %rax, %rdi
je 0x45c74
callq 0x27560
movq 0xb0(%rbx), %rdi
leaq 0xc0(%rbx), %rax
cmpq %rax, %rdi
je 0x45c8c
callq 0x27560
movq 0x90(%rbx), %rdi
leaq 0xa0(%rbx), %rax
cmpq %rax, %rdi
je 0x45ca4
callq 0x27560
movq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
cmpq %rax, %rdi
je 0x45cb6
callq 0x27560
movq 0x40(%rbx), %rdi
leaq 0x50(%rbx), %rax
cmpq %rax, %rdi
je 0x45cc8
callq 0x27560
movq 0x25249(%rip), %rax     # 0x6af18
addq $0x10, %rax
movq %rax, (%rbx)
movq 0x10(%rbx), %rdi
addq $0x20, %rbx
cmpq %rbx, %rdi
je 0x45ce8
callq 0x27560
movq %r14, %rdi
callq 0x28c20