// File: /workspace/github_c_makefile_star2_O3/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 %rax
cmpb $0x0, 0x44(%rdi)
je 0x38f7
xorl %eax, %eax
jmp 0x3b93
testq %rsi, %rsi
je 0x3b95
testq %rdx, %rdx
je 0x3b95
movl 0x40(%rdi), %eax
addl 0x38(%rdi), %eax
movl %eax, (%rdx)
movl 0x40(%rdi), %r8d
cmpl 0x3c(%rdi), %r8d
jge 0x3928
movq (%rdi), %r8
addl 0x4(%r8), %eax
movl %eax, (%rdx)
movl 0x40(%rdi), %r8d
movq 0x28(%rdi), %rdx
movslq %r8d, %rax
movq (%rdx,%rax,8), %rdx
movq %rdx, (%rsi)
testq %rcx, %rcx
je 0x3944
movq 0x30(%rdi), %rdx
movb (%rdx,%rax), %al
movb %al, (%rcx)
movq 0x8(%rdi), %rcx
cmpq 0x10(%rdi), %rcx
jae 0x3b8d
movq (%rsi), %rax
movl 0x40(%rdi), %edx
movslq 0x3c(%rdi), %rsi
cmpl %esi, %edx
jge 0x3a9e
movq (%rdi), %r8
movl 0x4(%r8), %r9d
cmpl %r9d, %esi
jge 0x39fc
movq $-0x1, %rdx
cmpq 0x10(%rdi), %rcx
jae 0x39da
movq 0x30(%rdi), %r9
movq 0x18(%rdi), %r10
movq 0x20(%rdi), %rdx
shlq $0x2, %r10
andq 0x8(%r8), %r10
movsbq (%rcx), %r11
orq %r10, %r11
movq %r11, 0x18(%rdi)
shrq $0x2, %rdx
movsbq (%rcx), %rcx
orq 0x28(%r8,%rcx,8), %rdx
movq %rdx, 0x20(%rdi)
movb 0x10(%r8), %cl
movq 0x18(%r8), %r8
imulq %r8, %r11
shrq %cl, %r11
imulq %r8, %rdx
shrq %cl, %rdx
cmpq %rdx, %r11
setb (%r9,%rsi)
cmovbq %r11, %rdx
movq (%rdi), %r8
movq 0x8(%rdi), %rcx
movq 0x28(%rdi), %r9
movq %rdx, (%r9,%rsi,8)
incq %rsi
incq %rcx
movq %rcx, 0x8(%rdi)
movslq 0x4(%r8), %r9
cmpq %r9, %rsi
jl 0x3974
movl 0x40(%rdi), %edx
addl %r9d, 0x38(%rdi)
testl %edx, %edx
js 0x3b29
movq $-0x1, %rsi
cmpq 0x10(%rdi), %rcx
jae 0x3a73
movq 0x30(%rdi), %rdx
movq (%rdi), %r9
movq 0x18(%rdi), %r8
shlq $0x2, %r8
andq 0x8(%r9), %r8
movsbq (%rcx), %r10
orq %r8, %r10
movq %r10, 0x18(%rdi)
movq 0x20(%rdi), %r8
shrq $0x2, %r8
movsbq (%rcx), %rcx
orq 0x28(%r9,%rcx,8), %r8
movq %r8, 0x20(%rdi)
movb 0x10(%r9), %cl
movq 0x18(%r9), %r9
imulq %r9, %r10
shrq %cl, %r10
imulq %r9, %r8
shrq %cl, %r8
cmpq %r8, %r10
setb 0x1(%rdx,%rsi)
cmovbq %r10, %r8
movq 0x8(%rdi), %rcx
movl 0x40(%rdi), %edx
jmp 0x3a7a
movq $-0x1, %r8
movq 0x28(%rdi), %r9
movq %r8, 0x8(%r9,%rsi,8)
incq %rcx
movq %rcx, 0x8(%rdi)
movslq %edx, %r8
incq %rsi
cmpq %r8, %rsi
jl 0x3a0f
jmp 0x3b29
decq %rsi
movq $-0x1, %r8
cmpq 0x10(%rdi), %rcx
jae 0x3b0a
movq 0x30(%rdi), %rdx
movq (%rdi), %r9
movq 0x18(%rdi), %r8
shlq $0x2, %r8
andq 0x8(%r9), %r8
movsbq (%rcx), %r10
orq %r8, %r10
movq %r10, 0x18(%rdi)
movq 0x20(%rdi), %r8
shrq $0x2, %r8
movsbq (%rcx), %rcx
orq 0x28(%r9,%rcx,8), %r8
movq %r8, 0x20(%rdi)
movb 0x10(%r9), %cl
movq 0x18(%r9), %r9
imulq %r9, %r10
shrq %cl, %r10
imulq %r9, %r8
shrq %cl, %r8
cmpq %r8, %r10
setb 0x1(%rdx,%rsi)
cmovbq %r10, %r8
movq 0x8(%rdi), %rcx
movl 0x40(%rdi), %edx
movq 0x28(%rdi), %r9
movq %r8, 0x8(%r9,%rsi,8)
incq %rcx
movq %rcx, 0x8(%rdi)
movslq %edx, %r8
incq %rsi
cmpq %r8, %rsi
jl 0x3aa1
leal 0x1(%rdx), %esi
movl %esi, 0x3c(%rdi)
movq (%rdi), %rcx
movl 0x4(%rcx), %ecx
cmpl %ecx, %esi
jne 0x3b43
movl $0x0, 0x3c(%rdi)
addl %esi, 0x38(%rdi)
movq 0x28(%rdi), %rsi
movslq %edx, %r9
movq $-0x1, %r8
cmpq $-0x1, (%rsi,%r9,8)
jne 0x3b67
movl $0xffffffff, 0x40(%rdi) # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rax, %r8
testl %ecx, %ecx
jle 0x3b86
xorl %eax, %eax
movq (%rsi,%rax,8), %r9
cmpq %r8, %r9
jae 0x3b7e
movl %eax, 0x40(%rdi)
movl %eax, %edx
movq %r9, %r8
incq %rax
cmpq %rax, %rcx
jne 0x3b6d
movb $0x1, %al
cmpl $-0x1, %edx
jne 0x3b93
movb $0x1, 0x44(%rdi)
movb $0x1, %al
popq %rcx
retq
leaq 0x2f3e(%rip), %rdi      # 0x6ada
leaq 0x2eee(%rip), %rsi      # 0x6a91
leaq 0x2f39(%rip), %rcx      # 0x6ae3
movl $0x79, %edx
callq 0x10c0