// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateVersion()
bool SamHeaderValidator::ValidateVersion(void) {

    const string& version = m_header.Version;

    // warn if version not present
    if ( version.empty() ) {
        AddWarning("Version (VN) missing. Not required, but strongly recommended");
        return true;
    }

    // invalid if version does not contain a period
    const size_t periodFound = version.find(Constants::SAM_PERIOD);
    if ( periodFound == string::npos ) {
        AddError("Invalid version (VN) format: " + version);
        return false;
    }

    // invalid if major version is empty or contains non-digits
    const string majorVersion = version.substr(0, periodFound);
    if ( majorVersion.empty() || !ContainsOnlyDigits(majorVersion) ) {
        AddError("Invalid version (VN) format: " + version);
        return false;
    }

    // invalid if major version is empty or contains non-digits
    const string minorVersion = version.substr(periodFound + 1);
    if ( minorVersion.empty() || !ContainsOnlyDigits(minorVersion) ) {
        AddError("Invalid version (VN) format: " + version);
        return false;
    }

    // TODO: check if version is not just syntactically OK,
    // but is also a valid SAM version ( 1.0 .. CURRENT )

    // all checked out this far, then version is OK
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
movq (%rdi), %r14
cmpq $0x0, 0x8(%r14)
je 0x59706
pushq $0x2e
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x33d30
cmpq $-0x1, %rax
je 0x59769
movq %rax, %r15
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x332a0
cmpq $0x0, 0x8(%r12)
je 0x59732
movq %rsp, %rsi
callq 0x32010
testb %al, %al
je 0x59732
incq %r15
leaq 0x20(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r14, %rsi
movq %r15, %rdx
callq 0x332a0
cmpq $0x0, 0x28(%rsp)
je 0x596cd
leaq 0x20(%rsp), %rsi
callq 0x32010
movb $0x1, %bpl
testb %al, %al
jne 0x596fa
leaq 0x3e6a(%rip), %rsi      # 0x5d53e
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
callq 0x32d90
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x32f20
leaq 0x40(%rsp), %rdi
callq 0x33a00
xorl %ebp, %ebp
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x5975f
leaq 0x3df4(%rip), %rsi      # 0x5d501
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x31b30
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x31dc0
movq %rsp, %rdi
callq 0x33a00
movb $0x1, %bpl
jmp 0x59793
leaq 0x3e05(%rip), %rsi      # 0x5d53e
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
callq 0x32d90
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x32f20
leaq 0x20(%rsp), %rdi
callq 0x33a00
xorl %ebp, %ebp
movq %rsp, %rdi
callq 0x33a00
jmp 0x59793
leaq 0x3dce(%rip), %rsi      # 0x5d53e
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x32d90
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32f20
movq %rsp, %rdi
callq 0x33a00
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x597b3
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x33a00
jmp 0x597b6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x597f2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x597ff
jmp 0x597ef
jmp 0x597ef
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x597f2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x597ff
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x597ff
movq %rax, %rbx
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop