// File: /workspace/github_c_makefile_star2_O2/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 %rbx
testq %rdi, %rdi
je 0x2a6af8
movq %rcx, %rax
movq %rdi, %rbx
imulq $0x3, 0x18(%rdi), %rdi
movq 0x10(%rbx), %rcx
cmpq %rcx, %rdi
jae 0x2a6a8c
testq %rsi, %rsi
je 0x2a6abf
xorl %edx, %edx
pushq $0x20
popq %rdi
cmpq %rdx, %rax
je 0x2a6ab4
movl 0x4(%rsi,%rdx,8), %r8d
addq (%rbx), %r8
movl (%rsi,%rdx,8), %ecx
subq %rcx, %r8
movb 0x8(%rbx), %cl
shrq %cl, %r8
movq 0x30(%rbx), %rcx
andl $0x0, (%rcx,%r8,4)
movq 0x38(%rbx), %rcx
andl $0x0, (%rcx,%r8,4)
incq %rdx
jmp 0x2a6a5c
movq 0x30(%rbx), %rdi
shlq $0x2, %rcx
xorl %esi, %esi
movq %rcx, %rdx
callq 0x17380
movq 0x10(%rbx), %rdx
movq 0x38(%rbx), %rdi
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x17380
pushq $0x28
popq %rdi
incq (%rbx,%rdi)
andq $0x0, 0x18(%rbx)
popq %rbx
retq
testq %rdx, %rdx
je 0x2a6b30
addq $0x4, %rdx
pushq $0x20
popq %rdi
subq $0x1, %rax
jb 0x2a6ab4
movl (%rdx), %esi
addq (%rbx), %rsi
movl -0x4(%rdx), %ecx
subq %rcx, %rsi
movb 0x8(%rbx), %cl
shrq %cl, %rsi
movq 0x30(%rbx), %rcx
andl $0x0, (%rcx,%rsi,4)
movq 0x38(%rbx), %rcx
andl $0x0, (%rcx,%rsi,4)
addq $0xc, %rdx
jmp 0x2a6acb
movq 0x191469(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3e50a(%rip), %rsi     # 0x2e5013
leaq 0xd9fa0(%rip), %rdx     # 0x380ab0
leaq 0xda04d(%rip), %rcx     # 0x380b64
leaq 0xd9f13(%rip), %r8      # 0x380a31
movl $0xbf, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x191431(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3e4d2(%rip), %rsi     # 0x2e5013
leaq 0xd9feb(%rip), %rdx     # 0x380b33
leaq 0xda015(%rip), %rcx     # 0x380b64
leaq 0xd9edb(%rip), %r8      # 0x380a31
movl $0xd9, %r9d
jmp 0x2a6b24