// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
jle 0x11840
movq %rdx, %rdi
callq 0x10333
movq 0x8(%rsp), %rdx
testl %ebp, %ebp
jle 0x11870
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 0x1184c
jmp 0x11876
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpl $0x2, %ebp
cmovll %ebx, %r14d
cmovll %r15d, %r13d
cmpl %r13d, %r14d
movl %r13d, %r9d
cmovll %r14d, %r9d
leal 0x3(%r9), %ebx
leal 0x6(%r9,%r9), %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
movq %r9, 0x10(%rsp)
jle 0x118cb
movq %rdx, %rdi
callq 0x4220
movq 0x10(%rsp), %r9
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rcx
leaq 0x10(%rcx), %rdi
movq %rdi, 0x60(%rsp)
movslq %ebx, %rax
leaq (%rcx,%rax,8), %rsi
addq $0x10, %rsi
movq %rsi, 0x68(%rsp)
movslq %r9d, %r8
leaq (%rsi,%r8,8), %rax
movslq %r13d, %rdx
leaq (%rax,%rdx,4), %rax
addq $0xc, %rax
movq %rax, (%rcx)
cmpl $-0x2, %r9d
jg 0x11911
shlq $0x2, %r15
addq (%rdi,%r8,8), %r15
movq %r15, -0x10(%rsi)
jmp 0x11984
leal 0x1(%r9), %eax
shlq $0x2, %r15
movq (%rcx), %r9
addq %r15, %r9
leaq 0x1(%rax), %r10
xorl %r11d, %r11d
movq %r9, 0x8(%rcx,%r11,8)
addq %r15, %r9
incq %r11
cmpq %r11, %r10
jne 0x11926
movq (%rdi,%r8,8), %rdi
addq %r15, %rdi
movq %rdi, -0x10(%rsi)
movq 0x10(%rsp), %r9
cmpl $-0x1, %r9d
jl 0x11984
cmpl %r14d, %r13d
cmovgel %r14d, %r13d
movslq %r13d, %rsi
movq 0x18(%rcx,%rsi,8), %rsi
addq %r15, %rsi
movslq %r14d, %rdi
cmpq %rdi, %rdx
cmovlq %rdx, %rdi
leaq (%rcx,%rdi,8), %rcx
addq $0x20, %rcx
incq %rax
xorl %edx, %edx
movq %rsi, (%rcx,%rdx,8)
addq %r15, %rsi
incq %rdx
cmpq %rdx, %rax
jne 0x11975
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq 0x30(%rsp), %rcx
movq %rcx, 0x58(%rsp)
testl %ebp, %ebp
jle 0x11a2f
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 0x11a5f
movzwl 0x2(%r12,%r13,2), %ecx
leal (%rax,%rcx), %ebx
cmpl 0x20(%rsp), %ebx
jg 0x11a5f
movslq %edx, %rdi
addq 0x38(%rsp), %rdi
movslq %eax, %rdx
addq 0x30(%rsp), %rdx
movl %r9d, (%rsp)
leaq 0x40(%rsp), %r8
movl 0x1c(%rsp), %r9d
callq 0x1037f
testl %eax, %eax
js 0x11a64
addl %eax, %r15d
addq $0x2, %r13
movl %r14d, %edx
movl %ebx, %eax
cmpl %r13d, %ebp
movq 0x10(%rsp), %r9
jg 0x119bf
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x40(%rsp), %rax
jmp 0x11a35
xorl %r15d, %r15d
movq %rax, %rcx
movq 0x28(%rsp), %rdx
movq %rcx, (%rdx)
subq %rcx, %rax
shrq $0x2, %rax
movl %eax, 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