// File: 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:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x270(%rsp)
movq %rsi, 0x268(%rsp)
movq 0x270(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq %rsi, %rdi
addq $0x58, %rdi
addq $0x8, %rdi
addq $0x50, %rsi
movq 0x268(%rsp), %rdx
callq 0x71f00
movq 0x48(%rsp), %rax
movq 0x58(%rax), %rdi
movq 0x60(%rax), %rsi
movq 0x268(%rsp), %rax
movl (%rax), %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq %rax, 0x260(%rsp)
movq 0x260(%rsp), %rax
movq 0x268(%rsp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
je 0xb4f52
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x7b5f0
movq 0x40(%rsp), %rdx
leaq 0x363de(%rip), %rsi     # 0xeb0dc
leaq 0xb8(%rsp), %rdi
callq 0x78e70
jmp 0xb4d0d
movl $0x10, %edi
movl $0x8, %esi
callq 0x7b8d0
movl %eax, 0x3c(%rsp)
jmp 0xb4d22
movl 0x3c(%rsp), %edx
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x7a4b0
jmp 0xb4d3d
leaq 0xb8(%rsp), %rdi
callq 0x7cce8
jmp 0xb4d4c
leaq 0xb7(%rsp), %rdi
callq 0x76f80
leaq 0xe8(%rsp), %rdi
leaq 0x365ee(%rip), %rsi     # 0xeb356
callq 0x768e0
movq %rax, 0x30(%rsp)
jmp 0xb4d74
movq 0x30(%rsp), %rdi
movq 0x268(%rsp), %rax
movl (%rax), %esi
callq 0x78b20
movq %rax, 0x28(%rsp)
jmp 0xb4d8f
movq 0x28(%rsp), %rdi
leaq 0x365ce(%rip), %rsi     # 0xeb369
callq 0x768e0
movq %rax, 0x20(%rsp)
jmp 0xb4da7
movq 0x20(%rsp), %rdi
leaq 0x365bf(%rip), %rsi     # 0xeb372
callq 0x768e0
movq %rax, 0x18(%rsp)
jmp 0xb4dbf
movq 0x18(%rsp), %rdi
movq 0x260(%rsp), %rsi
callq 0x7ba30
jmp 0xb4dd3
movb $0x1, 0x57(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x8(%rsp)
leaq 0x7f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x36583(%rip), %rsi     # 0xeb385
leaq 0x80(%rsp), %rdi
callq 0x78e70
jmp 0xb4e11
leaq 0x58(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x76880
jmp 0xb4e25
movq 0x8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x79cd0
jmp 0xb4e3e
movq 0x8(%rsp), %rdi
movb $0x0, 0x57(%rsp)
movq 0x5d0c1(%rip), %rsi     # 0x111f10
movq 0x5d10a(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xb4f6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0xb4e9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x7cce8
jmp 0xb4e99
jmp 0xb4e9b
leaq 0xb7(%rsp), %rdi
callq 0x76f80
jmp 0xb4f5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0xb4f41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0xb4f22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0xb4f11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x7cce8
jmp 0xb4f0f
jmp 0xb4f11
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xb4f20
jmp 0xb4f22
leaq 0x7f(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x57(%rsp)
jne 0xb4f35
jmp 0xb4f3f
movq 0x8(%rsp), %rdi
callq 0x74e00
jmp 0xb4f41
leaq 0xd8(%rsp), %rdi
callq 0x74f60
jmp 0xb4f50
jmp 0xb4f5a
addq $0x278, %rsp            # imm = 0x278
retq
movq 0xa8(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nop