// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::CheckVersion()
void BamToolsIndex::CheckVersion(void) {

    // read version from file
    const int64_t numBytesRead = m_resources.Device->Read((char*)&m_inputVersion, sizeof(m_inputVersion));
    if ( numBytesRead != sizeof(m_inputVersion) )
        throw BamException("BamToolsIndex::CheckVersion", "could not read format version");
    if ( m_isBigEndian ) SwapEndian_32(m_inputVersion);

    // if version is negative, or zero
    if ( m_inputVersion <= 0 )
        throw BamException("BamToolsIndex::CheckVersion", "invalid format version");

    // if version is newer than can be supported by this version of bamtools
    else if ( m_inputVersion > m_outputVersion ) {
        const string message = "unsupported format: this index was created by a newer version of BamTools. "
                               "Update your local version of BamTools to use the index file.";
        throw BamException("BamToolsIndex::CheckVersion", message);
    }

    // ------------------------------------------------------------------
    // check for deprecated, unsupported versions
    // (the format had to be modified to accomodate a particular bug fix)

    // Version 2.0: introduced support for half-open intervals, instead of the old closed intervals
    //   respondBy: throwing exception - we're not going to try to handle the old BTI files.
    else if ( (Version)m_inputVersion < BamToolsIndex::BTI_2_0 ) {
        const string message = "unsupported format: this version of the index may not properly handle "
                               "coordinate intervals. Please run 'bamtools index -bti -in yourData.bam' "
                               "to generate an up-to-date, fixed BTI file.";
        throw BamException("BamToolsIndex::CheckVersion", message);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
leaq 0x54(%rbx), %r14
movq (%rdi), %rax
movq %r14, %rsi
movl $0x4, %edx
callq *0x28(%rax)
cmpq $0x4, %rax
jne 0x42e90
movl 0x54(%rbx), %eax
cmpb $0x1, 0x30(%rbx)
jne 0x42e69
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, (%r14)
testl %eax, %eax
jle 0x42f0e
cmpl 0x58(%rbx), %eax
jg 0x42f8c
cmpl $0x3, %eax
jbe 0x43007
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x13641(%rip), %rsi     # 0x564ee
leaq 0x13655(%rip), %rdx     # 0x56509
movq %rsp, %rdi
callq 0x26750
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1363d(%rip), %rsi     # 0x5650a
leaq 0x13653(%rip), %rdx     # 0x56527
leaq 0x20(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x2803e(%rip), %rsi     # 0x6af38
movq 0x28077(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x43080
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x135c3(%rip), %rsi     # 0x564ee
leaq 0x135d7(%rip), %rdx     # 0x56509
movq %rsp, %rdi
callq 0x26750
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x135dd(%rip), %rsi     # 0x56528
leaq 0x135ec(%rip), %rdx     # 0x5653e
leaq 0x20(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x27fc0(%rip), %rsi     # 0x6af38
movq 0x27ff9(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x43080
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x135a3(%rip), %rsi     # 0x5653f
leaq 0x13623(%rip), %rdx     # 0x565c6
movq %rsp, %rdi
callq 0x26750
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13525(%rip), %rsi     # 0x564ee
leaq 0x13539(%rip), %rdx     # 0x56509
leaq 0x20(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x27f42(%rip), %rsi     # 0x6af38
movq 0x27f7b(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x43080
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x135b0(%rip), %rsi     # 0x565c7
leaq 0x13661(%rip), %rdx     # 0x5667f
movq %rsp, %rdi
callq 0x26750
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x134aa(%rip), %rsi     # 0x564ee
leaq 0x134be(%rip), %rdx     # 0x56509
leaq 0x20(%rsp), %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x27ec7(%rip), %rsi     # 0x6af38
movq 0x27f00(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x43084
jmp 0x4309d
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x43096
callq 0x27560
testb %bpl, %bpl
jne 0x430a0
jmp 0x430a8
movq %rax, %rbx
movq %r14, %rdi
callq 0x27070
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4310a
callq 0x27560
jmp 0x4310a
jmp 0x430bc
jmp 0x430e3
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x430ce
callq 0x27560
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x430dc
callq 0x27560
testb %bpl, %bpl
jne 0x43102
jmp 0x4310a
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x43102
callq 0x27560
jmp 0x43102
jmp 0x430f8
movq %rax, %rbx
jmp 0x4310a
jmp 0x430ff
movq %rax, %rbx
movq %r14, %rdi
callq 0x27070
movq %rbx, %rdi
callq 0x28c10