// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DASpatch.c
// Function: make_a_pass
static int make_a_pass(FILE *input, void (*ACTION)(int, Overlap *, int), int trace)
{ static Overlap *ovls = NULL;
  static int      omax = 500;
  static uint16  *paths = NULL;
  static int      pmax = 100000;

  int64 i, j, novl;
  int   n, a;
  int   pcur;
  int   max;
  int   tbytes;

  if (ovls == NULL)
    { ovls = (Overlap *) Malloc(sizeof(Overlap)*omax,"Allocating overlap buffer");
      if (ovls == NULL)
        exit (1);
    }
  if (trace && paths == NULL)
    { paths = (uint16 *) Malloc(sizeof(uint16)*pmax,"Allocating path buffer");
      if (paths == NULL)
        exit (1);
    }

  rewind(input);
  fread(&novl,sizeof(int64),1,input);
  fread(&TRACE_SPACING,sizeof(int),1,input);
  if (TRACE_SPACING <= TRACE_XOVR)
    tbytes = sizeof(uint8);
  else
    tbytes = sizeof(uint16);

  if (Read_Overlap(input,ovls) != 0)
    ovls[0].aread = INT32_MAX;
  else if (trace)
    { if (ovls[0].path.tlen > pmax)
        { pmax  = 1.2*(ovls[0].path.tlen)+10000;
          paths = (uint16 *) Realloc(paths,sizeof(uint16)*pmax,"Expanding path buffer");
          if (paths == NULL) exit (1);
        }
      fread(paths,tbytes,ovls[0].path.tlen,input);
      if (tbytes == 1)
        { ovls[0].path.trace = paths;
          Decompress_TraceTo16(ovls);
        }
    }
  else
    fseek(input,tbytes*ovls[0].path.tlen,SEEK_CUR);

  if (ovls[0].aread < DB_FIRST)
    { fprintf(stderr,"%s: .las file overlaps don't correspond to reads in block %d of DB\n",
                     Prog_Name,DB_PART);
      exit (1);
    }

  pcur = 0;
  n = max = 0;
  for (j = DB_FIRST; j < DB_LAST; j++)
    { ovls[0] = ovls[n];
      a = ovls[0].aread;
      if (a != j)
        n = 0;
      else
        { if (trace)
            memmove(paths,paths+pcur,sizeof(uint16)*ovls[0].path.tlen);
          n = 1;
          pcur = ovls[0].path.tlen;
          while (1)
            { if (Read_Overlap(input,ovls+n) != 0)
                { ovls[n].aread = INT32_MAX;
                  break;
                }
              if (trace)
                { if (pcur + ovls[n].path.tlen > pmax)
                    { pmax = 1.2*(pcur+ovls[n].path.tlen)+10000;
                      paths = (uint16 *) Realloc(paths,sizeof(uint16)*pmax,"Expanding path buffer");
                      if (paths == NULL) exit (1);
                    }
                  fread(paths+pcur,tbytes,ovls[n].path.tlen,input);
                  if (tbytes == 1)
                    { ovls[n].path.trace = paths+pcur;
                      Decompress_TraceTo16(ovls+n);
                    }
                }
              else
                fseek(input,tbytes*ovls[n].path.tlen,SEEK_CUR);
              if (ovls[n].aread != a)
                break;
              pcur += ovls[n].path.tlen;
              n    += 1;
              if (n >= omax)
                { omax = 1.2*n + 100;
                  ovls = (Overlap *) Realloc(ovls,sizeof(Overlap)*omax,"Expanding overlap buffer");
                  if (ovls == NULL) exit (1);
                }
            }

          if (n >= max)
            max = n;
          pcur = 0;
          for (i = 0; i < n; i++)
            { ovls[i].path.trace = paths+pcur;
              pcur += ovls[i].path.tlen;
            }
        }
      ACTION(j,ovls,n);
    }

  if (ovls[n].aread < INT32_MAX)
    { fprintf(stderr,"%s: .las file overlaps don't correspond to reads in block %d of DB\n",
                     Prog_Name,DB_PART);
      exit (1);
    }

  return (max);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, 0x28345(%rip)     # 0x2b4d0
jne 0x31c1
movslq 0x27ffc(%rip), %rax     # 0x2b190
imulq $0x30, %rax, %rdi
leaq 0x231a4(%rip), %rsi     # 0x26343
callq 0x1aa00
movq %rax, 0x28325(%rip)     # 0x2b4d0
cmpq $0x0, 0x2831d(%rip)     # 0x2b4d0
jne 0x31bf
movl $0x1, %edi
callq 0x2290
jmp 0x31c1
cmpl $0x0, -0x14(%rbp)
je 0x3204
cmpq $0x0, 0x28309(%rip)     # 0x2b4d8
jne 0x3204
movslq 0x27fbc(%rip), %rdi     # 0x2b194
shlq %rdi
leaq 0x2317b(%rip), %rsi     # 0x2635d
callq 0x1aa00
movq %rax, 0x282ea(%rip)     # 0x2b4d8
cmpq $0x0, 0x282e2(%rip)     # 0x2b4d8
jne 0x3202
movl $0x1, %edi
callq 0x2290
jmp 0x3204
movq -0x8(%rbp), %rdi
callq 0x2100
movq -0x8(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20a0
movq -0x8(%rbp), %rcx
leaq 0x28221(%rip), %rdi     # 0x2b450
movl $0x4, %esi
movl $0x1, %edx
callq 0x20a0
cmpl $0x7d, 0x2820b(%rip)    # 0x2b450
jg 0x3250
movl $0x1, -0x44(%rbp)
jmp 0x3257
movl $0x2, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movq 0x2826e(%rip), %rsi     # 0x2b4d0
callq 0xd890
cmpl $0x0, %eax
je 0x327f
movq 0x2825d(%rip), %rax     # 0x2b4d0
movl $0x7fffffff, 0x24(%rax) # imm = 0x7FFFFFFF
jmp 0x3368
cmpl $0x0, -0x14(%rbp)
je 0x3347
movq 0x28240(%rip), %rax     # 0x2b4d0
movl 0x8(%rax), %eax
cmpl 0x27efb(%rip), %eax     # 0x2b194
jle 0x3303
movq 0x2822e(%rip), %rax     # 0x2b4d0
cvtsi2sdl 0x8(%rax), %xmm0
movsd 0x22d61(%rip), %xmm1    # 0x26010
mulsd %xmm1, %xmm0
movsd 0x22d5d(%rip), %xmm1    # 0x26018
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x27ecb(%rip)     # 0x2b194
movq 0x28208(%rip), %rdi     # 0x2b4d8
movslq 0x27ebd(%rip), %rsi     # 0x2b194
shlq %rsi
leaq 0x23093(%rip), %rdx     # 0x26374
callq 0x1aa80
movq %rax, 0x281eb(%rip)     # 0x2b4d8
cmpq $0x0, 0x281e3(%rip)     # 0x2b4d8
jne 0x3301
movl $0x1, %edi
callq 0x2290
jmp 0x3303
movq 0x281ce(%rip), %rdi     # 0x2b4d8
movslq -0x44(%rbp), %rsi
movq 0x281bb(%rip), %rax     # 0x2b4d0
movslq 0x8(%rax), %rdx
movq -0x8(%rbp), %rcx
callq 0x20a0
cmpl $0x1, -0x44(%rbp)
jne 0x3345
movq 0x281a9(%rip), %rcx     # 0x2b4d8
movq 0x2819a(%rip), %rax     # 0x2b4d0
movq %rcx, (%rax)
movq 0x28190(%rip), %rdi     # 0x2b4d0
callq 0xdac0
jmp 0x3366
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %eax
movq 0x2817b(%rip), %rcx     # 0x2b4d0
imull 0x8(%rcx), %eax
movslq %eax, %rsi
movl $0x1, %edx
callq 0x2220
jmp 0x3368
movq 0x28161(%rip), %rax     # 0x2b4d0
movl 0x24(%rax), %eax
cmpl 0x280b8(%rip), %eax     # 0x2b430
jge 0x33ac
movq 0x27c77(%rip), %rax     # 0x2aff8
movq (%rax), %rdi
leaq 0x281c5(%rip), %rax     # 0x2b550
movq (%rax), %rdx
movl 0x28098(%rip), %ecx     # 0x2b42c
leaq 0x22fef(%rip), %rsi     # 0x2638a
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x2290
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movslq 0x28068(%rip), %rax     # 0x2b430
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq 0x2805d(%rip), %rcx     # 0x2b434
cmpq %rcx, %rax
jge 0x373f
movq 0x280e9(%rip), %rdi     # 0x2b4d0
movq 0x280e2(%rip), %rsi     # 0x2b4d0
movslq -0x34(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl $0x30, %edx
callq 0x21d0
movq 0x280c6(%rip), %rax     # 0x2b4d0
movl 0x24(%rax), %eax
movl %eax, -0x38(%rbp)
movslq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x3426
movl $0x0, -0x34(%rbp)
jmp 0x3718
cmpl $0x0, -0x14(%rbp)
je 0x3457
movq 0x280a5(%rip), %rdi     # 0x2b4d8
movq 0x2809e(%rip), %rsi     # 0x2b4d8
movslq -0x3c(%rbp), %rax
shlq %rax
addq %rax, %rsi
movq 0x28085(%rip), %rax     # 0x2b4d0
movslq 0x8(%rax), %rdx
shlq %rdx
callq 0x2240
movl $0x1, -0x34(%rbp)
movq 0x2806b(%rip), %rax     # 0x2b4d0
movl 0x8(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movq 0x2805a(%rip), %rsi     # 0x2b4d0
movslq -0x34(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
callq 0xd890
cmpl $0x0, %eax
je 0x34a9
movq 0x2803e(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl $0x7fffffff, 0x24(%rax) # imm = 0x7FFFFFFF
jmp 0x36a3
cmpl $0x0, -0x14(%rbp)
je 0x35c4
movl -0x3c(%rbp), %eax
movq 0x28013(%rip), %rcx     # 0x2b4d0
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
addl 0x8(%rcx), %eax
cmpl 0x27cc3(%rip), %eax     # 0x2b194
jle 0x354b
movl -0x3c(%rbp), %eax
movq 0x27ff3(%rip), %rcx     # 0x2b4d0
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
addl 0x8(%rcx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x22b19(%rip), %xmm1    # 0x26010
mulsd %xmm1, %xmm0
movsd 0x22b15(%rip), %xmm1    # 0x26018
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x27c83(%rip)     # 0x2b194
movq 0x27fc0(%rip), %rdi     # 0x2b4d8
movslq 0x27c75(%rip), %rsi     # 0x2b194
shlq %rsi
leaq 0x22e4b(%rip), %rdx     # 0x26374
callq 0x1aa80
movq %rax, 0x27fa3(%rip)     # 0x2b4d8
cmpq $0x0, 0x27f9b(%rip)     # 0x2b4d8
jne 0x3549
movl $0x1, %edi
callq 0x2290
jmp 0x354b
movq 0x27f86(%rip), %rdi     # 0x2b4d8
movslq -0x3c(%rbp), %rax
shlq %rax
addq %rax, %rdi
movslq -0x44(%rbp), %rsi
movq 0x27f69(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rdx
movq -0x8(%rbp), %rcx
callq 0x20a0
cmpl $0x1, -0x44(%rbp)
jne 0x35c2
movq 0x27f4c(%rip), %rcx     # 0x2b4d8
movslq -0x3c(%rbp), %rax
shlq %rax
addq %rax, %rcx
movq 0x27f33(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x27f1e(%rip), %rdi     # 0x2b4d0
movslq -0x34(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0xdac0
jmp 0x35ee
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %eax
movq 0x27efe(%rip), %rcx     # 0x2b4d0
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
imull 0x8(%rcx), %eax
movslq %eax, %rsi
movl $0x1, %edx
callq 0x2220
movq 0x27edb(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %eax
cmpl -0x38(%rbp), %eax
je 0x360d
jmp 0x36a3
movq 0x27ebc(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl 0x27b56(%rip), %eax     # 0x2b190
jl 0x369e
cvtsi2sdl -0x34(%rbp), %xmm0
movsd 0x229c7(%rip), %xmm1    # 0x26010
mulsd %xmm1, %xmm0
movsd 0x229cb(%rip), %xmm1    # 0x26020
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x27b2d(%rip)     # 0x2b190
movq 0x27e66(%rip), %rdi     # 0x2b4d0
movslq 0x27b1f(%rip), %rax     # 0x2b190
imulq $0x30, %rax, %rsi
leaq 0x22d52(%rip), %rdx     # 0x263ce
callq 0x1aa80
movq %rax, 0x27e48(%rip)     # 0x2b4d0
cmpq $0x0, 0x27e40(%rip)     # 0x2b4d0
jne 0x369c
movl $0x1, %edi
callq 0x2290
jmp 0x369e
jmp 0x346b
movl -0x34(%rbp), %eax
cmpl -0x40(%rbp), %eax
jl 0x36b1
movl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq %rcx, %rax
jge 0x3716
movq 0x27e04(%rip), %rcx     # 0x2b4d8
movslq -0x3c(%rbp), %rax
shlq %rax
addq %rax, %rcx
movq 0x27deb(%rip), %rax     # 0x2b4d0
imulq $0x30, -0x20(%rbp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x27dd9(%rip), %rax     # 0x2b4d0
imulq $0x30, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x36c0
jmp 0x3718
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movl %ecx, %edi
movq 0x27da7(%rip), %rsi     # 0x2b4d0
movl -0x34(%rbp), %edx
callq *%rax
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x33cc
movq 0x27d8a(%rip), %rax     # 0x2b4d0
movslq -0x34(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x24(%rax) # imm = 0x7FFFFFFF
jge 0x378c
movq 0x27897(%rip), %rax     # 0x2aff8
movq (%rax), %rdi
leaq 0x27de5(%rip), %rax     # 0x2b550
movq (%rax), %rdx
movl 0x27cb8(%rip), %ecx     # 0x2b42c
leaq 0x22c0f(%rip), %rsi     # 0x2638a
movb $0x0, %al
callq 0x2190
movl $0x1, %edi
callq 0x2290
movl -0x40(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)