// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/diagonalbandalign_affinegapcost.c
// Function: gt_calc_diagonalbandaffinealign
static void gt_calc_diagonalbandaffinealign(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)
{
  GtAffinealignDPentry *Atabcolumn;
  GtAffineAlignRtabentry *Rtabcolumn;
  GtAffineDiagAlignentry *Diagcolumn;
  GtAffineAlignRnode lastnode;
  GtUword idx, gap_extension;
  gt_assert(align && 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);
  gap_extension = gt_scorehandler_get_gapscore(scorehandler);

  if (ulen == 0UL)
  {
    (void) gt_reconstructalignment_trivial_insertion(align, vlen,
                                                     gap_extension);
    return;

  }
  else if (vlen == 0UL)
  {
    (void) gt_reconstructalignment_trivial_deletion(align, ulen,
                                                    gap_extension);
     return;
  }
  if (gt_linspace_management_checksquare(spacemanager, ulen, vlen,
                                         sizeof (*Atabcolumn),
                                         sizeof (*Rtabcolumn)))
  {
    (void) gt_diagonalbandalign_affinegapcost_in_square_space_generic(
                                                         spacemanager,
                                                         scorehandler, align,
                                                         useq, ustart, ulen,
                                                         vseq, vstart, vlen,
                                                         left_dist, right_dist);
    return;
  }
  gt_linspace_management_check(spacemanager, GT_MIN(right_dist-left_dist,ulen),
                               vlen, sizeof (*Atabcolumn), sizeof (*Rtabcolumn),
                               sizeof (*Diagcolumn));
  Diagcolumn = gt_linspace_management_get_crosspointTabspace(spacemanager);

  /* initialize Diagcolumn */
  for (idx = 0; idx <= vlen; idx++)
  {
    Diagcolumn[idx].val_R =
                      (GtDiagAlignentry) {GT_UWORD_MAX, GT_UWORD_MAX, Affine_X};
    Diagcolumn[idx].val_D =
                      (GtDiagAlignentry) {GT_UWORD_MAX, GT_UWORD_MAX, Affine_X};
    Diagcolumn[idx].val_I =
                      (GtDiagAlignentry) {GT_UWORD_MAX, GT_UWORD_MAX, Affine_X};
  }

  lastnode = evaluateaffineDBcrosspoints(spacemanager, Diagcolumn, scorehandler,
                                         Affine_X, Affine_X, Affine_X, 0, 0,
                                         useq, ustart, ulen, vseq, vstart, vlen,
                                         left_dist, right_dist);
  /* reconstruct alignment */
  gt_reconstructalignment_from_affineDtab(align, Diagcolumn, lastnode.edge,
                                          useq, ulen, vseq, vlen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, 0x60(%rsp)
testq %rsi, %rsi
je 0xcbad4
testq %rdx, %rdx
je 0xcbad4
movq %r9, %rbx
movq %r8, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0xc8(%rsp), %r14
movq 0xc0(%rsp), %rbp
movq %rbp, %rcx
subq %r9, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
cmpq %r14, %rdx
jl 0xcbb02
movq 0xd0(%rsp), %r15
cmpq %r15, %rax
jg 0xcbb02
movq %rsi, %r12
movq %rdi, %r13
movq 0xb8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %rbx, %rsi
callq 0xf9932
movq %r12, %rdi
callq 0x114a6a
testq %rbx, %rbx
je 0xcb9b0
testq %rbp, %rbp
je 0xcb9ce
pushq $0x30
popq %rcx
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %rcx, %r8
callq 0xf9879
testb %al, %al
je 0xcb9ec
movq %r13, %rdi
movq %r12, %rsi
movq 0x50(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x58(%rsp), %r8
movq %rbx, %r9
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcae80
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10ecf3
movq 0x50(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10ecbc
movq %r15, %rsi
subq %r14, %rsi
cmpq %rbx, %rsi
cmovaeq %rbx, %rsi
pushq $0x30
popq %rcx
pushq $0x48
popq %r9
movq %r13, %rdi
movq %rbp, %rdx
movq %rcx, %r8
callq 0xf9704
movq %r13, %rdi
callq 0xf998e
movq %rax, %r8
addq $0x40, %rax
pushq $-0x1
popq %rcx
pcmpeqd %xmm0, %xmm0
pushq $0x3
popq %rdx
movq 0x58(%rsp), %rsi
cmpq %rcx, %rbp
je 0xcba51
movdqu %xmm0, -0x40(%rax)
movl %edx, -0x30(%rax)
movdqu %xmm0, -0x28(%rax)
movl %edx, -0x18(%rax)
movdqu %xmm0, -0x10(%rax)
movl %edx, (%rax)
incq %rcx
addq $0x48, %rax
jmp 0xcba2c
movq %r15, 0x48(%rsp)
movq %r14, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x70(%rsp), %r15
movq %r15, 0x28(%rsp)
movq %rbx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x60(%rsp), %r14
movq %r14, 0x10(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%rsp)
pushq $0x3
popq %rcx
movq %r13, %rdi
movq %r8, %rsi
movq %r12, %rdx
movq %r8, %r12
movl %ecx, %r8d
movl %ecx, %r9d
callq 0xcc113
movq %rbp, (%rsp)
movq 0x50(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
movq %r15, %r9
callq 0x10f48e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36c48d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21952e(%rip), %rsi    # 0x2e5013
leaq 0x24f438(%rip), %rdx    # 0x31af24
leaq 0x24f99b(%rip), %rcx    # 0x31b48e
leaq 0x24f760(%rip), %r8     # 0x31b25a
movl $0x566, %r9d            # imm = 0x566
jmp 0xcbb2e
movq 0x36c45f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x219500(%rip), %rsi    # 0x2e5013
leaq 0x25aed2(%rip), %rdx    # 0x3269ec
leaq 0x24f96d(%rip), %rcx    # 0x31b48e
leaq 0x24f732(%rip), %r8     # 0x31b25a
movl $0x56b, %r9d            # imm = 0x56B
xorl %eax, %eax
callq 0x17a50
callq 0x17390