// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x12c023
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x12c150
movl %eax, 0x44(%rsp)
jmp 0x12c147
movb $0x0, 0x1f(%rsp)
movq 0x30(%rsp), %rdi
shlq %rdi
callq 0x253810
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x38(%rax), %r9
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %r8d
callq 0x2b0b50
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rdx
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x40(%rax), %r9
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %r8d
callq 0x2b0b50
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq (%rsp), %rdx
callq 0x2538e0
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x20(%rsp), %rax
jae 0x12c115
cmpq $0x0, 0x28(%rsp)
jne 0x12c0f3
movq 0x50fed2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
leaq 0x41b065(%rip), %rsi    # 0x547147
movb $0x0, %al
callq 0x199f0
movl $0x2, %edi
callq 0x19890
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
leaq 0x41b08c(%rip), %rsi    # 0x547195
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x1f(%rsp)
movq 0x8(%rsp), %rdi
callq 0x2b0d20
movq (%rsp), %rdi
callq 0x2b0d20
movq 0x10(%rsp), %rdi
callq 0x2538a0
movb 0x1f(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq