// File: roberto-bayardo[P]google-extremal-sets/all-maximal-sets-lexicographic.cc
// Function: _gnu_cxx::__normal_iterator<google_extremal_sets::SetProperties**, std::vector<google_extremal_sets::SetProperties*, std::allocator<google_extremal_sets::SetProperties*>>> google_extremal_sets::(anonymous namespace)::find_new_it<std::equal_to<unsigned int>>(__gnu_cxx::__normal_iterator<google_extremal_sets::SetProperties**, std::vector<google_extremal_sets::SetProperties*, std::allocator<google_extremal_sets::SetProperties*>>>, __gnu_cxx::__normal_iterator<google_extremal_sets::SetProperties**, std::vector<google_extremal_sets::SetProperties*, std::allocator<google_extremal_sets::SetProperties*>>>, unsigned int, unsigned int, std::equal_to<unsigned int>)
AllMaximalSetsLexicographic::CandidateList::iterator find_new_it(
    AllMaximalSetsLexicographic::CandidateList::iterator first,
    AllMaximalSetsLexicographic::CandidateList::iterator last,
    uint32_t current_item,
    unsigned int depth,
    Compare comp) {
  while (first != last && !*first)
    ++first;
  int len = last - first;
  int half;
  AllMaximalSetsLexicographic::CandidateList::iterator current;
  while (len > 0) {
    half = len >> 1;
    current = first + half;
    while (current < last && !*current)
      ++current;
    if (current == last) {
      len = half;
    } else if (comp(current_item, (**current)[depth])) {
      // Not far enough along yet!
      first += half + 1;
      len = len - half - 1;
      while (first < last && !*first) {
        ++first;
        --len;
      }
      if (first == last)
        return last;
    } else {
      // We may be too far along.
      len = half;
    }
  }
  assert(*first);
  return first;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3cd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x45(%rbp)
jne 0x3591
jmp 0x35a6
leaq -0x10(%rbp), %rdi
callq 0x3eb0
cmpq $0x0, (%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x35af
jmp 0x35ba
leaq -0x10(%rbp), %rdi
callq 0x40a0
jmp 0x3576
leaq -0x18(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x43a0
movl %eax, -0x28(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4310
cmpl $0x0, -0x28(%rbp)
jle 0x3728
movl -0x28(%rbp), %eax
sarl %eax
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x3c60
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x43e0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x46(%rbp)
jne 0x3619
jmp 0x362e
leaq -0x38(%rbp), %rdi
callq 0x3eb0
cmpq $0x0, (%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x46(%rbp)
movb -0x46(%rbp), %al
testb $0x1, %al
jne 0x3637
jmp 0x3642
leaq -0x38(%rbp), %rdi
callq 0x40a0
jmp 0x35fe
leaq -0x38(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3e50
testb $0x1, %al
jne 0x3655
jmp 0x3660
movl -0x2c(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x3723
leaq -0x38(%rbp), %rdi
callq 0x3eb0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
callq 0x3ed0
movl %eax, -0x44(%rbp)
leaq -0x19(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x4420
testb $0x1, %al
jne 0x3691
jmp 0x371b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x10(%rbp), %rdi
callq 0x4450
movl -0x28(%rbp), %eax
subl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x43e0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x47(%rbp)
jne 0x36ca
jmp 0x36df
leaq -0x10(%rbp), %rdi
callq 0x3eb0
cmpq $0x0, (%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x47(%rbp)
movb -0x47(%rbp), %al
testb $0x1, %al
jne 0x36e8
jmp 0x36fc
leaq -0x10(%rbp), %rdi
callq 0x40a0
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x36af
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3e50
testb $0x1, %al
jne 0x370f
jmp 0x3719
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3760
jmp 0x3721
movl -0x2c(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x3723
jmp 0x35d3
leaq -0x10(%rbp), %rdi
callq 0x3eb0
cmpq $0x0, (%rax)
je 0x3739
jmp 0x3758
leaq 0x5d72(%rip), %rdi      # 0x94b2
leaq 0x59f6(%rip), %rsi      # 0x913d
movl $0x46, %edx
leaq 0x5d66(%rip), %rcx      # 0x94b9
callq 0x2140
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)