// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_xdrop
static int ces_c_xdrop(GtCondenseqCreator *ces_c,
                       GtUword i,
                       GtUword j,
                       GtRange query_bounds,
                       GtRange subject_bounds,
                       GtUword unique_id,
                       GtCondenseqLink *best_link,
                       GtUword *best_match,
                       GtError *err)
{
  int had_err = 0;
  GtXdropbest left_xdrop = {0,0,0,0,0}, right_xdrop = {0,0,0,0,0};
  GtCondenseqCreatorXdrop *xdrop = &ces_c->xdrop;
  const bool forward = true;

  gt_assert(subject_bounds.start <= i);
  gt_assert(i + ces_c->kmersize - 1 < subject_bounds.end);

  /* left xdrop */
  if (query_bounds.start < j && subject_bounds.start < i) {
    gt_seqabstract_reinit_encseq(!forward,
                                 GT_READMODE_FORWARD,
                                 xdrop->unique_seq_bwd,
                                 ces_c->input_es,
                                 i - subject_bounds.start,
                                 subject_bounds.start);
    ces_c_xdrops++;
    gt_evalxdroparbitscoresextend(!forward,
                                  &left_xdrop,
                                  xdrop->left_xdrop_res,
                                  xdrop->unique_seq_bwd,
                                  xdrop->current_seq_bwd,
                                  xdrop->xdropscore);
  }
  /* right xdrop (i < subject_bounds.end by assertion) */
  if (j < query_bounds.end) {
    gt_seqabstract_reinit_encseq(forward,
                                 GT_READMODE_FORWARD,
                                 xdrop->unique_seq_fwd,
                                 ces_c->input_es,
                                 subject_bounds.end - i,
                                 i);
    ces_c_xdrops++;
    gt_evalxdroparbitscoresextend(forward,
                                  &right_xdrop,
                                  xdrop->right_xdrop_res,
                                  xdrop->unique_seq_fwd,
                                  xdrop->current_seq_fwd,
                                  xdrop->xdropscore);
  }

  /* ivalue corresponds to length of alignment in unique_seq (match) and jvalue
     to length of alignment in current_seq (seed) */
  if (left_xdrop.jvalue + right_xdrop.jvalue >= ces_c->min_align_len &&
      left_xdrop.score + right_xdrop.score >
        xdrop->left->score + xdrop->right->score) {
    GtXdropresources *swap = NULL;

    *xdrop->left = left_xdrop;
    *xdrop->right = right_xdrop;

    swap = xdrop->best_left_res;
    xdrop->best_left_res = xdrop->left_xdrop_res;
    xdrop->left_xdrop_res = swap;

    swap = xdrop->best_right_res;
    xdrop->best_right_res = xdrop->right_xdrop_res;
    xdrop->right_xdrop_res = swap;

    GT_CES_LENCHECK((i - left_xdrop.ivalue) - subject_bounds.start);
    if (!had_err) {
      /* left started att i-1 */
      best_link->unique_offset = (i - left_xdrop.ivalue) - subject_bounds.start;
      GT_CES_LENCHECK(xdrop->left->jvalue + xdrop->right->jvalue);
    }
    if (!had_err) {
      best_link->len = xdrop->left->jvalue + xdrop->right->jvalue;
      GT_CES_LENCHECK(unique_id);
    }
    if (!had_err) {
      best_link->unique_id = unique_id;
      best_link->orig_startpos = j;
      /* left started at j-1, so j-length is the first char on the left */
      best_link->orig_startpos -= left_xdrop.jvalue;
      *best_match = i;
    }
  }
  gt_xdrop_resources_reset(xdrop->left_xdrop_res);
  gt_xdrop_resources_reset(xdrop->right_xdrop_res);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movaps %xmm0, (%rsp)
andq $0x0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq 0x90(%rsp), %rbp
cmpq %rbp, %rsi
jb 0xc69b7
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x90(%rsp), %rax
movl 0x138(%rdi), %edx
addq %rsi, %rdx
decq %rdx
movq 0x8(%rax), %r13
cmpq %r13, %rdx
jae 0xc69e5
movq %r8, %r14
cmpq %r12, %rcx
setae %al
movq %r15, %r8
subq %rbp, %r8
setbe %cl
orb %al, %cl
jne 0xc682a
movq (%rbx), %rcx
movq 0x90(%rbx), %rdx
xorl %edi, %edi
xorl %esi, %esi
movq %rbp, %r9
callq 0x191910
incq 0x376e91(%rip)          # 0x43d698
movq 0x90(%rbx), %rcx
movq 0x58(%rbx), %rdx
movq 0x80(%rbx), %r8
movq 0xa8(%rbx), %r9
movq %rsp, %rsi
xorl %edi, %edi
callq 0x1b76b0
cmpq %r14, %r12
jae 0xc6883
movq (%rbx), %rcx
movq 0x88(%rbx), %rdx
subq %r15, %r13
pushq $0x1
popq %r14
movl %r14d, %edi
xorl %esi, %esi
movq %r13, %r8
movq %r15, %r9
callq 0x191910
incq 0x376e41(%rip)          # 0x43d698
movq 0x88(%rbx), %rcx
movq 0x60(%rbx), %rdx
movq 0x78(%rbx), %r8
movq 0xa8(%rbx), %r9
leaq 0x30(%rsp), %r13
movl %r14d, %edi
movq %r13, %rsi
callq 0x1b76b0
movq 0x8(%r13), %rax
jmp 0xc6885
xorl %eax, %eax
addq 0x8(%rsp), %rax
cmpq 0x100(%rbx), %rax
jb 0xc6990
movq 0x40(%rsp), %rcx
addq 0x10(%rsp), %rcx
movq 0x98(%rbx), %rax
movq 0xa0(%rbx), %rdx
movq 0x10(%rdx), %rdx
addq 0x10(%rax), %rdx
cmpq %rdx, %rcx
jle 0xc6990
movq 0xb0(%rsp), %rdi
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rax)
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq 0xa0(%rbx), %rax
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movq 0x50(%rsp), %rcx
movq %rcx, 0x20(%rax)
movups %xmm0, (%rax)
movups 0x58(%rbx), %xmm0
movups 0x68(%rbx), %xmm1
movups %xmm0, 0x68(%rbx)
movups %xmm1, 0x58(%rbx)
addq (%rsp), %rbp
movq %r15, %rdx
subq %rbp, %rdx
movq %rdx, %rax
shrq $0x20, %rax
jne 0xc6960
movq 0xa0(%rsp), %rax
movl %edx, 0x18(%rax)
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rdx
movq 0x8(%rdx), %rdx
addq 0x8(%rcx), %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
jne 0xc6960
movl %edx, 0x10(%rax)
movq 0x28(%rsp), %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
je 0xc6979
leaq 0x253753(%rip), %rsi    # 0x31a0ba
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r14
jmp 0xc6993
movq 0xa8(%rsp), %rcx
movl %edx, 0x14(%rax)
subq 0x8(%rsp), %r12
movq %r12, 0x8(%rax)
movq %r15, (%rcx)
xorl %r14d, %r14d
movq 0x58(%rbx), %rdi
callq 0x1b7506
movq 0x60(%rbx), %rdi
callq 0x1b7506
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3715aa(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21e64b(%rip), %rsi    # 0x2e5013
leaq 0x253698(%rip), %rdx    # 0x31a067
leaq 0x2536ab(%rip), %rcx    # 0x31a081
leaq 0x252ff7(%rip), %r8     # 0x3199d4
movl $0x1d9, %r9d            # imm = 0x1D9
jmp 0xc6a11
movq 0x37157c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21e61d(%rip), %rsi    # 0x2e5013
leaq 0x253690(%rip), %rdx    # 0x31a08d
leaq 0x25367d(%rip), %rcx    # 0x31a081
leaq 0x252fc9(%rip), %r8     # 0x3199d4
movl $0x1da, %r9d            # imm = 0x1DA
xorl %eax, %eax
callq 0x17a50
callq 0x17390