// File: 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:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movq 0x60(%rsi), %rdi
addq $0x54, %rsi
movq (%rdi), %rax
movl $0x4, %edx
callq *0x28(%rax)
movq %rax, 0x1b8(%rsp)
cmpq $0x4, 0x1b8(%rsp)
je 0xc094f
movb $0x1, 0x15e(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x50(%rsp)
leaq 0x197(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x7b5f0
movq 0x58(%rsp), %rdx
leaq 0x2af04(%rip), %rsi     # 0xeb73f
leaq 0x198(%rsp), %rdi
callq 0x78e70
jmp 0xc084a
leaq 0x15f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x7b5f0
movq 0x48(%rsp), %rdx
leaq 0x2aef3(%rip), %rsi     # 0xeb75b
leaq 0x160(%rsp), %rdi
callq 0x78e70
jmp 0xc0877
movq 0x50(%rsp), %rdi
leaq 0x198(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0x79cd0
jmp 0xc0893
movq 0x50(%rsp), %rdi
movb $0x0, 0x15e(%rsp)
movq 0x51669(%rip), %rsi     # 0x111f10
movq 0x516b2(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xc0d8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0927
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0909
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x7cce8
jmp 0xc0907
jmp 0xc0909
leaq 0x15f(%rsp), %rdi
callq 0x76f80
leaq 0x198(%rsp), %rdi
callq 0x7cce8
jmp 0xc0925
jmp 0xc0927
leaq 0x197(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x15e(%rsp)
jne 0xc0940
jmp 0xc094a
movq 0x50(%rsp), %rdi
callq 0x74e00
jmp 0xc0d78
movq 0x60(%rsp), %rax
testb $0x1, 0x30(%rax)
je 0xc0968
movq 0x60(%rsp), %rdi
addq $0x54, %rdi
callq 0x75b80
movq 0x60(%rsp), %rax
cmpl $0x0, 0x54(%rax)
jg 0xc0ac0
movb $0x1, 0x10e(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x38(%rsp)
leaq 0x137(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x7b5f0
movq 0x40(%rsp), %rdx
leaq 0x2ad93(%rip), %rsi     # 0xeb73f
leaq 0x138(%rsp), %rdi
callq 0x78e70
jmp 0xc09bb
leaq 0x10f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x7b5f0
movq 0x30(%rsp), %rdx
leaq 0x2ada0(%rip), %rsi     # 0xeb779
leaq 0x110(%rsp), %rdi
callq 0x78e70
jmp 0xc09e8
movq 0x38(%rsp), %rdi
leaq 0x138(%rsp), %rsi
leaq 0x110(%rsp), %rdx
callq 0x79cd0
jmp 0xc0a04
movq 0x38(%rsp), %rdi
movb $0x0, 0x10e(%rsp)
movq 0x514f8(%rip), %rsi     # 0x111f10
movq 0x51541(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xc0d8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0a98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0a7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xc0a78
jmp 0xc0a7a
leaq 0x10f(%rsp), %rdi
callq 0x76f80
leaq 0x138(%rsp), %rdi
callq 0x7cce8
jmp 0xc0a96
jmp 0xc0a98
leaq 0x137(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x10e(%rsp)
jne 0xc0ab1
jmp 0xc0abb
movq 0x38(%rsp), %rdi
callq 0x74e00
jmp 0xc0d78
movq 0x60(%rsp), %rcx
movl 0x54(%rcx), %eax
cmpl 0x58(%rcx), %eax
jle 0xc0c28
leaq 0xe7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x7b5f0
movq 0x28(%rsp), %rdx
leaq 0x2aca1(%rip), %rsi     # 0xeb790
leaq 0xe8(%rsp), %rdi
callq 0x78e70
jmp 0xc0afe
leaq 0xe7(%rsp), %rdi
callq 0x76f80
movb $0x1, 0xbe(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x18(%rsp)
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7b5f0
movq 0x20(%rsp), %rdx
leaq 0x2abff(%rip), %rsi     # 0xeb73f
leaq 0xc0(%rsp), %rdi
callq 0x78e70
jmp 0xc0b4f
movq 0x18(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x79cd0
jmp 0xc0b6b
movq 0x18(%rsp), %rdi
movb $0x0, 0xbe(%rsp)
movq 0x51391(%rip), %rsi     # 0x111f10
movq 0x513da(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xc0d8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0xe7(%rsp), %rdi
callq 0x76f80
jmp 0xc0d78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0bf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xc0bef
jmp 0xc0bf1
leaq 0xbf(%rsp), %rdi
callq 0x76f80
testb $0x1, 0xbe(%rsp)
jne 0xc0c0a
jmp 0xc0c14
movq 0x18(%rsp), %rdi
callq 0x74e00
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xc0c23
jmp 0xc0d78
movq 0x60(%rsp), %rax
cmpl $0x4, 0x54(%rax)
jge 0xc0d6c
leaq 0x97(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x2abc3(%rip), %rsi     # 0xeb818
leaq 0x98(%rsp), %rdi
callq 0x78e70
jmp 0xc0c64
leaq 0x97(%rsp), %rdi
callq 0x76f80
movb $0x1, 0x6e(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, (%rsp)
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x2aaa0(%rip), %rsi     # 0xeb73f
leaq 0x70(%rsp), %rdi
callq 0x78e70
jmp 0xc0cab
movq (%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x79cd0
jmp 0xc0cc3
movq (%rsp), %rdi
movb $0x0, 0x6e(%rsp)
movq 0x5123d(%rip), %rsi     # 0x111f10
movq 0x51286(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xc0d8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0x97(%rsp), %rdi
callq 0x76f80
jmp 0xc0d78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
jmp 0xc0d3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x188(%rsp)
movl %eax, 0x184(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7cce8
jmp 0xc0d3d
jmp 0xc0d3f
leaq 0x6f(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x6e(%rsp)
jne 0xc0d52
jmp 0xc0d5b
movq (%rsp), %rdi
callq 0x74e00
leaq 0x98(%rsp), %rdi
callq 0x7cce8
jmp 0xc0d6a
jmp 0xc0d78
jmp 0xc0d6e
jmp 0xc0d70
addq $0x1c8, %rsp            # imm = 0x1C8
retq
movq 0x188(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax)