// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DAStrim.c
// Function: GAP_ANALYSIS
static int *GAP_ANALYSIS(int aread, Overlap *ovls, int novl, Interval *block, int *p_nblk)
{ static int  bmax = 0;
  static int *status = NULL;      //  Status of gaps between HQ_blocks
 
#if defined(DEBUG_SUMMARY) || defined(DEBUG_CLASS)
  static char *status_string[4] = { "LOWQ", "SPAN", "SPLIT", "ADAPT" };
#endif

  int nblk;
  int i, j;
  int slft = 0, srgt = 0;

  (void) aread;

  nblk = *p_nblk;
  if (nblk > bmax)
    { bmax = 1.2*nblk + 100;
      status = (int *) Realloc(status,bmax*sizeof(int),"Allocating status vector");
      if (status == NULL)
        exit (1);
    }

  gap_status(ovls,novl,block,block+nblk,NULL,NULL);  //  Initialization call
  j = 0;
  for (i = 1; i < nblk; i++)
    { status[i] = gap_status(ovls,novl,block+j,block+i,&slft,&srgt);
      if (status[i] == SPAN)
        { while (slft < block[j].beg)
            j -= 1;
          block[j].end = slft;
          j += 1;
          status[j] = status[i];
          while (srgt > block[i].end)
            i += 1;
          block[j] = block[i];
          block[j].beg = srgt;
        }
      else
        { j += 1;
          status[j] = status[i];
          block[j]  = block[i];
        }
    }
  nblk = j+1;

#ifdef DEBUG_SUMMARY
#ifdef DEBUG_GAP_STATUS
  printf("  FINAL:\n");
#endif
  printf("    [%d,%d]",block[0].beg,block[0].end);
  for (i = 1; i < nblk; i++)
    printf(" %s [%d,%d]",status_string[status[i]],block[i].beg,block[i].end);
#endif

#ifdef DEBUG_CLASS
  for (i = 1; i < nblk; i++)
    printf("AREAD %d  %s  [%d,%d]\n",aread,status_string[status[i]],block[i-1].end,block[i].beg);
#endif
  
  *p_nblk  = nblk;
  return (status);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x2a126(%rip), %eax     # 0x31650
jle 0x758e
cvtsi2sdl -0x2c(%rbp), %xmm0
movsd 0x24ae7(%rip), %xmm1    # 0x2c020
mulsd %xmm1, %xmm0
movsd 0x24ac3(%rip), %xmm1    # 0x2c008
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x2a0fd(%rip)     # 0x31650
movq 0x2a0fe(%rip), %rdi     # 0x31658
movslq 0x2a0ef(%rip), %rsi     # 0x31650
shlq $0x2, %rsi
leaq 0x2528e(%rip), %rdx     # 0x2c7fa
callq 0x20050
movq %rax, 0x2a0e0(%rip)     # 0x31658
cmpq $0x0, 0x2a0d8(%rip)     # 0x31658
jne 0x758c
movl $0x1, %edi
callq 0x22a0
jmp 0x758e
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %rcx
movslq -0x2c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x7d30
movl $0x0, -0x34(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x7708
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
leaq -0x38(%rbp), %r8
leaq -0x3c(%rbp), %r9
callq 0x7d30
movl %eax, %edx
movq 0x2a04e(%rip), %rax     # 0x31658
movslq -0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x2a040(%rip), %rax     # 0x31658
movslq -0x30(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
jne 0x76bb
jmp 0x7628
movl -0x38(%rbp), %eax
movq -0x20(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,8), %eax
jge 0x7643
movl -0x34(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x7628
movl -0x38(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq 0x29ff6(%rip), %rax     # 0x31658
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x29fe8(%rip), %rax     # 0x31658
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl 0x4(%rcx,%rdx,8), %eax
jle 0x7693
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x7677
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq -0x20(%rbp), %rdx
movslq -0x30(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x3c(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
jmp 0x76f8
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq 0x29f8d(%rip), %rax     # 0x31658
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x29f7f(%rip), %rax     # 0x31658
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq -0x20(%rbp), %rdx
movslq -0x30(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x76fa
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x75c3
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq 0x29f37(%rip), %rax     # 0x31658
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)