// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::LoadReferenceData()
bool BamReaderPrivate::LoadReferenceData(void) {

    // get number of reference sequences
    char buffer[sizeof(uint32_t)];
    m_stream.Read(buffer, sizeof(uint32_t));
    uint32_t numberRefSeqs = BamTools::UnpackUnsignedInt(buffer);
    if ( m_isBigEndian ) BamTools::SwapEndian_32(numberRefSeqs);
    m_references.reserve((int)numberRefSeqs);

    // iterate over all references in header
    for ( unsigned int i = 0; i != numberRefSeqs; ++i ) {

        // get length of reference name
        m_stream.Read(buffer, sizeof(uint32_t));
        uint32_t refNameLength = BamTools::UnpackUnsignedInt(buffer);
        if ( m_isBigEndian ) BamTools::SwapEndian_32(refNameLength);
        RaiiBuffer refName(refNameLength);

        // get reference name and reference sequence length
        m_stream.Read(refName.Buffer, refNameLength);
        m_stream.Read(buffer, sizeof(int32_t));
        int32_t refLength = BamTools::UnpackSignedInt(buffer);
        if ( m_isBigEndian ) BamTools::SwapEndian_32(refLength);

        // store data for reference
        RefData aReference;
        aReference.RefName   = (string)((const char*)refName.Buffer);
        aReference.RefLength = refLength;
        m_references.push_back(aReference);
    }

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r12
leaq 0x1e8(%rdi), %r14
leaq 0x14(%rsp), %r13
pushq $0x4
popq %rbp
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x343e0
movl (%r13), %eax
movl %eax, %ebx
bswapl %ebx
cmpb $0x0, 0x40(%r12)
cmovel %eax, %ebx
leaq 0x28(%r12), %rdi
movslq %ebx, %rsi
movq %rdi, 0x28(%rsp)
callq 0x32950
subl $0x1, %ebx
jb 0x448d9
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x343e0
movl 0x14(%rsp), %eax
movq %r13, %rbp
movl %eax, %r13d
bswapl %r13d
movq %r12, %r15
cmpb $0x0, 0x40(%r12)
cmovel %eax, %r13d
movq %r13, %rdi
callq 0x31080
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x320d0
movq %r12, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %r13
pushq $0x4
popq %rbp
callq 0x343e0
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x343e0
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movq %r15, %r12
cmpb $0x1, 0x40(%r15)
jne 0x4484e
leaq 0x10(%rsp), %rdi
callq 0x32c90
leaq 0x58(%rsp), %r15
movq %r15, %rdi
leaq 0x17607(%rip), %rsi     # 0x5be64
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x33ff0
andl $0x0, 0x50(%rsp)
movq %r15, %rdi
callq 0x33a00
movq 0x18(%rsp), %rsi
movq %r15, %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x32060
movq %r15, %rdi
callq 0x33a00
movl 0x10(%rsp), %eax
movl %eax, 0x50(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %r15
movq %r15, %rsi
callq 0x31e50
movq %r15, %rdi
callq 0x33a00
leaq 0x18(%rsp), %rdi
callq 0x34850
jmp 0x447bd
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4490e
jmp 0x4491d
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x33a00
jmp 0x44920
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x33a00
jmp 0x44911
jmp 0x4491d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x33a00
jmp 0x44920
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x34850
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f