// File: /workspace/github_c_makefile_star2_O1/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, 0x4(%rsp)
testq %rsi, %rsi
je 0x3a1c9
movq %rdx, %r12
testq %rdx, %rdx
je 0x3a1c9
movq %r8, %rbx
testq %r8, %r8
je 0x3a1c9
movq %rsi, %rbp
movq %rdi, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x39f86
callq 0x3566a
testb %al, %al
jne 0x3a1ce
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 0x39fc2
movq %rax, %r13
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x39ff3
leaq 0xa8d4a(%rip), %rsi     # 0xe2d13
movq 0x58(%rsp), %rdi
movq %rbp, %rdx
movl 0x4(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x3559f
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 0x3a01e
leaq 0xa8d2b(%rip), %rsi     # 0xe2d47
jmp 0x39fc9
testq %r13, %r13
jns 0x3a051
movl 0xc(%rsp), %eax
orb 0x50(%rsp), %al
cmpb $0x1, %al
jne 0x3a0f0
leaq 0xa8d3e(%rip), %rdi     # 0xe2d78
movq %rbp, %rsi
movl 0x4(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3da84
movl $0x1, %r13d
testq %r13, %r13
setne %al
movl 0xc(%rsp), %ecx
xorb $0x1, %cl
movb %cl, 0xb(%rsp)
orb %cl, %al
jne 0x3a084
leaq 0xa8d75(%rip), %rdi     # 0xe2de2
movq %rbp, %rsi
movl 0x4(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3da84
movl $0x1, %r13d
movl $0x0, (%r15)
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
movl $0xa, %edx
callq 0xb8a0
cmpb $0x0, (%r12)
je 0x3a0b1
movq %rax, %rbp
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x3a0c5
leaq 0xa8c5b(%rip), %rsi     # 0xe2d13
movq 0x58(%rsp), %rdi
movq %r12, %rdx
jmp 0x39fd1
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 0x3a0fc
leaq 0xa8c59(%rip), %rsi     # 0xe2d47
jmp 0x3a0b8
leaq 0xa8cbc(%rip), %rsi     # 0xe2db3
jmp 0x39fc9
testq %rbp, %rbp
jns 0x3a12e
movb 0x50(%rsp), %al
orb 0xc(%rsp), %al
cmpb $0x1, %al
jne 0x3a1bd
leaq 0xa8d1a(%rip), %rdi     # 0xe2e32
movq %r12, %rsi
movl 0x4(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3da84
movl $0x1, %ebp
testq %rbp, %rbp
setne %al
orb 0xb(%rsp), %al
jne 0x3a157
leaq 0xa8d57(%rip), %rdi     # 0xe2e98
movq %r12, %rsi
movl 0x4(%rsp), %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3da84
movl $0x1, %ebp
cmpq %rbp, %r13
jle 0x3a183
cmpb $0x0, 0xc(%rsp)
je 0x3a197
leaq 0xa8d7c(%rip), %rdi     # 0xe2ee6
movq %r13, %rsi
movq %rbp, %rdx
movl 0x4(%rsp), %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x3da84
movq %rbp, %rax
jmp 0x3a189
movq %r13, %rax
movq %rbp, %r13
movq %rax, (%r14)
movq %r13, 0x8(%r14)
xorl %eax, %eax
jmp 0x39fe4
leaq 0xa8d90(%rip), %rsi     # 0xe2f2e
movq 0x58(%rsp), %rdi
movq %r13, %rdx
movq %rbp, %rcx
movl 0x4(%rsp), %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3559f
jmp 0x39fdf
leaq 0xa8ca7(%rip), %rsi     # 0xe2e6b
jmp 0x3a0b8
callq 0xd775
callq 0xd7ac