// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/align.c
// Function: Compute_Trace_IRR
int Compute_Trace_IRR(Alignment *align, Work_Data *ework, int mode)
{ _Work_Data *work = (_Work_Data *) ework;
  Trace_Waves wave;

  Path   *path;
  char   *aseq, *bseq;
  int     alen, blen;
  uint16 *points;
  int     tlen;
  int     ab, bb;
  int     ae, be;
  int     diffs, dmax;

  alen   = align->alen;
  blen   = align->blen;
  path   = align->path;
  aseq   = align->aseq;
  bseq   = align->bseq;
  tlen   = path->tlen;
  points = (uint16 *) path->trace;

  { int64 s;
    int   d;
    int   M, N;
    int   mmax, nmax;
    int   **PVF, **PHF;

    M = path->aepos-path->abpos;
    N = path->bepos-path->bbpos;
    if (M < N)
      s = N*sizeof(int);
    else
      s = M*sizeof(int);
    if (s > work->tramax)
      if (enlarge_trace(work,s))
        EXIT(1);

    nmax = mmax = 0;
    for (d = 0; d < tlen; d += 2)
      { if (points[d] > mmax)
          mmax = points[d];
        if (points[d+1] > nmax)
          nmax = points[d+1];
      }
    if (tlen <= 1)
      { mmax = M;
        nmax = N;
      }
    if (mmax > nmax)
      dmax = nmax;
    else
      dmax = mmax;

    s = (dmax+3)*2*((mmax+nmax+3)*sizeof(int) + sizeof(int *));

    if (s > work->vecmax)
      if (enlarge_vector(work,s))
        EXIT(1);

    wave.PVF = PVF = ((int **) (work->vector)) + 2;
    wave.PHF = PHF = PVF + (dmax+3);

    s = mmax+nmax+3;
    PVF[-2] = ((int *) (PHF + (dmax+1))) + (nmax+1);
    for (d = -1; d <= dmax; d++)
      PVF[d] = PVF[d-1] + s;
    PHF[-2] = PVF[dmax] + s;
    for (d = -1; d <= dmax; d++)
      PHF[d] = PHF[d-1] + s;
  }

  wave.Stop = (int *) (work->trace);
  wave.Aabs = aseq;
  wave.Babs = bseq;

  { int i, d;

    diffs = 0;
    ab = path->abpos;
    bb = path->bbpos;
    for (i = 0; i < tlen; i += 2)
      { ae = ab + points[i];
        be = bb + points[i+1];
        if (ae > alen || be > blen)
          { EPRINTF(EPLACE,"%s: %s\n",Prog_Name,TP_Error);
            EXIT(1);
          }
        d = iter_np(aseq+ab,ae-ab,bseq+bb,be-bb,&wave,mode,dmax);
        if (d < 0)
          EXIT(1);
        diffs += d;
        ab = ae;
        bb = be;
      }
  }

  path->trace = work->trace;
  path->tlen  = wave.Stop - ((int *) path->trace);
  path->diffs = diffs;

  return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x94(%rbp)
movq -0x70(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x70(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x70(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0xc0(%rbp)
movq -0x70(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x70(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0xc4(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xc4(%rbp), %eax
jge 0x19960
movslq -0xc4(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0xb8(%rbp)
jmp 0x19972
movslq -0xc0(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x30(%rcx), %rcx
cmpq %rcx, %rax
jle 0x199a9
movq -0x20(%rbp), %rdi
movq -0xb8(%rbp), %rax
movl %eax, %esi
callq 0x16de0
cmpl $0x0, %eax
je 0x199a7
movl $0x1, %edi
callq 0x2290
jmp 0x199a9
movl $0x0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movl $0x0, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
cmpl -0x94(%rbp), %eax
jge 0x19a5d
movq -0x90(%rbp), %rax
movslq -0xbc(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
cmpl -0xc8(%rbp), %eax
jle 0x19a0b
movq -0x90(%rbp), %rax
movslq -0xbc(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0xc8(%rbp)
movq -0x90(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
cmpl -0xcc(%rbp), %eax
jle 0x19a47
movq -0x90(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0xcc(%rbp)
jmp 0x19a49
movl -0xbc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xbc(%rbp)
jmp 0x199c7
cmpl $0x1, -0x94(%rbp)
jg 0x19a7e
movl -0xc0(%rbp), %eax
movl %eax, -0xc8(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl -0xc8(%rbp), %eax
cmpl -0xcc(%rbp), %eax
jle 0x19a9a
movl -0xcc(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x19aa6
movl -0xc8(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
addl $0x3, %eax
shll %eax
cltq
movl -0xc8(%rbp), %ecx
addl -0xcc(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq $0x8, %rcx
imulq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0x19b0e
movq -0x20(%rbp), %rdi
movq -0xb8(%rbp), %rax
movl %eax, %esi
callq 0x5220
cmpl $0x0, %eax
je 0x19b0c
movl $0x1, %edi
callq 0x2290
jmp 0x19b0e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x10, %rax
movq %rax, -0xd8(%rbp)
movq %rax, -0x48(%rbp)
movq -0xd8(%rbp), %rax
movl -0xac(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq %rax, -0x40(%rbp)
movl -0xc8(%rbp), %eax
addl -0xcc(%rbp), %eax
addl $0x3, %eax
cltq
movq %rax, -0xb8(%rbp)
movq -0xe0(%rbp), %rcx
movl -0xac(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq %rax, %rcx
movl -0xcc(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movq -0xd8(%rbp), %rax
movq %rcx, -0x10(%rax)
movl $0xffffffff, -0xbc(%rbp) # imm = 0xFFFFFFFF
movl -0xbc(%rbp), %eax
cmpl -0xac(%rbp), %eax
jg 0x19bf8
movq -0xd8(%rbp), %rax
movl -0xbc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0xb8(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdx
movq -0xd8(%rbp), %rax
movslq -0xbc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x19ba2
movq -0xd8(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0xb8(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0x10(%rax)
movl $0xffffffff, -0xbc(%rbp) # imm = 0xFFFFFFFF
movl -0xbc(%rbp), %eax
cmpl -0xac(%rbp), %eax
jg 0x19c83
movq -0xe0(%rbp), %rax
movl -0xbc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0xb8(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdx
movq -0xe0(%rbp), %rax
movslq -0xbc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x19c2d
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0xa8(%rbp)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x98(%rbp)
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x9c(%rbp)
movl $0x0, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
cmpl -0x94(%rbp), %eax
jge 0x19e14
movl -0x98(%rbp), %eax
movq -0x90(%rbp), %rcx
movslq -0xe4(%rbp), %rdx
movzwl (%rcx,%rdx,2), %ecx
addl %ecx, %eax
movl %eax, -0xa0(%rbp)
movl -0x9c(%rbp), %eax
movq -0x90(%rbp), %rcx
movl -0xe4(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzwl (%rcx,%rdx,2), %ecx
addl %ecx, %eax
movl %eax, -0xa4(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x84(%rbp), %eax
jg 0x19d40
movl -0xa4(%rbp), %eax
cmpl -0x88(%rbp), %eax
jle 0x19d73
movq 0x112b1(%rip), %rax     # 0x2aff8
movq (%rax), %rdi
leaq 0x117ff(%rip), %rax     # 0x2b550
movq (%rax), %rdx
movq 0x114bd(%rip), %rcx     # 0x2b218
leaq 0xc8e4(%rip), %rsi      # 0x26646
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x2290
movq -0x78(%rbp), %rdi
movslq -0x98(%rbp), %rax
addq %rax, %rdi
movl -0xa0(%rbp), %esi
subl -0x98(%rbp), %esi
movq -0x80(%rbp), %rdx
movslq -0x9c(%rbp), %rax
addq %rax, %rdx
movl -0xa4(%rbp), %ecx
subl -0x9c(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl -0xac(%rbp), %eax
leaq -0x68(%rbp), %r8
movl %eax, (%rsp)
callq 0x16e60
movl %eax, -0xe8(%rbp)
cmpl $0x0, -0xe8(%rbp)
jge 0x19dd6
movl $0x1, %edi
callq 0x2290
movl -0xe8(%rbp), %eax
addl -0xa8(%rbp), %eax
movl %eax, -0xa8(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0xe4(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xe4(%rbp)
jmp 0x19ccd
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x70(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xa8(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0xc(%rax)
xorl %eax, %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)