// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/diagonalbandalign.c
// Function: gt_calc_diagonalbandalign
static void gt_calc_diagonalbandalign(GtLinspaceManagement *spacemanager,
                                      const GtScoreHandler *scorehandler,
                                      GtAlignment *align,
                                      const GtUchar *useq,
                                      GtUword ustart, GtUword ulen,
                                      const GtUchar *vseq,
                                      GtUword vstart, GtUword vlen,
                                      GtWord left_dist,
                                      GtWord right_dist)
{
  GtDiagAlignentry *Diagcolumn;
  GtUword idx, gapcost, *EDtabcolumn, *Rtabcolumn;

  gt_assert(align && spacemanager && scorehandler);

  if ((left_dist > GT_MIN(0, (GtWord)vlen-(GtWord)ulen))||
      (right_dist < GT_MAX(0, (GtWord)vlen-(GtWord)ulen)))
  {
    gt_assert(false); /* no global alignment */
  }

  gt_linspace_management_set_ulen(spacemanager,ulen);
  gapcost = gt_scorehandler_get_gapscore(scorehandler);
  if (ulen == 0UL)
  {
    (void) gt_reconstructalignment_trivial_insertion(align, vlen, gapcost);
    return;
  }
  else if (vlen == 0UL)
  {
    (void) gt_reconstructalignment_trivial_deletion(align, ulen, gapcost);
    return;
  }
  else if (gt_linspace_management_checksquare(spacemanager, ulen, vlen,
                                              sizeof (*EDtabcolumn),
                                              sizeof (*Rtabcolumn)))
  {
    (void) gt_diagonalbandalignment_in_square_space_generic(spacemanager,align,
                                                            useq, ustart, ulen,
                                                            vseq, vstart, vlen,
                                                            left_dist,
                                                            right_dist,
                                                            scorehandler);
    return;
  }

  gt_linspace_management_check(spacemanager, GT_MIN(right_dist-left_dist,ulen),
                               vlen,
                               sizeof (*EDtabcolumn),
                               sizeof (*Rtabcolumn),
                               sizeof (*Diagcolumn));

  Diagcolumn = gt_linspace_management_get_crosspointTabspace(spacemanager);
  /* initialize Diagcolumn */
  for (idx = 0; idx <= vlen; idx++)
  {
    Diagcolumn[idx].lastcpoint = GT_UWORD_MAX;
    Diagcolumn[idx].currentrowindex = GT_UWORD_MAX;
  }

  evaluateDBcrosspoints(spacemanager, Diagcolumn, scorehandler,
                        Linear_X, 0, 0,  useq, ustart, ulen,
                        vseq, vstart, vlen, left_dist, right_dist);

  gt_reconstructalignment_from_Dtab(align, Diagcolumn, ulen, vlen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0xc9966
movq %rdi, %r12
testq %rdi, %rdi
je 0xc9966
movq %rdx, %r14
testq %rdx, %rdx
je 0xc9966
movq %r9, %rbx
movq %rsi, %rbp
movq %r8, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %r15
movq %r15, %rcx
subq %r9, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
movq %rsi, (%rsp)
cmpq %rsi, %rdx
jl 0xc9994
movq 0x80(%rsp), %r13
cmpq %r13, %rax
jg 0xc9994
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xf9932
movq %rbp, %rdi
callq 0x114a6a
testq %rbx, %rbx
je 0xc9891
testq %r15, %r15
je 0xc98ad
pushq $0x8
popq %rcx
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rcx, %r8
callq 0xf9879
testb %al, %al
je 0xc98c9
subq $0x8, %rsp
movq %r12, %rdi
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %rbx, %r8
movq 0x10(%rsp), %r9
pushq %rbp
pushq %r13
pushq 0x18(%rsp)
pushq %r15
pushq 0x38(%rsp)
callq 0xc9194
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10ecf3
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10ecbc
movq %r13, %rsi
subq (%rsp), %rsi
cmpq %rbx, %rsi
cmovaeq %rbx, %rsi
pushq $0x8
popq %rcx
pushq $0x18
popq %r9
movq %r12, %rdi
movq %r15, %rdx
movq %rcx, %r8
callq 0xf9704
movq %r12, %rdi
callq 0xf998e
pushq $-0x1
popq %rdx
pcmpeqd %xmm0, %xmm0
movq %rax, %rcx
cmpq %rdx, %r15
je 0xc9910
movdqu %xmm0, (%rcx)
incq %rdx
addq $0x18, %rcx
jmp 0xc98fe
pushq $0x3
popq %rcx
movq %r12, %rdi
movq %rax, %r12
movq %rax, %rsi
movq %rbp, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r13
pushq 0x8(%rsp)
pushq %r15
pushq 0x28(%rsp)
pushq 0x28(%rsp)
pushq %rbx
pushq 0x48(%rsp)
pushq 0x58(%rsp)
callq 0xca0a7
addq $0x40, %rsp
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f2ac
movq 0x36e5fb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21b69c(%rip), %rsi    # 0x2e5013
leaq 0x25161e(%rip), %rdx    # 0x31af9c
leaq 0x2517cd(%rip), %rcx    # 0x31b152
leaq 0x2515df(%rip), %r8     # 0x31af6b
movl $0x367, %r9d            # imm = 0x367
jmp 0xc99c0
movq 0x36e5cd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21b66e(%rip), %rsi    # 0x2e5013
leaq 0x25d040(%rip), %rdx    # 0x3269ec
leaq 0x25179f(%rip), %rcx    # 0x31b152
leaq 0x2515b1(%rip), %r8     # 0x31af6b
movl $0x36c, %r9d            # imm = 0x36C
xorl %eax, %eax
callq 0x17a50
callq 0x17390