// File: /workspace/github_c_makefile_star2_O2/richarddurbin[P]hash10x/seqhash.c
// Function: minimizerRCnext
BOOL minimizerRCnext (SeqhashRCiterator *mi, U64 *u, int *pos, BOOL *isF) /* returns u,pos,isF */
{
  if (mi->isDone) return FALSE ; /* we are done */

#ifdef DEBUG
  printf ("base %d, iStart %d, iMin %d\n", mi->base, mi->iStart, mi->iMin) ;
  int j ; for (j = 0 ; j < mi->sh->w ; ++j) printf ("  %x", mi->hashBuf[j]) ;
  printf ("\n") ;
#endif

  assert (u && pos) ;
  *pos = mi->base + mi->iMin ; if (mi->iMin < mi->iStart) *pos += mi->sh->w ;
  *u = mi->hashBuf[mi->iMin] ; if (isF) *isF = mi->fBuf[mi->iMin] ;
  if (mi->s >= mi->sEnd) { mi->isDone = TRUE ; return TRUE ; }

  int i ;	    		/* next update hashBuf splitting into two cases */
  U64 min = *u ;    /* save this here for end case - see below */
  if (mi->iMin >= mi->iStart)
    for (i = mi->iStart ; i <= mi->iMin ; ++i, ++mi->s)
      mi->hashBuf[i] = advanceHashRC (mi, &mi->fBuf[i]) ;
  else
    { for (i = mi->iStart ; i < mi->sh->w ; ++i, ++mi->s)
	mi->hashBuf[i] = advanceHashRC (mi, &mi->fBuf[i]) ;
      mi->base += mi->sh->w ;
      for (i = 0 ; i <= mi->iMin ; ++i, ++mi->s)
	mi->hashBuf[i] = advanceHashRC (mi, &mi->fBuf[i]) ;
    }
  mi->iStart = mi->iMin + 1 ;
  if (mi->iStart == mi->sh->w) { mi->iStart = 0 ; mi->base += mi->sh->w ; }

  /* finally find new min to set up for next call */
  if (mi->hashBuf[mi->iMin] != U64MAX) /* there was a full new window */
    min = U64MAX ;
  else				/* otherwise, keep the last min */
    mi->iMin = -1 ;
  for (i = 0 ; i < mi->sh->w ; ++i)
    if (mi->hashBuf[i] < min) { min = mi->hashBuf[i] ; mi->iMin = i ; }
  if (mi->iMin == -1)		/* our old min was not beaten - we are done */
    mi->isDone = TRUE ;
  
  return TRUE ;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpb $0x0, 0x44(%rdi)
je 0x33d2
xorl %eax, %eax
jmp 0x3522
testq %rsi, %rsi
je 0x3528
testq %rdx, %rdx
je 0x3528
movq %rdi, %rbx
movl 0x40(%rdi), %eax
addl 0x38(%rdi), %eax
movl %eax, (%rdx)
movl 0x40(%rdi), %edi
cmpl 0x3c(%rbx), %edi
jge 0x3402
movq (%rbx), %rdi
addl 0x4(%rdi), %eax
movl %eax, (%rdx)
movl 0x40(%rbx), %edi
movq 0x28(%rbx), %rdx
movslq %edi, %rax
movq (%rdx,%rax,8), %rdx
movq %rdx, (%rsi)
testq %rcx, %rcx
je 0x341e
movq 0x30(%rbx), %rdx
movb (%rdx,%rax), %al
movb %al, (%rcx)
movq 0x8(%rbx), %rax
cmpq 0x10(%rbx), %rax
jae 0x351c
movq (%rsi), %r14
movl 0x40(%rbx), %ecx
movslq 0x3c(%rbx), %r15
cmpl %r15d, %ecx
jge 0x3467
movq (%rbx), %rax
movslq 0x4(%rax), %rax
cmpq %rax, %r15
jge 0x3492
movq 0x30(%rbx), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x3381
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
incq 0x8(%rbx)
jmp 0x343b
movslq %ecx, %rax
cmpq %rax, %r15
jg 0x34c1
movq 0x30(%rbx), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x3381
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
incq 0x8(%rbx)
movl 0x40(%rbx), %ecx
jmp 0x3467
addl %eax, 0x38(%rbx)
xorl %r15d, %r15d
movslq 0x40(%rbx), %rcx
cmpq %rcx, %r15
jg 0x34c1
movq 0x30(%rbx), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x3381
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
incq 0x8(%rbx)
jmp 0x3498
leal 0x1(%rcx), %edx
movl %edx, 0x3c(%rbx)
movq (%rbx), %rax
movl 0x4(%rax), %eax
cmpl %eax, %edx
jne 0x34d8
andl $0x0, 0x3c(%rbx)
addl %edx, 0x38(%rbx)
movq 0x28(%rbx), %rdx
movslq %ecx, %rsi
cmpq $-0x1, (%rdx,%rsi,8)
je 0x34ec
pushq $-0x1
popq %r14
jmp 0x34f3
orl $-0x1, 0x40(%rbx)
pushq $-0x1
popq %rcx
xorl %esi, %esi
testl %eax, %eax
cmovlel %esi, %eax
cmpq %rsi, %rax
je 0x3515
movq (%rdx,%rsi,8), %rdi
cmpq %r14, %rdi
jae 0x3510
movl %esi, 0x40(%rbx)
movl %esi, %ecx
movq %rdi, %r14
incq %rsi
jmp 0x34fa
movb $0x1, %al
cmpl $-0x1, %ecx
jne 0x3522
movb $0x1, 0x44(%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
leaq 0x3582(%rip), %rdi      # 0x6ab1
leaq 0x3532(%rip), %rsi      # 0x6a68
leaq 0x357d(%rip), %rcx      # 0x6aba
pushq $0x79
popq %rdx
callq 0x10c0