// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/parseutils.c
// Function: parse_range
static int parse_range(GtRange *range, const char *start, const char *end,
                       unsigned int line_number, const char *filename,
                       bool tidy, bool correct_negative, GtError *err)
{
  GtWord start_val, end_val;
  char *ep;

  gt_assert(start && end && filename);
  gt_error_check(err);

  range->start = GT_UNDEF_UWORD;
  range->end = GT_UNDEF_UWORD;

  /* parse and check start */
  errno = 0;
  start_val = strtol(start, &ep, 10);
  if (start[0] == '\0' || *ep != '\0') {
    gt_error_set(err, "could not parse number '%s' on line %u in file '%s'",
                 start, line_number, filename);
    return -1;
  }
  if (errno == ERANGE && (start_val == LONG_MAX || start_val == LONG_MIN)) {
    gt_error_set(err, "number '%s' out of range on line %u in file '%s'", start,
                 line_number, filename);
    return -1;
  }
  if (start_val < 0) {
    if (tidy || correct_negative) {
      gt_warning("start '%s' is negative on line %u in file '%s'; reset to 1",
                 start, line_number, filename);
      start_val = 1;
    }
    else {
      gt_error_set(err, "start '%s' is negative on line %u in file '%s'", start,
                   line_number, filename);
      return -1;
    }
  }
  if (start_val == 0 && tidy) {
    gt_warning("start '%s' is zero on line %u in file '%s' (GFF3 files are "
               "1-based); reset to 1", start, line_number, filename);
    start_val = 1;
  }

  /* parse and check end */
  errno = 0;
  end_val = strtol(end, &ep, 10);
  if (end[0] == '\0' || *ep != '\0') {
    gt_error_set(err, "could not parse number '%s' on line %u in file '%s'",
                 end, line_number, filename);
    return -1;
  }
  if (errno == ERANGE && (end_val == LONG_MAX || end_val == LONG_MIN)) {
    gt_error_set(err, "number '%s' out of range on line %u in file '%s'", end,
                 line_number, filename);
    return -1;
  }
  if (end_val < 0) {
    if (tidy || correct_negative) {
      gt_warning("end '%s' is negative on line %u in file '%s'; reset to 1",
                 end, line_number, filename);
      end_val = 1;
    }
    else {
      gt_error_set(err, "end '%s' is negative on line %u in file '%s'", end,
                   line_number, filename);
      return -1;
    }
  }
  if (end_val == 0 && tidy) {
    gt_warning("end '%s' is zero on line %u in file '%s' (GFF3 files are "
               "1-based); reset to 1", end, line_number, filename);
    end_val = 1;
  }

  /* check range */
  if (start_val > end_val) {
    if (tidy) {
      long tmp_val;
      gt_warning("start '" GT_WU "' is larger then end '" GT_WU "' on line %u "
                 "in file '%s'; swap them", start_val, end_val, line_number,
                 filename);
      tmp_val = start_val;
      start_val = end_val;
      end_val = tmp_val;
    }
    else {
      gt_error_set(err, "start '" GT_WU "' is larger then end '" GT_WU "' on "
                   "line %u in file '%s'", start_val, end_val, line_number,
                   filename);
      return -1;
    }
  }

  /* set result */
  range->start = start_val;
  range->end = end_val;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
testq %rsi, %rsi
je 0x11bc6
movq %rdx, %r12
testq %rdx, %rdx
je 0x11bc6
movq %r8, %rbx
testq %r8, %r8
je 0x11bc6
movq %rsi, %rbp
movq %rdi, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x119bb
callq 0xc103
testb %al, %al
jne 0x11bf0
callq 0xb060
movq %rax, %r15
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%r14)
andl $0x0, (%rax)
leaq 0x10(%rsp), %rsi
pushq $0xa
popq %rdx
movq %rbp, %rdi
callq 0xb890
cmpb $0x0, (%rbp)
je 0x119f2
movq %rax, %r13
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x11a21
leaq 0xba2f7(%rip), %rsi     # 0xcbcf0
movq 0x58(%rsp), %rdi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $-0x7fffffffffffffff, %rcx # imm = 0x8000000000000001
cmpl $0x22, (%r15)
sete %al
addq %r13, %rcx
cmpq $0x2, %rcx
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x11a4c
leaq 0xba2da(%rip), %rsi     # 0xcbd24
jmp 0x119f9
movb 0x50(%rsp), %cl
testq %r13, %r13
js 0x11a70
movb %cl, 0x7(%rsp)
setne %al
movl 0xc(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x11a9c
leaq 0xba351(%rip), %rdi     # 0xcbdbf
jmp 0x11a87
movl 0xc(%rsp), %eax
orb %cl, %al
je 0x11b03
movb %cl, 0x7(%rsp)
leaq 0xba2ce(%rip), %rdi     # 0xcbd55
movq %rbp, %rsi
movl 0x8(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x161b0
pushq $0x1
popq %r13
andl $0x0, (%r15)
leaq 0x10(%rsp), %rsi
pushq $0xa
popq %rdx
movq %r12, %rdi
callq 0xb890
cmpb $0x0, (%r12)
je 0x11ac4
movq %rax, %rbp
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x11ad8
leaq 0xba225(%rip), %rsi     # 0xcbcf0
movq 0x58(%rsp), %rdi
movq %r12, %rdx
jmp 0x11a01
cmpl $0x22, (%r15)
sete %al
movabsq $-0x7fffffffffffffff, %rcx # imm = 0x8000000000000001
addq %rbp, %rcx
cmpq $0x2, %rcx
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x11b0f
leaq 0xba223(%rip), %rsi     # 0xcbd24
jmp 0x11acb
leaq 0xba286(%rip), %rsi     # 0xcbd90
jmp 0x119f9
testq %rbp, %rbp
js 0x11b2b
setne %al
movl 0xc(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x11b54
leaq 0xba34c(%rip), %rdi     # 0xcbe75
jmp 0x11b40
movb 0x7(%rsp), %al
orb 0xc(%rsp), %al
je 0x11bba
leaq 0xba2cf(%rip), %rdi     # 0xcbe0f
pushq $0x1
popq %rbp
movq %r12, %rsi
movl 0x8(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x161b0
cmpq %rbp, %r13
jbe 0x11b80
cmpb $0x0, 0xc(%rsp)
je 0x11b94
leaq 0xba35c(%rip), %rdi     # 0xcbec3
movq %r13, %rsi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x161b0
movq %rbp, %rax
jmp 0x11b86
movq %r13, %rax
movq %rbp, %r13
movq %rax, (%r14)
movq %r13, 0x8(%r14)
xorl %eax, %eax
jmp 0x11a12
leaq 0xba370(%rip), %rsi     # 0xcbf0b
movq 0x58(%rsp), %rdi
movq %r13, %rdx
movq %rbp, %rcx
movl 0x8(%rsp), %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0xc007
jmp 0x11a0f
leaq 0xba287(%rip), %rsi     # 0xcbe48
jmp 0x11acb
movq 0x11c3eb(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xb848f(%rip), %rsi     # 0xca066
leaq 0xba0ed(%rip), %rdx     # 0xcbccb
leaq 0xba0ff(%rip), %rcx     # 0xcbce4
leaq 0xb9e55(%rip), %r8      # 0xcba41
pushq $0x7b
jmp 0x11c18
movq 0x11c3c1(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xb8465(%rip), %rsi     # 0xca066
leaq 0xb8a51(%rip), %rdx     # 0xca659
leaq 0xba0d5(%rip), %rcx     # 0xcbce4
leaq 0xb9e2b(%rip), %r8      # 0xcba41
pushq $0x7c
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300