// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DAStrim.c
// Function: analyze_gap_pairs
static int analyze_gap_pairs(int gsize, Spanner *gsort, Overlap *ovls,
                             int gcnt, int scnt, int test, int move)
{ int j, l, c, x, w;
  int bord, soft, keeper;
  int ncnt, biggest;

  (void) ovls;

  biggest = 0;
  ncnt = 0;
#ifdef SHOW_PAIRS
  if (move)
    printf("  Gsort: %d\n",gsize);
#endif
  if (gcnt > 0)
    c = gsize - gsort[0].delta;
  else
    c = gsize;
  w = 0;
  for (j = 0; j <= gcnt; j++)
    { l = c;
      if (j >= gcnt)
        bord = 1;
      else
        { c = gsize - gsort[j].delta;
          if (l < 0)
            bord = (l-c >= 20-.1*c);
          else
            bord = (l-c >= 20+.1*l);
        }
      if (bord)
        { soft = 0;
          for (x = w; x < j; x++)
            soft += (gsort[x].soft <= test);
          keeper = (j-w >= 4 && (soft < .4*(j-w) || (j-w)-soft >= 8));
          if (test == 0)
            { if (keeper && j-w > biggest)
                { biggest = j-w;
                  ncnt = 0;
                }
              else
                keeper = 0;
            }
#ifdef SHOW_PAIRS
          if (move)
            { printf("----\n");
              for (x = w; x < j; x++)
                { printf("  %3d: %5d %5d",x,gsort[x].delta,gsize-gsort[x].delta);
                  printf(" %5d",ovls[gsort[x].lidx].bread);
                  if (gsort[x].soft == 0)
                    printf(" @");
                  else if (gsort[x].soft == 1)
                    printf(" #");
                  else
                    printf("  ");
                  if (!keeper)
                    printf(" X");
                  printf("\n");
                }
            }
#endif
          if (keeper)
            { for (x = w; x < j; x++)
                if (gsort[x].soft > test)
                  break;
              for (w = j; gsort[w-1].soft <= test; w--)
                ;
              if (move)
                while (x < w)
                  gsort[ncnt++] = gsort[x++];
              else
                ncnt += w-x;
            }
          w = j;
        }
    }
  if (move)
    for (x = gcnt; x < gcnt+scnt; x++)
      gsort[ncnt++] = gsort[x];
  else
    ncnt += scnt;

  return (ncnt);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x10(%rbp), %eax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x95c0
movl -0x4(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x30(%rbp)
jmp 0x95c6
movl -0x4(%rbp), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x9845
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x95fa
movl $0x1, -0x3c(%rbp)
jmp 0x9688
movl -0x4(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x9650
movl -0x2c(%rbp), %eax
subl -0x30(%rbp), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0x30(%rbp), %xmm1
movsd 0x22a51(%rip), %xmm2    # 0x2c080
mulsd %xmm2, %xmm1
movsd 0x229dd(%rip), %xmm2    # 0x2c018
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
setae %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9686
movl -0x2c(%rbp), %eax
subl -0x30(%rbp), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
movsd 0x22a11(%rip), %xmm2    # 0x2c078
mulsd %xmm2, %xmm1
movsd 0x229a5(%rip), %xmm2    # 0x2c018
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
setae %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9688
cmpl $0x0, -0x3c(%rbp)
je 0x9835
movl $0x0, -0x40(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x96d5
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x24(%rbp), %eax
setle %al
andb $0x1, %al
movzbl %al, %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x969f
movl -0x28(%rbp), %ecx
subl -0x38(%rbp), %ecx
xorl %eax, %eax
cmpl $0x4, %ecx
movb %al, -0x4d(%rbp)
jl 0x9723
cvtsi2sdl -0x40(%rbp), %xmm1
movl -0x28(%rbp), %eax
subl -0x38(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd 0x2298c(%rip), %xmm0    # 0x2c088
mulsd %xmm2, %xmm0
movb $0x1, %al
ucomisd %xmm1, %xmm0
movb %al, -0x4e(%rbp)
ja 0x971d
movl -0x28(%rbp), %eax
subl -0x38(%rbp), %eax
subl -0x40(%rbp), %eax
cmpl $0x8, %eax
setge %al
movb %al, -0x4e(%rbp)
movb -0x4e(%rbp), %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x9760
cmpl $0x0, -0x44(%rbp)
je 0x9757
movl -0x28(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jle 0x9757
movl -0x28(%rbp), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
jmp 0x975e
movl $0x0, -0x44(%rbp)
jmp 0x9760
cmpl $0x0, -0x44(%rbp)
je 0x982f
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x979e
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x24(%rbp), %eax
jle 0x9791
jmp 0x979e
jmp 0x9793
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9770
movl -0x28(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x24(%rbp), %eax
jg 0x97cd
jmp 0x97c2
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x97a4
cmpl $0x0, 0x10(%rbp)
je 0x9821
jmp 0x97d5
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x981f
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x48(%rbp)
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x97d5
jmp 0x982d
movl -0x38(%rbp), %eax
subl -0x34(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x982f
movl -0x28(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x9837
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x95d4
cmpl $0x0, 0x10(%rbp)
je 0x98a1
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl -0x20(%rbp), %ecx
cmpl %ecx, %eax
jge 0x989f
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x48(%rbp)
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9851
jmp 0x98aa
movl -0x20(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
popq %rbp
retq
nop