// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::ReadBlock(BamTools::Internal::BtiBlock&)
void BamToolsIndex::ReadBlock(BtiBlock& block) {

    // read in block data members
    int64_t numBytesRead = 0;
    numBytesRead += m_resources.Device->Read((char*)&block.MaxEndPosition, sizeof(block.MaxEndPosition));
    numBytesRead += m_resources.Device->Read((char*)&block.StartOffset,    sizeof(block.StartOffset));
    numBytesRead += m_resources.Device->Read((char*)&block.StartPosition,  sizeof(block.StartPosition));

    // swap endian-ness if necessary
    if ( m_isBigEndian ) {
        SwapEndian_32(block.MaxEndPosition);
        SwapEndian_64(block.StartOffset);
        SwapEndian_32(block.StartPosition);
    }

    // check block read ok
    const int expectedBytes = sizeof(block.MaxEndPosition) +
                              sizeof(block.StartOffset) +
                              sizeof(block.StartPosition);
    if ( numBytesRead != expectedBytes )
        throw BamException("BamToolsIndex::ReadBlock", "could not read block");
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x90(%rsp)
movq 0x60(%rax), %rdi
movq 0x98(%rsp), %rsi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
movq %rax, %rcx
movq 0x20(%rsp), %rax
addq 0x90(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movq 0x60(%rax), %rdi
movq 0x98(%rsp), %rsi
addq $0x8, %rsi
movq (%rdi), %rax
movl $0x8, %edx
callq *0x28(%rax)
movq %rax, %rcx
movq 0x20(%rsp), %rax
addq 0x90(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movq 0x60(%rax), %rdi
movq 0x98(%rsp), %rsi
addq $0x10, %rsi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
movq %rax, %rcx
movq 0x20(%rsp), %rax
addq 0x90(%rsp), %rcx
movq %rcx, 0x90(%rsp)
testb $0x1, 0x30(%rax)
je 0xc360a
movq 0x98(%rsp), %rdi
callq 0x75b80
movq 0x98(%rsp), %rdi
addq $0x8, %rdi
callq 0x7a460
movq 0x98(%rsp), %rdi
addq $0x10, %rdi
callq 0x75b80
movl $0x10, 0x8c(%rsp)
cmpq $0x10, 0x90(%rsp)
je 0xc3731
movb $0x1, 0x2e(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x10(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0x283af(%rip), %rsi     # 0xeba02
leaq 0x68(%rsp), %rdi
callq 0x78e70
jmp 0xc365f
leaq 0x2f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x283a1(%rip), %rsi     # 0xeba1b
leaq 0x30(%rsp), %rdi
callq 0x78e70
jmp 0xc3686
movq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x79cd0
jmp 0xc369c
movq 0x10(%rsp), %rdi
movb $0x0, 0x2e(%rsp)
movq 0x4e863(%rip), %rsi     # 0x111f10
movq 0x4e8ac(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xc374b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xc3712
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xc36fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x7cce8
jmp 0xc36f8
jmp 0xc36fa
leaq 0x2f(%rsp), %rdi
callq 0x76f80
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xc3710
jmp 0xc3712
leaq 0x67(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x2e(%rsp)
jne 0xc3725
jmp 0xc372f
movq 0x10(%rsp), %rdi
callq 0x74e00
jmp 0xc3739
addq $0xa8, %rsp
retq
movq 0x58(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax,%rax)