// File: /workspace/github_c_makefile_star2_O3/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 0x121cf6
movq %rsi, %r14
movq %r9, (%rsp)
leaq (%rsi,%rsi), %rdi
callq 0x1b1a84
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 0x1e28c9
movq %rax, %r13
movq 0x28(%rbp), %rdx
movq 0x40(%rbp), %rcx
movl $0x1, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq %rcx, %r9
callq 0x1e28c9
movq %rax, %rbx
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1b1b0c
movq %rax, %rbp
cmpq %r14, %rax
jbe 0x121cd6
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x121d78
leaq 0x253284(%rip), %rsi    # 0x374f4d
movq %r14, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xfcb67
movq %r13, %rdi
callq 0x1e2a17
movq %rbx, %rdi
callq 0x1e2a17
movq %r12, %rdi
callq 0x1b1ad0
cmpq %rbp, %r14
sbbl %r15d, %r15d
jmp 0x121d61
movq 0x20(%rbp), %rax
testq %rax, %rax
je 0x121d73
movq 0x28(%rbp), %rsi
testq %rsi, %rsi
je 0x121d73
movq 0x38(%rbp), %rdi
cmpq 0x40(%rbp), %rdi
jne 0x121d73
testq %rdi, %rdi
je 0x121d3c
xorl %edx, %edx
movzbl (%rax,%rdx), %ecx
movb (%rsi,%rdx), %r8b
cmpl $0xfd, %ecx
ja 0x121d41
cmpb $-0x3, %r8b
ja 0x121d41
cmpb %r8b, %cl
jne 0x121d41
incq %rdx
cmpq %rdx, %rdi
jne 0x121d19
xorl %r15d, %r15d
jmp 0x121d61
movzbl %r8b, %r8d
testq %r9, %r9
je 0x121d83
leaq 0x253468(%rip), %rsi    # 0x3751b9
movq %r9, %rdi
xorl %eax, %eax
callq 0xfcb67
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 0x3a2be
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3a297
movq 0x3971f6(%rip), %rax    # 0x4b8f80
movq (%rax), %rdi
leaq 0x2533f3(%rip), %rsi    # 0x375187
xorl %eax, %eax
callq 0x17ab0
movl $0x2, %edi
callq 0x17940