// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/diagband-struct.c
// Function: gt_diagband_struct_reset
void gt_diagband_struct_reset(GtDiagbandStruct *diagband_struct,
                              const GtSeedpairPositions *seedstore,
                              const GtDiagbandseedMaximalmatch *memstore,
                              GtUword segment_length)
{
  gt_assert(diagband_struct != NULL);
  if (diagband_struct->used_diagbands * 3 >= diagband_struct->num_diagbands)
  { /* >= 33% of diagbands are used */
    memset(diagband_struct->score,0,
           sizeof *diagband_struct->score * diagband_struct->num_diagbands);
    memset(diagband_struct->lastpos,0,
           sizeof *diagband_struct->lastpos * diagband_struct->num_diagbands);
    diagband_struct->reset_with_memset++;
  } else
  {
    GtUword idx;

    if (seedstore != NULL)
    {
      for (idx = 0; idx < segment_length; idx++)
      {
        const GtUword diagband_idx
          = GT_DIAGBANDSEED_DIAGONALBAND(diagband_struct->amaxlen,
                                         diagband_struct->logdiagbandwidth,
                                         seedstore[idx].apos,
                                         seedstore[idx].bpos);
        diagband_struct->score[diagband_idx] = 0;
        diagband_struct->lastpos[diagband_idx] = 0;
      }
    } else
    {
      gt_assert(memstore != NULL);
      for (idx = 0; idx < segment_length; idx++)
      {
        const GtUword diagband_idx
          = GT_DIAGBANDSEED_DIAGONALBAND(diagband_struct->amaxlen,
                                         diagband_struct->logdiagbandwidth,
                                         memstore[idx].apos,
                                         memstore[idx].bpos);
        diagband_struct->score[diagband_idx] = 0;
        diagband_struct->lastpos[diagband_idx] = 0;
      }
    }
    diagband_struct->reset_from_matches++;
  }
  diagband_struct->used_diagbands = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x312039
movq %rcx, %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
movq 0x18(%rdi), %rdi
leaq (%rdi,%rdi,2), %rdi
cmpq %rcx, %rdi
jae 0x311fb5
testq %rsi, %rsi
je 0x311ff1
movl $0x20, %edi
testq %rax, %rax
je 0x311fdf
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movq 0x30(%rbx), %r8
movq 0x38(%rbx), %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
movl (%rsi,%r11,8), %r14d
movl 0x4(%rsi,%r11,8), %r15d
addq %rdx, %r15
subq %r14, %r15
shrq %cl, %r15
movl %r10d, (%r8,%r15,4)
movl %r10d, (%r9,%r15,4)
incq %r11
cmpq %r11, %rax
jne 0x311f91
jmp 0x311fdf
movq 0x30(%rbx), %rdi
shlq $0x2, %rcx
xorl %esi, %esi
movq %rcx, %rdx
callq 0x173a0
movq 0x10(%rbx), %rdx
movq 0x38(%rbx), %rdi
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x173a0
movl $0x28, %edi
incq (%rbx,%rdi)
movq $0x0, 0x18(%rbx)
popq %rbx
popq %r14
popq %r15
retq
testq %rdx, %rdx
je 0x31203e
movl $0x20, %edi
testq %rax, %rax
je 0x311fdf
movq (%rbx), %rsi
movq 0x8(%rbx), %rcx
movq 0x30(%rbx), %r8
movq 0x38(%rbx), %r9
addq $0x4, %rdx
xorl %r10d, %r10d
movl -0x4(%rdx), %r11d
movl (%rdx), %r14d
addq %rsi, %r14
subq %r11, %r14
shrq %cl, %r14
movl %r10d, (%r8,%r14,4)
movl %r10d, (%r9,%r14,4)
addq $0xc, %rdx
decq %rax
jne 0x312016
jmp 0x311fdf
callq 0x90d82
callq 0x90d49