// File: zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::CheckLengthInRange(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool SamHeaderValidator::CheckLengthInRange(const string& length) {

    // invalid if empty
    if ( length.empty() ) {
        AddError("Sequence entry (@SQ) is missing LN tag");
        return false;
    }

    // convert string length to numeric
    stringstream lengthStream(length);
    unsigned int sequenceLength;
    lengthStream >> sequenceLength;

    // invalid if length outside accepted range
    if ( sequenceLength < Constants::SAM_SQ_LENGTH_MIN || sequenceLength > Constants::SAM_SQ_LENGTH_MAX ) {
        AddError("Sequence length (LN): " + length + " out of range");
        return false;
    }

    // otherwise OK
    return true;
}

// Assembly:
subq $0x248, %rsp            # imm = 0x248
movq %rdi, 0x238(%rsp)
movq %rsi, 0x230(%rsp)
movq 0x238(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x230(%rsp), %rdi
callq 0x7aba0
testb $0x1, %al
jne 0xe73aa
jmp 0xe7461
leaq 0x20f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x54ae(%rip), %rsi      # 0xec876
leaq 0x210(%rsp), %rdi
callq 0x78e70
jmp 0xe73d7
movq 0x18(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x763a0
jmp 0xe73eb
leaq 0x210(%rsp), %rdi
callq 0x7cce8
jmp 0xe73fa
leaq 0x20f(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x247(%rsp)
jmp 0xe75ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0xe744f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x7cce8
jmp 0xe744d
jmp 0xe744f
leaq 0x20f(%rsp), %rdi
callq 0x76f80
jmp 0xe75bc
movq 0x230(%rsp), %rax
movq %rax, (%rsp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x7b8d0
movq (%rsp), %rsi
movl %eax, %edx
leaq 0x70(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7a4b0
movq 0x8(%rsp), %rdi
leaq 0x6c(%rsp), %rsi
callq 0x71590
jmp 0xe74a2
cmpl $0x1, 0x6c(%rsp)
jb 0xe74b7
cmpl $0x1fffffff, 0x6c(%rsp) # imm = 0x1FFFFFFF
jbe 0xe7581
movq 0x230(%rsp), %rdx
leaq 0x53d7(%rip), %rsi      # 0xec89d
leaq 0x28(%rsp), %rdi
callq 0x75e70
jmp 0xe74d2
leaq 0x53db(%rip), %rdx      # 0xec8b4
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x785a0
jmp 0xe74ea
movq 0x18(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x763a0
jmp 0xe74fb
leaq 0x48(%rsp), %rdi
callq 0x7cce8
jmp 0xe7507
leaq 0x28(%rsp), %rdi
callq 0x7cce8
jmp 0xe7513
movb $0x0, 0x247(%rsp)
movl $0x1, 0x24(%rsp)
jmp 0xe7591
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0xe759d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0xe7573
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x7cce8
jmp 0xe7571
jmp 0xe7573
leaq 0x28(%rsp), %rdi
callq 0x7cce8
jmp 0xe757f
jmp 0xe759d
movb $0x1, 0x247(%rsp)
movl $0x1, 0x24(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x74f60
jmp 0xe75ab
leaq 0x70(%rsp), %rdi
callq 0x74f60
jmp 0xe75a9
jmp 0xe75bc
movb 0x247(%rsp), %al
andb $0x1, %al
addq $0x248, %rsp            # imm = 0x248
retq
movq 0x200(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw %cs:(%rax,%rax)