// File: /workspace/github_c_makefile_star2_O3/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 0x135164
testq %rdx, %rdx
je 0x135164
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 0x135169
movq 0xd0(%rsp), %r15
cmpq %r15, %rax
jg 0x135169
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 0x15be18
movq %r12, %rdi
callq 0x171437
testq %rbx, %rbx
je 0x135028
testq %rbp, %rbp
je 0x135046
movl $0x30, %ecx
movl $0x30, %r8d
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x15bd8d
testb %al, %al
je 0x135064
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 0x13452c
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 0x16cd21
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 0x16cce8
movq %r15, %rsi
subq %r14, %rsi
cmpq %rbx, %rsi
cmovaeq %rbx, %rsi
movl $0x30, %ecx
movl $0x30, %r8d
movl $0x48, %r9d
movq %r13, %rdi
movq %rbp, %rdx
callq 0x15bc3e
movq %r13, %rdi
callq 0x15be41
movq %rax, %rsi
leaq 0x1(%rbp), %rax
cmpq $0x1, %rax
movq %rbp, %rax
adcq $0x1, %rax
movq %rsi, %rcx
addq $0x40, %rcx
pcmpeqd %xmm0, %xmm0
movl $0x3, %edx
movdqu %xmm0, -0x40(%rcx)
movl %edx, -0x30(%rcx)
movdqu %xmm0, -0x28(%rcx)
movl %edx, -0x18(%rcx)
movdqu %xmm0, -0x10(%rcx)
movl %edx, (%rcx)
addq $0x48, %rcx
decq %rax
jne 0x1350b7
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 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %r14
movq %r14, 0x10(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%rsp)
movq %r13, %rdi
movq %rsi, %r13
movq %r12, %rdx
movl $0x3, %ecx
movl $0x3, %r8d
movl $0x3, %r9d
callq 0x1356b0
movq %rbp, (%rsp)
movq 0x50(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rcx
movq %rbx, %r8
movq %r15, %r9
callq 0x16d3f4
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3f45b
callq 0x3f494