// File: roberto-bayardo[P]google-extremal-sets/all-maximal-sets-lexicographic.cc
// Function: google_extremal_sets::AllMaximalSetsLexicographic::DeleteSubsumedFromRange(__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 const*, unsigned int)
void AllMaximalSetsLexicographic::DeleteSubsumedFromRange(
    CandidateList::iterator begin_range_it,
    CandidateList::iterator end_range_it,
    const uint32_t* current_set_it,
    unsigned int depth) {
  assert(begin_range_it != end_range_it);
  DeleteSubsumedSets(&begin_range_it, end_range_it, depth);
  if (begin_range_it == end_range_it || current_set_it == current_set_->end())
    return;

  do {  // while (begin_range_it != end_range_it)
    // First thing we do is find the next item in the current_set
    // that, if added to our prefix, could potentially subsume some
    // candidate within the remaining range.
    uint32_t candidate_item = (**begin_range_it)[depth];
    assert(current_set_it != current_set_->end());
    if (*current_set_it < candidate_item) {
      current_set_it = std::lower_bound(
          current_set_it, current_set_->end(), candidate_item);
    }
    if (current_set_it == current_set_->end())
      return;

    assert(*current_set_it >= candidate_item);

    if (*current_set_it == candidate_item) {
      // The item we found matches the next candidate set item, which
      // means we can extend the prefix. Before we recurse, we must
      // compute an end range for the extended prefix.
      CandidateList::iterator new_end_range_it = GetNewEndRangeIt(
          begin_range_it, end_range_it, candidate_item, depth);
      assert(new_end_range_it >= begin_range_it);
      if (begin_range_it != new_end_range_it) {
        DeleteSubsumedFromRange(
            begin_range_it, new_end_range_it, current_set_it + 1, depth + 1);
      }
      begin_range_it = new_end_range_it;
      while (begin_range_it != end_range_it && !*begin_range_it)
        ++begin_range_it;
    } else {
      // Advance the begin_range until we reach potentially subsumable candidates.
      begin_range_it = GetNewBeginRangeIt(
          begin_range_it, end_range_it, *current_set_it, depth);
    }
  } while (begin_range_it != end_range_it);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3cd0
testb $0x1, %al
jne 0x31ca
jmp 0x31cc
jmp 0x31eb
leaq 0x6068(%rip), %rdi      # 0x923b
leaq 0x5f63(%rip), %rsi      # 0x913d
movl $0x158, %edx            # imm = 0x158
leaq 0x6074(%rip), %rcx      # 0x925a
callq 0x2140
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %rdx
leaq -0x8(%rbp), %rsi
callq 0x3d10
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3e50
testb $0x1, %al
jne 0x323f
movq -0x80(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq 0x48(%rax), %rdi
callq 0x3e90
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jne 0x3244
jmp 0x3491
jmp 0x3246
leaq -0x8(%rbp), %rdi
callq 0x3eb0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
callq 0x3ed0
movl %eax, %ecx
movq -0x80(%rbp), %rax
movl %ecx, -0x34(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, -0x90(%rbp)
movq 0x48(%rax), %rdi
callq 0x3e90
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
je 0x3288
jmp 0x32a7
leaq 0x606d(%rip), %rdi      # 0x92fc
leaq 0x5ea7(%rip), %rsi      # 0x913d
movl $0x162, %edx            # imm = 0x162
leaq 0x5fb8(%rip), %rcx      # 0x925a
callq 0x2140
movq -0x20(%rbp), %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
jae 0x32e1
movq -0x80(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq 0x48(%rax), %rdi
callq 0x3e90
movq -0x98(%rbp), %rdi
movq %rax, %rsi
leaq -0x34(%rbp), %rdx
callq 0x3ef0
movq %rax, -0x20(%rbp)
movq -0x80(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x48(%rax), %rdi
callq 0x3e90
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jne 0x330d
jmp 0x3491
movq -0x20(%rbp), %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
jb 0x331a
jmp 0x3339
leaq 0x6001(%rip), %rdi      # 0x9322
leaq 0x5e15(%rip), %rsi      # 0x913d
movl $0x16a, %edx            # imm = 0x16A
leaq 0x5f26(%rip), %rcx      # 0x925a
callq 0x2140
movq -0x20(%rbp), %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x3443
movq -0x80(%rbp), %rdi
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x34(%rbp), %ecx
movl -0x24(%rbp), %r8d
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x3f40
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x4060
testb $0x1, %al
jne 0x3387
jmp 0x3389
jmp 0x33a8
leaq 0x5fb4(%rip), %rdi      # 0x9344
leaq 0x5da6(%rip), %rsi      # 0x913d
movl $0x172, %edx            # imm = 0x172
leaq 0x5eb7(%rip), %rcx      # 0x925a
callq 0x2140
leaq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3cd0
testb $0x1, %al
jne 0x33bb
jmp 0x33ec
movq -0x80(%rbp), %rdi
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rcx
addq $0x4, %rcx
movl -0x24(%rbp), %r8d
addl $0x1, %r8d
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x3190
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3cd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xa1(%rbp)
jne 0x3412
jmp 0x342a
leaq -0x8(%rbp), %rdi
callq 0x3eb0
cmpq $0x0, (%rax)
setne %al
xorb $-0x1, %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x3436
jmp 0x3441
leaq -0x8(%rbp), %rdi
callq 0x40a0
jmp 0x33f4
jmp 0x347a
movq -0x80(%rbp), %rdi
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movl -0x24(%rbp), %r8d
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x40c0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x347c
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3cd0
testb $0x1, %al
jne 0x3246
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)