// File: /workspace/github_c_makefile_star2_O1/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 0x366d
xorl %eax, %eax
jmp 0x38e5
testq %rsi, %rsi
je 0x38e7
testq %rdx, %rdx
je 0x38e7
movl 0x40(%rdi), %eax
addl 0x38(%rdi), %eax
movl %eax, (%rdx)
movl 0x40(%rdi), %r8d
cmpl 0x3c(%rdi), %r8d
jge 0x369a
movq (%rdi), %r8
addl 0x4(%r8), %eax
movl %eax, (%rdx)
movq 0x28(%rdi), %rdx
movslq 0x40(%rdi), %rax
movq (%rdx,%rax,8), %rdx
movq %rdx, (%rsi)
testq %rcx, %rcx
je 0x36b7
movq 0x30(%rdi), %rdx
movb (%rdx,%rax), %al
movb %al, (%rcx)
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
jae 0x38df
movq (%rsi), %rax
movslq 0x3c(%rdi), %rdx
cmpl %edx, 0x40(%rdi)
jge 0x37f4
movq (%rdi), %rcx
movl 0x4(%rcx), %esi
cmpl %esi, %edx
jge 0x375c
movq 0x8(%rdi), %r9
movq $-0x1, %rsi
cmpq 0x10(%rdi), %r9
jae 0x3741
movq 0x30(%rdi), %r8
movq 0x18(%rdi), %r10
movq 0x20(%rdi), %rsi
shlq $0x2, %r10
andq 0x8(%rcx), %r10
movsbq (%r9), %r11
orq %r10, %r11
movq %r11, 0x18(%rdi)
shrq $0x2, %rsi
movsbq (%r9), %r9
orq 0x28(%rcx,%r9,8), %rsi
movq %rsi, 0x20(%rdi)
movq 0x18(%rcx), %r9
imulq %r9, %r11
movb 0x10(%rcx), %cl
shrq %cl, %r11
imulq %r9, %rsi
shrq %cl, %rsi
cmpq %rsi, %r11
cmovbq %r11, %rsi
setb (%r8,%rdx)
movq 0x28(%rdi), %rcx
movq %rsi, (%rcx,%rdx,8)
incq 0x8(%rdi)
incq %rdx
movq (%rdi), %rcx
movslq 0x4(%rcx), %rsi
cmpq %rsi, %rdx
jl 0x36df
addl %esi, 0x38(%rdi)
cmpl $0x0, 0x40(%rdi)
js 0x387f
movq $-0x1, %rdx
movq 0x8(%rdi), %rcx
movq $-0x1, %r8
cmpq 0x10(%rdi), %rcx
jae 0x37d6
movq 0x30(%rdi), %rsi
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)
movq 0x18(%r9), %r11
imulq %r11, %r10
movb 0x10(%r9), %cl
shrq %cl, %r10
imulq %r11, %r8
shrq %cl, %r8
cmpq %r8, %r10
cmovbq %r10, %r8
setb 0x1(%rsi,%rdx)
movq 0x28(%rdi), %rcx
movq %r8, 0x8(%rcx,%rdx,8)
incq 0x8(%rdi)
movslq 0x40(%rdi), %rcx
incq %rdx
cmpq %rcx, %rdx
jl 0x3770
jmp 0x387f
cmpl 0x40(%rdi), %edx
jg 0x387f
decq %rdx
movq 0x8(%rdi), %rcx
movq $-0x1, %r8
cmpq 0x10(%rdi), %rcx
jae 0x3866
movq 0x30(%rdi), %rsi
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)
movq 0x18(%r9), %r11
imulq %r11, %r10
movb 0x10(%r9), %cl
shrq %cl, %r10
imulq %r11, %r8
shrq %cl, %r8
cmpq %r8, %r10
cmovbq %r10, %r8
setb 0x1(%rsi,%rdx)
movq 0x28(%rdi), %rcx
movq %r8, 0x8(%rcx,%rdx,8)
incq 0x8(%rdi)
movslq 0x40(%rdi), %rcx
incq %rdx
cmpq %rcx, %rdx
jl 0x3800
movslq 0x40(%rdi), %r8
leal 0x1(%r8), %edx
movl %edx, 0x3c(%rdi)
movq (%rdi), %rcx
movl 0x4(%rcx), %ecx
cmpl %ecx, %edx
jne 0x389e
movl $0x0, 0x3c(%rdi)
addl %ecx, 0x38(%rdi)
movq 0x28(%rdi), %rdx
movq $-0x1, %rsi
cmpq $-0x1, (%rdx,%r8,8)
jne 0x38ba
movl $0xffffffff, 0x40(%rdi) # imm = 0xFFFFFFFF
movq %rax, %rsi
testl %ecx, %ecx
jle 0x38d7
xorl %eax, %eax
movq (%rdx,%rax,8), %r8
cmpq %rsi, %r8
jae 0x38cf
movl %eax, 0x40(%rdi)
movq %r8, %rsi
incq %rax
cmpq %rax, %rcx
jne 0x38c0
movb $0x1, %al
cmpl $-0x1, 0x40(%rdi)
jne 0x38e5
movb $0x1, 0x44(%rdi)
movb $0x1, %al
popq %rcx
retq
leaq 0x31cd(%rip), %rdi      # 0x6abb
leaq 0x317d(%rip), %rsi      # 0x6a72
leaq 0x31c8(%rip), %rcx      # 0x6ac4
movl $0x79, %edx
callq 0x10c0