// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/alignment.c
// Function: gt_alignment_check_edist
int gt_alignment_check_edist(const GtAlignment *alignment,GtUword distance,
                             GtError *err)
{
  if (distance == 0)
  {
    return gt_alignment_check_match(alignment,err);
  } else
  {
    GtUword realedist;
    bool haserr = false;
    GtFrontResource *ftres = gt_frontresource_new(2 * distance);
    GtSeqabstract *useq_abstract
      = gt_seqabstract_new_gtuchar(true,
                                   GT_READMODE_FORWARD,
                                   alignment->u,
                                   alignment->ulen,
                                   0,
                                   alignment->ulen);
    GtSeqabstract *vseq_abstract
      = gt_seqabstract_new_gtuchar(true,
                                   GT_READMODE_FORWARD,
                                   alignment->v,
                                   alignment->vlen,
                                   0,
                                   alignment->vlen);
    realedist = greedyunitedist(ftres,useq_abstract,vseq_abstract);
    if (distance < realedist)
    {
      if (err == NULL)
      {
        fprintf(stderr,"invalid alignment: distance = " GT_WU " is smaller "
                       " than correct edit distance " GT_WU "\n",distance,
                        realedist);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      } else
      {
        gt_error_set(err,"invalid alignment: distance = " GT_WU " is smaller "
                       " than correct edit distance " GT_WU,distance,realedist);
      }
      haserr = true;
    }
    gt_seqabstract_delete(useq_abstract);
    gt_seqabstract_delete(vseq_abstract);
    gt_frontresource_delete(ftres);
    return haserr ? -1 : 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r9
movq %rdi, %r13
testq %rsi, %rsi
je 0xb62b6
movq %rsi, %r15
movq %r9, (%rsp)
leaq (%rsi,%rsi), %rdi
callq 0x15f460
movq %rax, %r12
movq 0x20(%r13), %rdx
movq 0x38(%r13), %rcx
xorl %r14d, %r14d
pushq $0x1
popq %rbx
movl %ebx, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq %rcx, %r9
callq 0x1918b9
movq %rax, %rbp
movq 0x28(%r13), %rdx
movq 0x40(%r13), %rcx
movl %ebx, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq %rcx, %r9
callq 0x1918b9
movq %rax, %rbx
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x15f4de
movq %rax, %r13
cmpq %r15, %rax
jbe 0xb6296
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb6364
leaq 0x25efd4(%rip), %rsi    # 0x31525d
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x89dbb
movq %rbp, %rdi
callq 0x191a01
movq %rbx, %rdi
callq 0x191a01
movq %r12, %rdi
callq 0x15f4a6
cmpq %r13, %r15
sbbl %r14d, %r14d
jmp 0xb631a
movq 0x20(%r13), %rax
testq %rax, %rax
je 0xb632c
movq 0x28(%r13), %rsi
testq %rsi, %rsi
je 0xb632c
movq 0x38(%r13), %rdi
cmpq 0x40(%r13), %rdi
jne 0xb632c
xorl %r14d, %r14d
xorl %edx, %edx
cmpq %rdx, %rdi
je 0xb631a
movzbl (%rax,%rdx), %ecx
movb (%rsi,%rdx), %r8b
cmpl $0xfd, %ecx
ja 0xb62fc
cmpb $-0x3, %r8b
ja 0xb62fc
cmpb %r8b, %cl
jne 0xb62fc
incq %rdx
jmp 0xb62d7
movzbl %r8b, %r8d
testq %r9, %r9
je 0xb6384
leaq 0x25f1bd(%rip), %rsi    # 0x3154c9
movq %r9, %rdi
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x381c35(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x22ecd6(%rip), %rsi    # 0x2e5013
leaq 0x25f0e7(%rip), %rdx    # 0x31542b
leaq 0x25f133(%rip), %rcx    # 0x31547e
leaq 0x25ebbe(%rip), %r8     # 0x314f10
movl $0x2cb, %r9d            # imm = 0x2CB
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x381bfd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x25ee9a(%rip), %rsi    # 0x31520f
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x17a50
jmp 0xb639c
movq 0x381bdd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x25f102(%rip), %rsi    # 0x315497
xorl %eax, %eax
callq 0x17a50
pushq $0x2
popq %rdi
callq 0x178f0