// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq_col.c
// Function: gt_encseq_col_do_grep_desc
static int gt_encseq_col_do_grep_desc(GtEncseqCol *esc, GtUword *filenum,
                                      GtUword *seqnum, GtStr *seqid,
                                      GtError *err)
{
  GtUword 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(esc && filenum && seqnum && seqid);
  gt_assert(esc->encseq && gt_encseq_has_description_support(esc->encseq));

  /* create cache */
  if (!esc->grep_cache)
    esc->grep_cache = gt_seq_info_cache_new();
  /* try to read from cache */
  seq_info_ptr = gt_seq_info_cache_get(esc->grep_cache, gt_str_get(seqid));
  if (seq_info_ptr) {
    if (esc->duplicates && gt_hashmap_get(esc->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 (esc->matchstart)
    gt_str_append_cstr(pattern, "^");
  gt_str_append_str(pattern, escaped);
  if (esc->matchstart)
    gt_str_append_cstr(pattern, "([[:space:]]|$)");
  for (j = 0; !had_err && j < gt_encseq_num_of_sequences(esc->encseq); j++) {
    const char *desc;
    GtUword desc_len;
    desc = gt_encseq_description(esc->encseq, &desc_len, j);
    gt_assert(desc);
    had_err = gt_grep_nt(&match, gt_str_get(pattern), desc, desc_len, 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 = seq_info.filenum =
                       gt_encseq_filenum(esc->encseq,
                                         gt_encseq_seqstartpos(esc->encseq, j));
      *seqnum = seq_info.seqnum =
                      j - gt_encseq_filenum_first_seqnum(esc->encseq, *filenum);
      gt_seq_info_cache_add(esc->grep_cache, gt_str_get(seqid), &seq_info);
    }
  }
  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:
subq $0xe8, %rsp
movq %rdi, 0xd8(%rsp)
movq %rsi, 0xd0(%rsp)
movq %rdx, 0xc8(%rsp)
movq %rcx, 0xc0(%rsp)
movq %r8, 0xb8(%rsp)
movq $0x0, 0xa8(%rsp)
movb $0x0, 0x7f(%rsp)
movl $0x0, 0x78(%rsp)
cmpq $0x0, 0xb8(%rsp)
je 0x140b4e
movq 0xb8(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x140b16
jmp 0x140b4e
movq 0x734bb(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1d53f(%rip), %rsi     # 0x15e066
leaq 0x1db1a(%rip), %rdx     # 0x15e648
leaq 0x4a443(%rip), %rcx     # 0x18af78
leaq 0x4a372(%rip), %r8      # 0x18aeae
movl $0x41, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x140b50
jmp 0x140b52
cmpq $0x0, 0xd8(%rsp)
je 0x140b7e
cmpq $0x0, 0xd0(%rsp)
je 0x140b7e
cmpq $0x0, 0xc8(%rsp)
je 0x140b7e
cmpq $0x0, 0xc0(%rsp)
jne 0x140bb6
movq 0x73453(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1d4d7(%rip), %rsi     # 0x15e066
leaq 0x4a3fd(%rip), %rdx     # 0x18af93
leaq 0x4a3db(%rip), %rcx     # 0x18af78
leaq 0x4a30a(%rip), %r8      # 0x18aeae
movl $0x43, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x140bb8
jmp 0x140bba
movq 0xd8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x140bde
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x11c6b0
testb $0x1, %al
jne 0x140c16
movq 0x733f3(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1d477(%rip), %rsi     # 0x15e066
leaq 0x4a3bf(%rip), %rdx     # 0x18afb5
leaq 0x4a37b(%rip), %rcx     # 0x18af78
leaq 0x4a2aa(%rip), %r8      # 0x18aeae
movl $0x44, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x140c18
movq 0xd8(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x140c3b
callq 0x14ad00
movq %rax, %rcx
movq 0xd8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0xd8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x14ad80
movq %rax, 0xa0(%rsp)
cmpq $0x0, 0xa0(%rsp)
je 0x140d3a
movq 0xd8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x140cfd
movq 0xd8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x86470
cmpq $0x0, %rax
je 0x140cfd
movq 0xb8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x50(%rsp), %rdi
movq %rax, %rdx
leaq 0x43bb4(%rip), %rsi     # 0x18489a
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0xe4(%rsp) # imm = 0xFFFFFFFF
jmp 0x141096
movq 0xa0(%rsp), %rax
movq (%rax), %rcx
movq 0xd0(%rsp), %rax
movq %rcx, (%rax)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0xc8(%rsp), %rax
movq %rcx, (%rax)
movl $0x0, 0xe4(%rsp)
jmp 0x141096
callq 0x18f00
movq %rax, 0x88(%rsp)
callq 0x18f00
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq %rax, 0x48(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19a00
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rax, %rdx
callq 0x851e0
movq 0xd8(%rsp), %rax
testb $0x1, 0x28(%rax)
je 0x140db4
movq 0x88(%rsp), %rdi
leaq 0x43b2b(%rip), %rsi     # 0x1848da
callq 0x18fb0
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x191b0
movq 0xd8(%rsp), %rax
testb $0x1, 0x28(%rax)
je 0x140deb
movq 0x88(%rsp), %rdi
leaq 0x43af6(%rip), %rsi     # 0x1848dc
callq 0x18fb0
movq $0x0, 0xb0(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x78(%rsp)
movb %al, 0x3f(%rsp)
jne 0x140e34
movq 0xb0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x113f30
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
setb %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x140e41
jmp 0x141027
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0xb0(%rsp), %rdx
leaq 0x68(%rsp), %rsi
callq 0x11bd20
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
jne 0x140ea4
movq 0x73165(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1d1e9(%rip), %rsi     # 0x15e066
leaq 0x380f2(%rip), %rdx     # 0x178f76
leaq 0x4a0ed(%rip), %rcx     # 0x18af78
leaq 0x4a01c(%rip), %r8      # 0x18aeae
movl $0x61, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x140ea6
movq 0x88(%rsp), %rdi
callq 0x19940
movq %rax, %rsi
movq 0x70(%rsp), %rdx
movq 0x68(%rsp), %rcx
movq 0xb8(%rsp), %r8
leaq 0x7f(%rsp), %rdi
callq 0x852d0
movl %eax, 0x78(%rsp)
cmpl $0x0, 0x78(%rsp)
jne 0x14100c
testb $0x1, 0x7f(%rsp)
je 0x14100c
movq 0xa8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa8(%rsp)
cmpq $0x1, 0xa8(%rsp)
jbe 0x140f48
movq 0xb8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x28(%rsp), %rdi
movq %rax, %rdx
leaq 0x43966(%rip), %rsi     # 0x18489a
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x78(%rsp) # imm = 0xFFFFFFFF
jmp 0x141027
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0xb0(%rsp), %rsi
callq 0x11a710
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x12ccd0
movq %rax, %rcx
movq %rcx, 0x90(%rsp)
movq 0xd0(%rsp), %rax
movq %rcx, (%rax)
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0xd0(%rsp), %rax
movq (%rax), %rsi
callq 0x12cea0
movq 0x18(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x98(%rsp)
movq 0xc8(%rsp), %rax
movq %rcx, (%rax)
movq 0xd8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x20(%rsp), %rdi
movq %rax, %rsi
leaq 0x90(%rsp), %rdx
callq 0x14adf0
jmp 0x14100e
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb0(%rsp)
jmp 0x140df7
movq 0x88(%rsp), %rdi
callq 0x1afc0
movq 0x80(%rsp), %rdi
callq 0x1afc0
cmpl $0x0, 0x78(%rsp)
jne 0x14108b
cmpq $0x0, 0xa8(%rsp)
jne 0x14108b
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x19940
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x43870(%rip), %rsi     # 0x1848ec
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x78(%rsp) # imm = 0xFFFFFFFF
movl 0x78(%rsp), %eax
movl %eax, 0xe4(%rsp)
movl 0xe4(%rsp), %eax
addq $0xe8, %rsp
retq
nopw %cs:(%rax,%rax)
nop