// File: /workspace/github_cpp_makefile_star2_O1/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 0x42eb3
cmpb $0x1, 0x30(%rbx)
jne 0x42e89
movl (%r14), %eax
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)
movl (%r14), %eax
testl %eax, %eax
jle 0x42f31
cmpl 0x58(%rbx), %eax
jg 0x42faf
cmpl $0x3, %eax
jle 0x4302a
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1361e(%rip), %rsi     # 0x564ee
leaq 0x13632(%rip), %rdx     # 0x56509
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13618(%rip), %rsi     # 0x5650a
leaq 0x1362e(%rip), %rdx     # 0x56527
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x2801b(%rip), %rsi     # 0x6af38
movq 0x28054(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a30
jmp 0x430a3
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x135a0(%rip), %rsi     # 0x564ee
leaq 0x135b4(%rip), %rdx     # 0x56509
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x135b8(%rip), %rsi     # 0x56528
leaq 0x135c7(%rip), %rdx     # 0x5653e
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x27f9d(%rip), %rsi     # 0x6af38
movq 0x27fd6(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a30
jmp 0x430a3
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x13580(%rip), %rsi     # 0x5653f
leaq 0x13600(%rip), %rdx     # 0x565c6
leaq 0x20(%rsp), %rdi
callq 0x26750
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13500(%rip), %rsi     # 0x564ee
leaq 0x13514(%rip), %rdx     # 0x56509
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x27f1f(%rip), %rsi     # 0x6af38
movq 0x27f58(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a30
jmp 0x430a3
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1358d(%rip), %rsi     # 0x565c7
leaq 0x1363e(%rip), %rdx     # 0x5667f
leaq 0x20(%rsp), %rdi
callq 0x26750
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x13485(%rip), %rsi     # 0x564ee
leaq 0x13499(%rip), %rdx     # 0x56509
movq %rsp, %rdi
callq 0x26750
movb $0x1, %bpl
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x28490
xorl %ebp, %ebp
movq 0x27ea4(%rip), %rsi     # 0x6af38
movq 0x27edd(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a30
jmp 0x430a7
jmp 0x430ba
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x430c0
callq 0x27560
jmp 0x430c0
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x430cd
movq %r14, %rdi
callq 0x27070
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x43128
callq 0x27560
jmp 0x43128
jmp 0x430e2
jmp 0x430f5
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x430fb
callq 0x27560
jmp 0x430fb
movq %rax, %rbx
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4311b
callq 0x27560
jmp 0x4311b
jmp 0x4310e
movq %rax, %rbx
jmp 0x43128
jmp 0x43115
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x43128
movq %r14, %rdi
callq 0x27070
movq %rbx, %rdi
callq 0x28c20