// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_extend_seeds_brute_force
static int ces_c_extend_seeds_brute_force(GtCondenseqCreator *ces_c,
                                          GtCondenseqLink *best_link,
                                          GtError *err)
{
  int had_err = 0;
  GtRange query_bounds,
          subject_bounds;
  GtKmerStartpos match_positions;
  GtCondenseqCreatorWindow *win = &ces_c->window;
  GtCondenseqCreatorXdrop *xdrop = &ces_c->xdrop;
  GtUword best_match = GT_UNDEF_UWORD,
          idx_cur,
          querypos = ces_c->main_pos;
  const bool forward = true;
  GtXdropbest empty = {0,0,0,0,0};

  *xdrop->left = empty;
  *xdrop->right = empty;

  subject_bounds.end =
    subject_bounds.start = 0;

  match_positions = win->pos_arrs[GT_CONDENSEQ_CREATOR_LAST_WIN(win)];

  if (match_positions.no_positions == 0) /* nothing there */
    return had_err;

  /* get bounds for current */
  query_bounds.start = ces_c->current_orig_start;
  query_bounds.end = ces_c->current_seq_start + ces_c->current_seq_len;

  if (query_bounds.start < querypos) {
    gt_seqabstract_reinit_encseq(!forward,
                                 GT_READMODE_FORWARD,
                                 xdrop->current_seq_bwd,
                                 ces_c->input_es,
                                 querypos - query_bounds.start,
                                 query_bounds.start);
  }
  if (querypos < query_bounds.end) {
    gt_seqabstract_reinit_encseq(forward,
                                 GT_READMODE_FORWARD,
                                 xdrop->current_seq_fwd,
                                 ces_c->input_es,
                                 query_bounds.end - querypos,
                                 querypos);
  }

  for (idx_cur = 0;
       !had_err && idx_cur < match_positions.no_positions;
       ++idx_cur) {
    GtUword subjectpos = match_positions.startpos[idx_cur],
            new_id = match_positions.unique_ids[idx_cur];
    if (subject_bounds.end < subjectpos || subject_bounds.end == 0) {
      gt_assert(new_id != ces_c->ces->uds_nelems);
      subject_bounds.start = ces_c->ces->uniques[new_id].orig_startpos;
      subject_bounds.end = subject_bounds.start +
        ces_c->ces->uniques[new_id].len;
      gt_assert(subject_bounds.start <= subjectpos &&
                subjectpos + ces_c->kmersize <= subject_bounds.end);
    }
    had_err = ces_c_xdrop(ces_c,
                          subjectpos, querypos,
                          query_bounds,
                          subject_bounds,
                          new_id,
                          best_link,
                          &best_match,
                          err);
  }

  if (!had_err) {
    if (best_link->len < ces_c->min_align_len)
      best_link->len = 0;
    else {
      gt_assert(best_link->orig_startpos >= query_bounds.start);
      gt_assert(best_link->orig_startpos + best_link->len <= query_bounds.end);
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x28(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
movq 0x98(%rdi), %rcx
movq 0xf0(%rdi), %rax
movq %rax, (%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movups %xmm0, (%rcx)
movq 0xa0(%rdi), %rcx
movq %rax, 0x20(%rcx)
movups %xmm0, 0x10(%rcx)
movups %xmm0, (%rcx)
movq 0xb0(%rdi), %rcx
movl 0xc0(%rdi), %edx
testl %edx, %edx
jne 0x12ee9f
movl 0xc4(%r14), %edx
decl %edx
leaq (%rdx,%rdx,2), %rdx
movq 0x10(%rcx,%rdx,8), %r15
testq %r15, %r15
je 0x12f00f
movq (%rcx,%rdx,8), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rcx,%rdx,8), %rbp
movq 0xc8(%r14), %rcx
movq 0xd0(%r14), %rax
addq 0xe0(%r14), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %r8
movq %rcx, 0x8(%rsp)
subq %rcx, %r8
jbe 0x12ef01
movq (%r14), %rcx
movq 0x80(%r14), %rdx
xorl %edi, %edi
xorl %esi, %esi
movq 0x8(%rsp), %r9
callq 0x1e2956
movq 0x10(%rsp), %r8
subq (%rsp), %r8
jbe 0x12ef23
movq (%r14), %rcx
movq 0x78(%r14), %rdx
movl $0x1, %edi
xorl %esi, %esi
movq (%rsp), %r9
callq 0x1e2956
movl $0x1, %r13d
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
movq -0x8(%rax,%r13,8), %rsi
movq -0x8(%rbp,%r13,8), %rax
testq %r12, %r12
je 0x12ef47
cmpq %rsi, %r12
jae 0x12ef89
movq 0x28(%r14), %rcx
cmpq 0x98(%rcx), %rax
je 0x12f023
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rdx
movq 0x18(%rcx,%rdx,8), %rbx
cmpq %rsi, %rbx
ja 0x12f01e
movl 0x20(%rcx,%rdx,8), %r12d
addq %rbx, %r12
movl 0x138(%r14), %ecx
addq %rsi, %rcx
cmpq %r12, %rcx
ja 0x12f01e
subq $0x8, %rsp
movq %r14, %rdi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %rbx, %r9
pushq 0x30(%rsp)
leaq 0x40(%rsp), %r10
pushq %r10
pushq 0x30(%rsp)
pushq %rax
pushq %r12
callq 0x13041b
addq $0x30, %rsp
movl %eax, %ecx
testl %eax, %eax
jne 0x12efd3
leaq 0x1(%r13), %rax
cmpq %r15, %r13
movq %rax, %r13
jb 0x12ef2e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x12f00f
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
cmpq %rax, 0x100(%r14)
jbe 0x12eff8
movl $0x0, 0x10(%rcx)
xorl %eax, %eax
jmp 0x12f00f
movq 0x8(%rcx), %rcx
cmpq 0x8(%rsp), %rcx
jb 0x12f028
addq %rax, %rcx
xorl %eax, %eax
cmpq 0x10(%rsp), %rcx
ja 0x12f02d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3df27
callq 0x3df60
callq 0x3deee
callq 0x3deb5