// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/bioseq_col.c
// Function: grep_desc
static int grep_desc(GtBioseqCol *bsc, GtUword *filenum,
                     GtUword *seqnum, GtStr *seqid, GtError *err)
{
  GtUword i, j, num_matches = 0;
  const GtSeqInfo *seq_info_ptr;
  GtSeqInfo seq_info;
  GtStr *pattern, *escaped;
  bool match = false;
  int had_err = 0;
  gt_error_check(err);
  gt_assert(bsc && filenum && seqnum && seqid);
  /* create cache */
  if (!bsc->grep_cache)
    bsc->grep_cache = gt_seq_info_cache_new();
  /* try to read from cache */
  seq_info_ptr = gt_seq_info_cache_get(bsc->grep_cache, gt_str_get(seqid));
  if (seq_info_ptr) {
    if (bsc->duplicates && gt_hashmap_get(bsc->duplicates, gt_str_get(seqid))) {
      gt_error_set(err, "query seqid '%s' could match more than one "
                        "sequence description", gt_str_get(seqid));
      return -1;
    }
    *filenum = seq_info_ptr->filenum;
    *seqnum = seq_info_ptr->seqnum;
    return 0;
  }
  pattern = gt_str_new();
  escaped = gt_str_new();
  gt_grep_escape_extended(escaped, gt_str_get(seqid), gt_str_length(seqid));
  if (bsc->matchdescstart)
    gt_str_append_cstr(pattern, "^");
  gt_str_append_str(pattern, escaped);
  if (bsc->matchdescstart)
    gt_str_append_cstr(pattern, "([[:space:]]|$)");
  for (i = 0; !had_err && i < bsc->num_of_seqfiles; i++) {
    GtBioseq *bioseq = bsc->bioseqs[i];
    for (j = 0; !had_err && j < gt_bioseq_number_of_sequences(bioseq); j++) {
      const char *desc = gt_bioseq_get_description(bioseq, j);
      had_err = gt_grep(&match, gt_str_get(pattern), desc, err);
      if (!had_err && match) {
        num_matches++;
        if (num_matches > 1) {
          gt_error_set(err, "query seqid '%s' could match more than one "
                            "sequence description", gt_str_get(seqid));
          had_err = -1;
          break;
        }
        *filenum = i;
        *seqnum = j;
        /* cache results */
        seq_info.filenum = i;
        seq_info.seqnum = j;
        gt_seq_info_cache_add(bsc->grep_cache, gt_str_get(seqid), &seq_info);
      }
    }
    if (match)
      break;
  }
  gt_str_delete(pattern);
  gt_str_delete(escaped);
  if (!had_err && num_matches == 0) {
    gt_error_set(err, "no description matched sequence ID '%s'",
                 gt_str_get(seqid));
    had_err = -1;
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %r13
movb $0x0, 0xf(%rsp)
testq %r8, %r8
je 0x9f4ab
movq %r15, %rdi
callq 0xc103
testb %al, %al
jne 0x9f756
cmpq $0x0, 0x20(%rsp)
je 0x9f72c
cmpq $0x0, 0x18(%rsp)
je 0x9f72c
movq 0x18(%r13), %r14
testq %r14, %r14
jne 0x9f4d8
callq 0xbffc4
movq %rax, %r14
movq %rax, 0x18(%r13)
movq %rbx, %rdi
callq 0x143d2
movq %r14, %rdi
movq %rax, %rsi
callq 0xc0019
testq %rax, %rax
movq %r15, 0x28(%rsp)
je 0x9f551
movq %rax, %r14
movq 0x20(%r13), %r15
testq %r15, %r15
je 0x9f532
movq %rbx, %rdi
callq 0x143d2
movq %r15, %rdi
movq %rax, %rsi
callq 0x55ef6
testq %rax, %rax
je 0x9f532
movq %rbx, %rdi
callq 0x143d2
leaq 0x4b972(%rip), %rsi     # 0xeae9a
movq 0x28(%rsp), %rdi
jmp 0x9f70c
movq (%r14), %rax
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%r14), %rax
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
xorl %r12d, %r12d
jmp 0x9f71a
callq 0x13d5c
movq %rax, %r12
callq 0x13d5c
movq %rax, %rbp
movq %rbx, %rdi
callq 0x143d2
movq %rax, %r14
movq %rbx, %rdi
callq 0x14461
movq %rbp, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x551fc
cmpb $0x1, 0x28(%r13)
jne 0x9f598
leaq 0x4b94a(%rip), %rsi     # 0xeaeda
movq %r12, %rdi
callq 0x13dd3
movq %rbx, 0x10(%rsp)
movq %r12, %rdi
movq %rbp, 0x40(%rsp)
movq %rbp, %rsi
callq 0x13eeb
cmpb $0x1, 0x28(%r13)
jne 0x9f5c3
leaq 0x4b921(%rip), %rsi     # 0xeaedc
movq %r12, %rdi
callq 0x13dd3
movq %r12, 0x38(%rsp)
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r13, 0x30(%rsp)
testl %r12d, %r12d
jne 0x9f6da
cmpq 0x10(%r13), %rbp
jae 0x9f6d7
movq 0x8(%r13), %rax
movq (%rax,%rbp,8), %r14
xorl %r13d, %r13d
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x9f69e
movq %r14, %rdi
callq 0x9dbb9
cmpq %rax, %r13
jae 0x9f69b
movq %r14, %rdi
movq %r13, %rsi
callq 0x9d478
movq %rax, %r12
movq 0x38(%rsp), %rdi
callq 0x143d2
leaq 0xf(%rsp), %rdi
movq %rax, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x554b5
movl %eax, %r12d
testl %eax, %eax
jne 0x9f693
cmpb $0x1, 0xf(%rsp)
jne 0x9f693
incq %rbx
cmpq $0x1, %rbx
ja 0x9f6b3
movq 0x20(%rsp), %rax
movq %rbp, (%rax)
movq 0x18(%rsp), %rax
movq %r13, (%rax)
movq %rbp, 0x48(%rsp)
movq %r13, 0x50(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %r15
movq 0x10(%rsp), %rdi
callq 0x143d2
movq %r15, %rdi
movq 0x28(%rsp), %r15
movq %rax, %rsi
leaq 0x48(%rsp), %rdx
callq 0xc005d
incq %r13
jmp 0x9f5f5
xorl %r12d, %r12d
incq %rbp
cmpb $0x1, 0xf(%rsp)
movq 0x30(%rsp), %r13
jne 0x9f5d4
jmp 0x9f6da
movq 0x10(%rsp), %rdi
callq 0x143d2
movq %r15, %rdi
leaq 0x4b7d3(%rip), %rsi     # 0xeae9a
movq %rax, %rdx
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %r12
jmp 0x9f69e
xorl %r12d, %r12d
movq 0x38(%rsp), %rdi
callq 0x152db
movq 0x40(%rsp), %rdi
callq 0x152db
testl %r12d, %r12d
jne 0x9f71a
testq %rbx, %rbx
jne 0x9f71a
movq 0x10(%rsp), %rdi
callq 0x143d2
leaq 0x4b7e3(%rip), %rsi     # 0xeaeec
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %r12
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8e885(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2a929(%rip), %rsi     # 0xca066
leaq 0x4b734(%rip), %rdx     # 0xeae78
leaq 0x53826(%rip), %rcx     # 0xf2f71
leaq 0x4b5b1(%rip), %r8      # 0xead03
pushq $0x42
jmp 0x9f77e
movq 0x8e85b(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x2a8ff(%rip), %rsi     # 0xca066
leaq 0x2aeeb(%rip), %rdx     # 0xca659
leaq 0x537fc(%rip), %rcx     # 0xf2f71
leaq 0x4b587(%rip), %r8      # 0xead03
pushq $0x41
popq %r9
xorl %eax, %eax
callq 0xb8c0
callq 0xb300