// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_extend_seeds_window
static int ces_c_extend_seeds_window(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 - ces_c->windowsize + 1;
  const unsigned int max_win_idx = ces_c->windowsize - 1;
  unsigned int idx_win;
  GtXdropbest empty = {0,0,0,0,0};
  const bool forward = true;
  subject_bounds.end =
    subject_bounds.start = 0;

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

  match_positions = win->pos_arrs[GT_CONDENSEQ_CREATOR_WINDOWIDX(win, 0)];

  /* nothing there or window not full */
  if (match_positions.no_positions == 0 ||
      ces_c->window.count != ces_c->windowsize)
    return had_err;

  /* get bounds for current, .end is exclusive */
  query_bounds.start = ces_c->current_orig_start;
  query_bounds.end = ces_c->current_seq_start + ces_c->current_seq_len;
  gt_assert(query_bounds.start <= querypos);
  if (!(querypos <= query_bounds.end - ces_c->windowsize)) {
    gt_error_set(err, "querypos: " GT_WU ", not smaller end (" GT_WU
                 ") - windowsize (%u) (xdrop calls: " GT_WU " )",
                 querypos,
                 query_bounds.end,
                 ces_c->windowsize,
                 ces_c_xdrops);
    had_err = -1;
  }

  if (!had_err) {
    for (idx_win = 0; idx_win <= max_win_idx; idx_win++) {
      win->idxs[idx_win] = 0;
    }

    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);
    }
  }

  /* iterate over all known match_positions of left kmer */
  for (idx_cur = 0;
       !had_err && idx_cur < match_positions.no_positions;
       idx_cur++)
  {
    bool found = false;
    GtUword subjectpos = match_positions.startpos[idx_cur],
            new_uid = match_positions.unique_ids[idx_cur];
    /* end == subjectpos should not be possible as this would be a separator */
    if (subject_bounds.end <= subjectpos || subject_bounds.end == 0) {
      gt_assert(new_uid != ces_c->ces->uds_nelems);
      subject_bounds.start = ces_c->ces->uniques[new_uid].orig_startpos;
      subject_bounds.end = subject_bounds.start +
        ces_c->ces->uniques[new_uid].len;
      gt_assert(subject_bounds.start <= subjectpos &&
                subjectpos + ces_c->kmersize <= subject_bounds.end);
    }
    /* check if new position is already covered by current best alignment */
    if (best_match == GT_UNDEF_UWORD ||
        /* ivalue is a length (within unique) -> best + ivalue is outside of
           best alignment */
        subjectpos >= best_match + xdrop->right->ivalue) {
      /* start with search for right hit at end of window */
      for (idx_win = ces_c->windowsize - 1;
           !had_err && !found && idx_win >= ces_c->kmersize;
           idx_win--) {
        GtKmerStartpos j_primes;
        j_primes.startpos =
          win->pos_arrs[GT_CONDENSEQ_CREATOR_WINDOWIDX(win, idx_win)].startpos;
        j_primes.no_positions =
          win->pos_arrs[GT_CONDENSEQ_CREATOR_WINDOWIDX(win,
                                                       idx_win)].no_positions;
        /* If 0, there are no known match_positions for kmer at this window
           position. */
        if (j_primes.no_positions != 0) {
          GtUword j_prime_idx = win->idxs[idx_win],
                  j_prime = j_primes.startpos[j_prime_idx];
          /* advance to at least the window */
          while (j_prime_idx < j_primes.no_positions &&
                 subjectpos + ces_c->kmersize - 1 > j_prime) {
            j_prime_idx++;
            j_prime = j_primes.startpos[j_prime_idx];
          }
          /* hit within window? */
          if (j_prime_idx < j_primes.no_positions &&
              subjectpos + ces_c->windowsize > j_prime) {
            found = true;
            had_err = ces_c_xdrop(ces_c,
                                  subjectpos, querypos,
                                  query_bounds,
                                  subject_bounds,
                                  new_uid,
                                  best_link,
                                  &best_match,
                                  err);
          }
          /* within each position array, remember last highest position, start
             there, because subjectpos increases each iteration */
          win->idxs[idx_win] = j_prime_idx;
        }
      }
    }
  }

  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 %r14
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x148(%rsp)
movq %rsi, 0x140(%rsp)
movq %rdx, 0x138(%rsp)
movl $0x0, 0x134(%rsp)
movq 0x148(%rsp), %rax
addq $0xb0, %rax
movq %rax, 0xf0(%rsp)
movq 0x148(%rsp), %rax
addq $0x58, %rax
movq %rax, 0xe8(%rsp)
movq $-0x1, 0xe0(%rsp)
movq 0x148(%rsp), %rax
movq 0xf0(%rax), %rax
movq 0x148(%rsp), %rcx
movl 0x13c(%rcx), %ecx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, 0xd0(%rsp)
movq 0x148(%rsp), %rax
movl 0x13c(%rax), %eax
subl $0x1, %eax
movl %eax, 0xcc(%rsp)
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x19360
movb $0x1, 0x9f(%rsp)
movq $0x0, 0x110(%rsp)
movq $0x0, 0x118(%rsp)
movq 0xe8(%rsp), %rax
movq 0x40(%rax), %rdi
leaq 0xa0(%rsp), %rsi
movl $0x28, %edx
callq 0x19610
movq 0xe8(%rsp), %rax
movq 0x48(%rax), %rdi
leaq 0xa0(%rsp), %rsi
movl $0x28, %edx
callq 0x19610
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl $0x0, %eax
movq 0xf0(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jae 0x144446
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl $0x0, %eax
movl %eax, 0x54(%rsp)
jmp 0x144463
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl $0x0, %eax
movq 0xf0(%rsp), %rcx
subl 0x14(%rcx), %eax
movl %eax, 0x54(%rsp)
movq 0x58(%rsp), %rax
movl 0x54(%rsp), %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, 0xf8(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x100(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x108(%rsp)
cmpq $0x0, 0x108(%rsp)
je 0x1444c1
movq 0x148(%rsp), %rax
movl 0xc4(%rax), %eax
movq 0x148(%rsp), %rcx
cmpl 0x13c(%rcx), %eax
je 0x1444d4
movl 0x134(%rsp), %eax
movl %eax, 0x154(%rsp)
jmp 0x144cd1
movq 0x148(%rsp), %rax
movq 0xc8(%rax), %rax
movq %rax, 0x120(%rsp)
movq 0x148(%rsp), %rax
movq 0xe0(%rax), %rax
movq 0x148(%rsp), %rcx
addq 0xd0(%rcx), %rax
movq %rax, 0x128(%rsp)
movq 0x120(%rsp), %rax
cmpq 0xd0(%rsp), %rax
jbe 0x14455b
movq 0x4f7a76(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d1adf(%rip), %rsi    # 0x516013
leaq 0x407d8f(%rip), %rdx    # 0x54c2ca
leaq 0x407da7(%rip), %rcx    # 0x54c2e9
leaq 0x4074a5(%rip), %r8     # 0x54b9ee
movl $0x25e, %r9d            # imm = 0x25E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x14455d
movq 0xd0(%rsp), %rax
movq 0x128(%rsp), %rcx
movq 0x148(%rsp), %rdx
movl 0x13c(%rdx), %edx
subq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x1445ca
movq 0x138(%rsp), %rdi
movq 0xd0(%rsp), %rdx
movq 0x128(%rsp), %rcx
movq 0x148(%rsp), %rax
movl 0x13c(%rax), %r8d
movq 0x4fe797(%rip), %r9     # 0x642d48
leaq 0x407d4b(%rip), %rsi    # 0x54c303
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x134(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x134(%rsp)
jne 0x1446ba
movl $0x0, 0xc8(%rsp)
movl 0xc8(%rsp), %eax
cmpl 0xcc(%rsp), %eax
ja 0x144621
movq 0xf0(%rsp), %rax
movq 0x8(%rax), %rax
movl 0xc8(%rsp), %ecx
movq $0x0, (%rax,%rcx,8)
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x1445e3
movq 0x120(%rsp), %rax
cmpq 0xd0(%rsp), %rax
jae 0x14466b
movq 0xe8(%rsp), %rax
movq 0x28(%rax), %rdx
movq 0x148(%rsp), %rax
movq (%rax), %rcx
movq 0xd0(%rsp), %r8
subq 0x120(%rsp), %r8
movq 0x120(%rsp), %r9
xorl %esi, %esi
movl %esi, %edi
callq 0x2b0bc0
movq 0xd0(%rsp), %rax
cmpq 0x128(%rsp), %rax
jae 0x1446b8
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x148(%rsp), %rax
movq (%rax), %rcx
movq 0x128(%rsp), %r8
subq 0xd0(%rsp), %r8
movq 0xd0(%rsp), %r9
movl $0x1, %edi
xorl %esi, %esi
callq 0x2b0bc0
jmp 0x1446ba
movq $0x0, 0xd8(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x134(%rsp)
movb %al, 0x53(%rsp)
jne 0x1446ed
movq 0xd8(%rsp), %rax
cmpq 0x108(%rsp), %rax
setb %al
movb %al, 0x53(%rsp)
movb 0x53(%rsp), %al
testb $0x1, %al
jne 0x1446fa
jmp 0x144bcf
movb $0x0, 0x9e(%rsp)
movq 0xf8(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x90(%rsp)
movq 0x100(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x88(%rsp)
movq 0x118(%rsp), %rax
cmpq 0x90(%rsp), %rax
jbe 0x14475b
cmpq $0x0, 0x118(%rsp)
jne 0x14487f
jmp 0x14475d
movq 0x88(%rsp), %rax
movq 0x148(%rsp), %rcx
movq 0x28(%rcx), %rcx
cmpq 0x98(%rcx), %rax
jne 0x1447b2
movq 0x4f781f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d1888(%rip), %rsi    # 0x516013
leaq 0x407bbc(%rip), %rdx    # 0x54c34e
leaq 0x407b50(%rip), %rcx    # 0x54c2e9
leaq 0x40724e(%rip), %r8     # 0x54b9ee
movl $0x28a, %r9d            # imm = 0x28A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1447b4
movq 0x148(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rax
imulq $0x28, 0x88(%rsp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, 0x110(%rsp)
movq 0x110(%rsp), %rax
movq 0x148(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, 0x88(%rsp), %rdx
addq %rdx, %rcx
movl 0x20(%rcx), %ecx
addq %rcx, %rax
movq %rax, 0x118(%rsp)
movq 0x110(%rsp), %rax
cmpq 0x90(%rsp), %rax
ja 0x144843
movq 0x90(%rsp), %rax
movq 0x148(%rsp), %rcx
movl 0x138(%rcx), %ecx
addq %rcx, %rax
cmpq 0x118(%rsp), %rax
jbe 0x14487b
movq 0x4f7756(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d17bf(%rip), %rsi    # 0x516013
leaq 0x40768d(%rip), %rdx    # 0x54bee8
leaq 0x407a87(%rip), %rcx    # 0x54c2e9
leaq 0x407185(%rip), %r8     # 0x54b9ee
movl $0x28f, %r9d            # imm = 0x28F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x14487d
jmp 0x14487f
cmpq $-0x1, 0xe0(%rsp)
je 0x1448b2
movq 0x90(%rsp), %rax
movq 0xe0(%rsp), %rcx
movq 0xe8(%rsp), %rdx
movq 0x48(%rdx), %rdx
addq (%rdx), %rcx
cmpq %rcx, %rax
jb 0x144bb4
movq 0x148(%rsp), %rax
movl 0x13c(%rax), %eax
subl $0x1, %eax
movl %eax, 0xc8(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x134(%rsp)
movb %al, 0x52(%rsp)
jne 0x144906
xorl %eax, %eax
testb $0x1, 0x9e(%rsp)
movb %al, 0x52(%rsp)
jne 0x144906
movl 0xc8(%rsp), %eax
movq 0x148(%rsp), %rcx
cmpl 0x138(%rcx), %eax
setae %al
movb %al, 0x52(%rsp)
movb 0x52(%rsp), %al
testb $0x1, %al
jne 0x144913
jmp 0x144bb2
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movq 0xf0(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jae 0x14495a
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x14497b
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movq 0xf0(%rsp), %rcx
subl 0x14(%rcx), %eax
movl %eax, 0x44(%rsp)
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movq 0xf0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movq 0xf0(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jae 0x1449dc
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x1449fd
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %eax
addl 0xc8(%rsp), %eax
movq 0xf0(%rsp), %rcx
subl 0x14(%rcx), %eax
movl %eax, 0x34(%rsp)
movq 0x38(%rsp), %rax
movl 0x34(%rsp), %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x144b9a
movq 0xf0(%rsp), %rax
movq 0x8(%rax), %rax
movl 0xc8(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rcx
xorl %eax, %eax
cmpq 0x80(%rsp), %rcx
movb %al, 0x33(%rsp)
jae 0x144a97
movq 0x90(%rsp), %rax
movq 0x148(%rsp), %rcx
movl 0x138(%rcx), %ecx
addq %rcx, %rax
subq $0x1, %rax
cmpq 0x60(%rsp), %rax
seta %al
movb %al, 0x33(%rsp)
movb 0x33(%rsp), %al
testb $0x1, %al
jne 0x144aa1
jmp 0x144ac4
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x60(%rsp)
jmp 0x144a59
movq 0x68(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0x144b7e
movq 0x90(%rsp), %rax
movq 0x148(%rsp), %rcx
movl 0x13c(%rcx), %ecx
addq %rcx, %rax
cmpq 0x60(%rsp), %rax
jbe 0x144b7e
movb $0x1, 0x9e(%rsp)
movq 0x148(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xd0(%rsp), %rdx
movq 0x88(%rsp), %r9
movq 0x140(%rsp), %r11
movq 0x138(%rsp), %rax
movq 0x120(%rsp), %rcx
movq 0x128(%rsp), %r8
leaq 0x110(%rsp), %rbx
leaq 0xe0(%rsp), %r10
movq (%rbx), %r14
movq %r14, (%rsp)
movq 0x8(%rbx), %rbx
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x1467f0
movl %eax, 0x134(%rsp)
movq 0x68(%rsp), %rdx
movq 0xf0(%rsp), %rax
movq 0x8(%rax), %rax
movl 0xc8(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x144b9c
movl 0xc8(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x1448ca
jmp 0x144bb4
jmp 0x144bb6
movq 0xd8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xd8(%rsp)
jmp 0x1446c6
cmpl $0x0, 0x134(%rsp)
jne 0x144cc3
movq 0x140(%rsp), %rax
movl 0x10(%rax), %eax
movq 0x148(%rsp), %rcx
cmpq 0x100(%rcx), %rax
jae 0x144c0d
movq 0x140(%rsp), %rax
movl $0x0, 0x10(%rax)
jmp 0x144cc1
jmp 0x144c0f
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rax
cmpq 0x120(%rsp), %rax
jae 0x144c5d
movq 0x4f7374(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d13dd(%rip), %rsi    # 0x516013
leaq 0x407353(%rip), %rdx    # 0x54bf90
leaq 0x4076a5(%rip), %rcx    # 0x54c2e9
leaq 0x406da3(%rip), %r8     # 0x54b9ee
movl $0x2c4, %r9d            # imm = 0x2C4
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x144c5f
jmp 0x144c61
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x140(%rsp), %rcx
movl 0x10(%rcx), %ecx
addq %rcx, %rax
cmpq 0x128(%rsp), %rax
jbe 0x144cbd
movq 0x4f7314(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3d137d(%rip), %rsi    # 0x516013
leaq 0x407322(%rip), %rdx    # 0x54bfbf
leaq 0x407645(%rip), %rcx    # 0x54c2e9
leaq 0x406d43(%rip), %r8     # 0x54b9ee
movl $0x2c5, %r9d            # imm = 0x2C5
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x144cbf
jmp 0x144cc1
jmp 0x144cc3
movl 0x134(%rsp), %eax
movl %eax, 0x154(%rsp)
movl 0x154(%rsp), %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
retq
nopw %cs:(%rax,%rax)