// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/giextract.c
// Function: extractkeyfromcurrentline
static int extractkeyfromcurrentline(Fastakeyquery *fastakeyptr,
                                     GtUword keysize,
                                     const GtStr *currentline,
                                     uint64_t linenum,
                                     const GtStr *fileofkeystoextract,
                                     GtError *err)
{
  char *lineptr = gt_str_get(currentline);
  GtWord readlongfrompos, readlongtopos;
  size_t idx;
  bool haserr = false;

  for (idx = 0; lineptr[idx] != '\0' && !isspace(lineptr[idx]); idx++)
    /* nothing */ ;
  if (keysize == 0)
  {
    fastakeyptr->fastakey = gt_malloc(sizeof (char) * (idx+1));
  } else
  {
    if (idx != (size_t) keysize)
    {
      gt_error_set(err,"key \"%*.*s\" is not of size "GT_WU"",(int) idx,
                   (int) idx,lineptr,keysize);
      haserr = true;
    }
  }
  if (!haserr)
  {
    strncpy(fastakeyptr->fastakey,lineptr,idx);
    fastakeyptr->fastakey[idx] = '\0';
    fastakeyptr->frompos = 1UL;
    fastakeyptr->topos = 0;
    if (sscanf(lineptr+idx, GT_WD " " GT_WD "\n",
               &readlongfrompos,&readlongtopos) == 2)
    {
      CHECKPOSITIVE(readlongfrompos,""GT_WD"","second");
      if (!haserr)
      {
        fastakeyptr->frompos = (GtUword) readlongfrompos;
        CHECKPOSITIVE(readlongtopos,""GT_WD"","third");
      }
      if (!haserr)
      {
        fastakeyptr->topos = (GtUword) readlongtopos;
      }
    }
  }
  if (!haserr)
  {
    fastakeyptr->markhit = false;
    if (!COMPLETE(fastakeyptr) && fastakeyptr->frompos > fastakeyptr->topos)
    {
      gt_error_set(err, "file \"%s\", line " Formatuint64_t
                        "illegal format: second value "
                        GT_WU " is larger than third value " GT_WU,
                        gt_str_get(fileofkeystoextract),
                        PRINTuint64_tcast(linenum+1),
                        fastakeyptr->frompos,
                        fastakeyptr->topos);
      haserr = true;
    }
  }
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, (%rsp)
movq %r8, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
movq %rdx, %rdi
callq 0xad1fa
movq %rax, %r13
pushq $0x1
popq %r15
xorl %ebp, %ebp
movsbq -0x1(%r13,%r15), %r14
testq %r14, %r14
je 0x15f290
callq 0x17820
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
jne 0x15f290
decq %rbp
incq %r15
jmp 0x15f26d
testq %rbx, %rbx
je 0x15f2c0
movq %rbx, %rax
addq %rbp, %rax
je 0x15f2dd
negl %ebp
leaq 0x1e8551(%rip), %rsi    # 0x3477f7
movq (%rsp), %rdi
movl %ebp, %edx
movl %ebp, %ecx
movq %r13, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x89dbb
jmp 0x15f401
leaq 0x1e81fb(%rip), %rsi    # 0x3474c2
movq %r15, %rdi
movl $0xb5, %edx
callq 0x93160
movq %rax, %rdi
movq %rax, (%r12)
jmp 0x15f2e1
movq (%r12), %rdi
movq %r13, %rbx
subq %rbp, %rbx
negq %rbp
movq %r13, %rsi
movq %rbp, %rdx
callq 0x17350
movq (%r12), %rax
movb $0x0, -0x1(%rax,%r15)
movq $0x1, 0x8(%r12)
andq $0x0, 0x10(%r12)
leaq 0x1e00c4(%rip), %rsi    # 0x33f3d9
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x177b0
cmpl $0x2, %eax
jne 0x15f352
movq 0x20(%rsp), %rax
testq %rax, %rax
jle 0x15f3a7
movq %rax, 0x8(%r12)
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
jle 0x15f3ce
movq %rcx, 0x10(%r12)
jmp 0x15f35c
movq 0x8(%r12), %rax
movq 0x10(%r12), %rcx
movq %rax, %rdx
xorq $0x1, %rdx
orq %rcx, %rdx
setne %dl
cmpq %rcx, %rax
seta %cl
movb $0x0, 0x18(%r12)
andb %dl, %cl
xorl %eax, %eax
cmpb $0x1, %cl
jne 0x15f404
movq 0x8(%rsp), %rdi
callq 0xad1fa
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x8(%r12), %r8
movq 0x10(%r12), %r9
leaq 0x1e84ce(%rip), %rsi    # 0x347873
jmp 0x15f3f3
movq 0x8(%rsp), %rdi
callq 0xad1fa
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x20(%rsp), %r9
leaq 0x1e8451(%rip), %rsi    # 0x347816
leaq 0x1e849a(%rip), %r8     # 0x347866
jmp 0x15f3f3
movq 0x8(%rsp), %rdi
callq 0xad1fa
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x18(%rsp), %r9
leaq 0x1e842a(%rip), %rsi    # 0x347816
leaq 0x1e847a(%rip), %r8     # 0x34786d
movq (%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq