// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movq %rdx, %rdi
callq 0x120d23
movq %rax, %r13
movb (%rax), %r14b
testb %r14b, %r14b
je 0x1ba458
callq 0x17870
movq (%rax), %rax
xorl %ebp, %ebp
movsbq %r14b, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x1ba45a
movb 0x1(%r13,%rbp), %r14b
incq %rbp
testb %r14b, %r14b
jne 0x1ba43e
jmp 0x1ba45a
xorl %ebp, %ebp
testq %r12, %r12
je 0x1ba486
cmpq %r12, %rbp
je 0x1ba49e
leaq 0x1f65c8(%rip), %rsi    # 0x3b0a33
movq 0x8(%rsp), %rdi
movl %ebp, %edx
movl %ebp, %ecx
movq %r13, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r14b
jmp 0x1ba4a1
leaq 0x1(%rbp), %rdi
leaq 0x1f626d(%rip), %rsi    # 0x3b06fe
movl $0xb5, %edx
callq 0x1092b2
movq %rax, (%r15)
xorl %r14d, %r14d
testb %r14b, %r14b
jne 0x1ba58b
movq %r13, %r12
addq %rbp, %r12
movq (%r15), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x17370
movq (%r15), %rax
movb $0x0, (%rax,%rbp)
movq $0x1, 0x8(%r15)
movq $0x0, 0x10(%r15)
leaq 0x1ee0f6(%rip), %rsi    # 0x3a85d2
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x177f0
cmpl $0x2, %eax
jne 0x1ba58b
cmpq $0x0, 0x20(%rsp)
jg 0x1ba534
movq 0x10(%rsp), %rdi
callq 0x120d23
leaq 0x1(%rbx), %rcx
movq 0x20(%rsp), %r9
leaq 0x1f6537(%rip), %rsi    # 0x3b0a52
leaq 0x1f6580(%rip), %r8     # 0x3b0aa2
movq 0x8(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r14b
testb %r14b, %r14b
jne 0x1ba57d
movq 0x20(%rsp), %rax
movq %rax, 0x8(%r15)
cmpq $0x0, 0x18(%rsp)
jg 0x1ba57d
movq 0x10(%rsp), %rdi
callq 0x120d23
leaq 0x1(%rbx), %rcx
movq 0x18(%rsp), %r9
leaq 0x1f64ee(%rip), %rsi    # 0x3b0a52
leaq 0x1f653e(%rip), %r8     # 0x3b0aa9
movq 0x8(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r14b
testb %r14b, %r14b
jne 0x1ba58b
movq 0x18(%rsp), %rax
movq %rax, 0x10(%r15)
testb %r14b, %r14b
jne 0x1ba5dd
movb $0x0, 0x18(%r15)
movq 0x8(%r15), %rax
cmpq $0x1, %rax
jne 0x1ba5a6
cmpq $0x0, 0x10(%r15)
je 0x1ba5dd
cmpq 0x10(%r15), %rax
jbe 0x1ba5dd
movq 0x10(%rsp), %rdi
callq 0x120d23
incq %rbx
movq 0x8(%r15), %r8
movq 0x10(%r15), %r9
leaq 0x1f64e7(%rip), %rsi    # 0x3b0aaf
movq 0x8(%rsp), %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r14b
movzbl %r14b, %eax
negl %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq