// File: /workspace/github_cpp_makefile_star2_O3/roberto-bayardo[P]google-extremal-sets/all-maximal-sets-cardinality.cc
// Function: google_extremal_sets::AllMaximalSetsCardinality::DeleteSubsumedCandidates(std::vector<unsigned int, std::allocator<unsigned int>> const&)
void AllMaximalSetsCardinality::DeleteSubsumedCandidates(
    const std::vector<uint32_t>& current_set) {
  std::vector<uint32_t>::const_iterator current_begin = current_set.begin();
  std::vector<uint32_t>::const_iterator current_end = current_set.end();
  SetProperties* candidate = 0;
  for (unsigned int i = 0; i < current_set.size(); ++i, ++current_begin) {
    if (candidates_.size() <= current_set[i])
      return;
    CandidateList& candidates = candidates_[current_set[i]];
    int candidate_index = -1;
    while ((candidate =
           NextCandidate(
               candidates,
               current_set,
               i,
               &candidate_index))) {
      // We must explicitly check subsumption. We need not check every
      // item in each set because we already know:
      // (1) the candidate does not contain any items within
      // current_set[0] through current_set[i - 1].
      // (2) the candidate's first item is already known to be
      // the same as current_set[i].
      // We adjust the iterators accordingly.
      if (DoesSubsume(
             current_begin, current_end,
             candidate->begin() + 1, candidate->end())) {
        // Candidate is not maximal, so we delete it. Note that we
        // must preserve the cardinality based ordering, so we NULL
        // out the pointer to the deleted entry rather than performing
        // any swapping. TODO: Occasionally it might be beneficial to
        // compress out the holes left by the NULL entries if we have
        // accumulated a significant number of them.
        candidates[candidate_index] = 0;
        SetProperties::Delete(candidate);
      }
      ++subsumption_checks_count_;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq (%rsi), %rdx
movq %rsi, (%rsp)
movq 0x8(%rsi), %r14
cmpq %rdx, %r14
je 0x2935
xorl %r12d, %r12d
movabsq $0x100000000, %rbp      # imm = 0x100000000
movq %rdx, %r13
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rsi
movl (%rdx,%r12,4), %ecx
cmpq %rcx, %rsi
jbe 0x2935
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r8
movq $-0x1, %rbx
movq (%r8), %rax
movq 0x8(%r8), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movq %rbx, %rcx
shlq $0x20, %rcx
movslq %ebx, %rbx
leal 0x1(%rbx), %esi
cmpq %rsi, %rdx
je 0x2913
movq 0x8(%rax,%rbx,8), %rdi
addq %rbp, %rcx
incq %rbx
testq %rdi, %rdi
je 0x2835
movq %r8, 0x10(%rsp)
movq (%rsp), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
movq %rsi, %r9
subq %r12, %r9
movl 0x4(%rdi), %r8d
cmpq %r8, %r9
jb 0x2925
leaq 0x8(,%r8,4), %rdx
cmpq $0xc, %rdx
je 0x28ef
leaq (%rdi,%r8,4), %rdx
addq $0x8, %rdx
leaq 0xc(%rdi), %rsi
movq %r13, %r8
movq %r14, %r15
subq %r8, %r15
sarq $0x2, %r15
testq %r15, %r15
jle 0x28d5
movl (%rsi), %r9d
movq %r15, %r10
shrq %r10
movq %r10, %r11
notq %r11
addq %r15, %r11
leaq (%r8,%r10,4), %r15
addq $0x4, %r15
cmpl %r9d, -0x4(%r15)
cmovbq %r15, %r8
cmovaeq %r10, %r11
movq %r11, %r15
testq %r11, %r11
jg 0x28aa
cmpq %r14, %r8
je 0x2900
movl (%r8), %r9d
cmpl (%rsi), %r9d
ja 0x2900
addq $0x4, %r8
addq $0x4, %rsi
cmpq %rdx, %rsi
jne 0x2898
sarq $0x1d, %rcx
movq $0x0, (%rax,%rcx)
callq 0x417c
movq 0x8(%rsp), %rax
incq 0x10(%rax)
movq 0x10(%rsp), %r8
jmp 0x281d
movq (%rsp), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
incl %r12d
addq $0x4, %r13
cmpq %r12, %rsi
ja 0x27df
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq