// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r12
movq %rdx, %rdi
callq 0x11b0a1
movq %rax, %r13
movb (%rax), %r15b
testb %r15b, %r15b
je 0x1b18b3
callq 0x17870
movq (%rax), %rax
xorl %ebp, %ebp
movsbq %r15b, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x1b18b5
movb 0x1(%r13,%rbp), %r15b
incq %rbp
testb %r15b, %r15b
jne 0x1b1899
jmp 0x1b18b5
xorl %ebp, %ebp
testq %r14, %r14
je 0x1b18c9
cmpq %r14, %rbp
jne 0x1b19a8
movq (%r12), %rdi
jmp 0x1b18e5
leaq 0x1(%rbp), %rdi
leaq 0x1f586e(%rip), %rsi    # 0x3a7142
movl $0xb5, %edx
callq 0x104226
movq %rax, %rdi
movq %rax, (%r12)
movq %r13, %r14
addq %rbp, %r14
movq %r13, %rsi
movq %rbp, %rdx
callq 0x17370
movq (%r12), %rax
movb $0x0, (%rax,%rbp)
movq $0x1, 0x8(%r12)
movq $0x0, 0x10(%r12)
leaq 0x1ed7c2(%rip), %rsi    # 0x39f0d9
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x177f0
cmpl $0x2, %eax
jne 0x1b1958
movq 0x20(%rsp), %rax
testq %rax, %rax
jle 0x1b19c7
movq %rax, 0x8(%r12)
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
jle 0x1b19e9
movq %rcx, 0x10(%r12)
jmp 0x1b1962
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 0x1b1a20
movq 0x10(%rsp), %rdi
callq 0x11b0a1
incq %rbx
movq 0x8(%r12), %r8
movq 0x10(%r12), %r9
leaq 0x1f5b4d(%rip), %rsi    # 0x3a74f3
jmp 0x1b1a09
leaq 0x1f5ac8(%rip), %rsi    # 0x3a7477
movq 0x8(%rsp), %rdi
movl %ebp, %edx
movl %ebp, %ecx
movq %r13, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0xfcb67
jmp 0x1b1a1b
movq 0x10(%rsp), %rdi
callq 0x11b0a1
incq %rbx
movq 0x20(%rsp), %r9
leaq 0x1f5ab6(%rip), %rsi    # 0x3a7496
leaq 0x1f5aff(%rip), %r8     # 0x3a74e6
jmp 0x1b1a09
movq 0x10(%rsp), %rdi
callq 0x11b0a1
incq %rbx
movq 0x18(%rsp), %r9
leaq 0x1f5a94(%rip), %rsi    # 0x3a7496
leaq 0x1f5ae4(%rip), %r8     # 0x3a74ed
movq 0x8(%rsp), %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq