// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %edx, 0x1c(%rsp)
movq %rsi, %rdx
movl 0x20(%rdi), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rdi), %eax
movl %eax, 0x20(%rsp)
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
movq %rcx, 0x38(%rsp)
movq 0x18(%rdi), %rcx
movq %rcx, 0x30(%rsp)
movl 0x8(%rax), %ebp
movl 0x18(%rax), %ebx
subl 0x10(%rax), %ebx
movq (%rax), %r12
movl 0x1c(%rax), %r15d
movq %rax, 0x28(%rsp)
subl 0x14(%rax), %r15d
cmpl %r15d, %ebx
movl %r15d, %eax
cmovgl %ebx, %eax
movslq %eax, %rsi
shlq $0x2, %rsi
movslq 0x30(%rdx), %rax
cmpq %rax, %rsi
movq %rdx, 0x10(%rsp)
jle 0x119f3
movq %rdx, %rdi
callq 0x1055f
movq 0x10(%rsp), %rdx
testl %ebp, %ebp
jle 0x11a23
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r14d, %r14d
movzwl (%r12,%rax,2), %ecx
cmpl %ecx, %r14d
cmovlel %ecx, %r14d
movzwl 0x2(%r12,%rax,2), %ecx
cmpl %ecx, %r13d
cmovlel %ecx, %r13d
addq $0x2, %rax
cmpq %rbp, %rax
jb 0x119ff
jmp 0x11a29
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpl $0x2, %ebp
cmovll %ebx, %r14d
cmovll %r15d, %r13d
cmpl %r13d, %r14d
movl %r13d, %eax
cmovll %r14d, %eax
leal 0x3(%rax), %ebx
movq %rax, 0x8(%rsp)
leal 0x6(%rax,%rax), %eax
cltq
leal (%r14,%r13), %ecx
addl $0x3, %ecx
movslq %ecx, %r15
leaq 0x8(,%r15,4), %rsi
imulq %rax, %rsi
movslq (%rdx), %rax
cmpq %rax, %rsi
jle 0x11a77
movq %rdx, %rdi
callq 0x4252
movq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rax
leaq 0x10(%rax), %rdx
movq %rdx, 0x60(%rsp)
movslq %ebx, %rcx
leaq (%rax,%rcx,8), %rsi
addq $0x10, %rsi
movq %rsi, 0x68(%rsp)
movq 0x8(%rsp), %r9
movslq %r9d, %rdi
leaq (%rsi,%rdi,8), %r8
movslq %r13d, %rcx
leaq (%r8,%rcx,4), %r8
addq $0xc, %r8
movq %r8, (%rax)
cmpl $-0x1, %r9d
jl 0x11ae0
movq 0x8(%rsp), %r8
incl %r8d
leaq (,%r15,4), %r9
movq (%rax), %r10
addq %r9, %r10
incq %r8
xorl %r11d, %r11d
movq %r10, 0x8(%rax,%r11,8)
addq %r9, %r10
incq %r11
cmpq %r11, %r8
jne 0x11ad0
shlq $0x2, %r15
movq (%rdx,%rdi,8), %rdx
addq %r15, %rdx
movq %rdx, -0x10(%rsi)
cmpl $-0x1, 0x8(%rsp)
jl 0x11b35
cmpl %r14d, %r13d
cmovgel %r14d, %r13d
movslq %r13d, %rdx
movq 0x18(%rax,%rdx,8), %rdx
addq %r15, %rdx
movslq %r14d, %rsi
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
movq 0x8(%rsp), %rcx
incl %ecx
leaq (%rax,%rsi,8), %rax
addq $0x20, %rax
incq %rcx
xorl %esi, %esi
movq %rdx, (%rax,%rsi,8)
addq %r15, %rdx
incq %rsi
cmpq %rsi, %rcx
jne 0x11b26
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x58(%rsp)
testl %ebp, %ebp
jle 0x11bcd
movq 0x28(%rsp), %rax
movl 0x10(%rax), %edx
movl 0x14(%rax), %eax
xorl %r13d, %r13d
xorl %r15d, %r15d
movzwl (%r12,%r13,2), %esi
leal (%rdx,%rsi), %r14d
cmpl 0x24(%rsp), %r14d
jg 0x11c08
movzwl 0x2(%r12,%r13,2), %ecx
leal (%rax,%rcx), %ebx
cmpl 0x20(%rsp), %ebx
jg 0x11c08
movslq %edx, %rdi
addq 0x38(%rsp), %rdi
movslq %eax, %rdx
addq 0x30(%rsp), %rdx
movq 0x8(%rsp), %rax
movl %eax, (%rsp)
leaq 0x40(%rsp), %r8
movl 0x1c(%rsp), %r9d
callq 0x105ab
testl %eax, %eax
js 0x11c0d
addl %eax, %r15d
addq $0x2, %r13
movl %r14d, %edx
movl %ebx, %eax
cmpl %r13d, %ebp
jg 0x11b6c
jmp 0x11bd0
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x28(%rsp), %rdx
movq %rax, (%rdx)
movq 0x40(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movl %ecx, 0x8(%rdx)
movl %r15d, 0xc(%rdx)
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x14ac
movl $0x1, %edi
callq 0x1280