// File: /workspace/github_c_makefile_star2_O1/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, %rbp
testq %rsi, %rsi
je 0x127adf
movq %rsi, %r14
movq %r9, (%rsp)
leaq (%rsi,%rsi), %rdi
callq 0x1ba644
movq %rax, %r12
movq 0x20(%rbp), %rdx
movq 0x38(%rbp), %rcx
xorl %r15d, %r15d
movl $0x1, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq %rcx, %r9
callq 0x1ec161
movq %rax, %r13
movq 0x28(%rbp), %rdx
movq 0x40(%rbp), %rcx
movl $0x1, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq %rcx, %r9
callq 0x1ec161
movq %rax, %rbx
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1ba6cc
movq %rax, %rbp
cmpq %r14, %rax
jbe 0x127abf
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x127b61
leaq 0x25671b(%rip), %rsi    # 0x37e1cd
movq %r14, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1019cf
movq %r13, %rdi
callq 0x1ec2af
movq %rbx, %rdi
callq 0x1ec2af
movq %r12, %rdi
callq 0x1ba690
cmpq %rbp, %r14
sbbl %r15d, %r15d
jmp 0x127b4a
movq 0x20(%rbp), %rax
testq %rax, %rax
je 0x127b5c
movq 0x28(%rbp), %rsi
testq %rsi, %rsi
je 0x127b5c
movq 0x38(%rbp), %rdi
cmpq 0x40(%rbp), %rdi
jne 0x127b5c
testq %rdi, %rdi
je 0x127b25
xorl %edx, %edx
movzbl (%rax,%rdx), %ecx
movb (%rsi,%rdx), %r8b
cmpl $0xfd, %ecx
ja 0x127b2a
cmpb $-0x3, %r8b
ja 0x127b2a
cmpb %r8b, %cl
jne 0x127b2a
incq %rdx
cmpq %rdx, %rdi
jne 0x127b02
xorl %r15d, %r15d
jmp 0x127b4a
movzbl %r8b, %r8d
testq %r9, %r9
je 0x127b6c
leaq 0x2568ff(%rip), %rsi    # 0x37e439
movq %r9, %rdi
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3ac93
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3ac6c
movq 0x39c40d(%rip), %rax    # 0x4c3f80
movq (%rax), %rdi
leaq 0x25688a(%rip), %rsi    # 0x37e407
xorl %eax, %eax
callq 0x17ab0
movl $0x2, %edi
callq 0x17940