// File: /workspace/github_c_makefile_star2_O3/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 0x3995d
movq %rdx, %r12
testq %rdx, %rdx
je 0x3995d
movq %r8, %rbx
testq %r8, %r8
je 0x3995d
movq %rsi, %rbp
movq %rdi, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x39742
callq 0x34fea
testb %al, %al
jne 0x39962
callq 0xb060
movq %rax, %r15
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%r14)
movl $0x0, (%rax)
leaq 0x10(%rsp), %rsi
movq %rbp, %rdi
movl $0xa, %edx
callq 0xb8a0
cmpb $0x0, (%rbp)
je 0x3977e
movq %rax, %r13
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x397af
leaq 0xa956b(%rip), %rsi     # 0xe2cf0
movq 0x58(%rsp), %rdi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x34f1f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
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 0x397da
leaq 0xa954c(%rip), %rsi     # 0xe2d24
jmp 0x39785
movb 0x50(%rsp), %cl
testq %r13, %r13
js 0x397fe
movb %cl, 0x7(%rsp)
setne %al
movl 0xc(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x3982c
leaq 0xa95c3(%rip), %rdi     # 0xe2dbf
jmp 0x39815
movl 0xc(%rsp), %eax
orb %cl, %al
je 0x39898
movb %cl, 0x7(%rsp)
leaq 0xa9540(%rip), %rdi     # 0xe2d55
movq %rbp, %rsi
movl 0x8(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3d110
movl $0x1, %r13d
movl $0x0, (%r15)
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
movl $0xa, %edx
callq 0xb8a0
cmpb $0x0, (%r12)
je 0x39859
movq %rax, %rbp
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x3986d
leaq 0xa9490(%rip), %rsi     # 0xe2cf0
movq 0x58(%rsp), %rdi
movq %r12, %rdx
jmp 0x3978d
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 0x398a4
leaq 0xa948e(%rip), %rsi     # 0xe2d24
jmp 0x39860
leaq 0xa94f1(%rip), %rsi     # 0xe2d90
jmp 0x39785
testq %rbp, %rbp
js 0x398c0
setne %al
movl 0xc(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x398eb
leaq 0xa95b7(%rip), %rdi     # 0xe2e75
jmp 0x398d5
movb 0x7(%rsp), %al
orb 0xc(%rsp), %al
je 0x39951
leaq 0xa953a(%rip), %rdi     # 0xe2e0f
movq %r12, %rsi
movl 0x8(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3d110
movl $0x1, %ebp
cmpq %rbp, %r13
jbe 0x39917
cmpb $0x0, 0xc(%rsp)
je 0x3992b
leaq 0xa95c5(%rip), %rdi     # 0xe2ec3
movq %r13, %rsi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x3d110
movq %rbp, %rax
jmp 0x3991d
movq %r13, %rax
movq %rbp, %r13
movq %rax, (%r14)
movq %r13, 0x8(%r14)
xorl %eax, %eax
jmp 0x397a0
leaq 0xa95d9(%rip), %rsi     # 0xe2f0b
movq 0x58(%rsp), %rdi
movq %r13, %rdx
movq %rbp, %rcx
movl 0x8(%rsp), %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x34f1f
jmp 0x3979b
leaq 0xa94f0(%rip), %rsi     # 0xe2e48
jmp 0x39860
callq 0xd775
callq 0xd7ac