// File: /workspace/github_cpp_makefile_star2_O3/roberto-bayardo[P]google-extremal-sets/all-maximal-sets-lexicographic.cc
// Function: google_extremal_sets::AllMaximalSetsLexicographic::FindAllMaximalSets(google_extremal_sets::DataSourceIterator*, unsigned int)
bool AllMaximalSetsLexicographic::FindAllMaximalSets(DataSourceIterator* data, uint32_t) {
  Init();

  // Vars set by the data source iterator.
  int result;
  uint32_t set_id;
  ItemSet current_set;

  // This outer loop supports multiple passes over the data in the
  // case where the dataset exceeds the bound on max_items_in_ram_. As
  // long as resume_offset == 0, we will continue retaining itemsets
  // in RAM.
  off_t start_offset = 0;
  off_t resume_offset = 0;
  do {  // while (resume_offset != 0)
    if (!PrepareForDataScan(data, resume_offset))
      return false;  // IO error
    start_offset = resume_offset;

    if (!ReadNextChunk(data, &resume_offset))
      return false;  // IO error

    DeleteTriviallySubsumedCandidates();

    BuildIndex();

    std::cerr << "; Potential maximal sets: " << candidates_.size() << '\n'
              << "; Beginning subsumption checking scan." << std::endl;
    for (unsigned int i = 0; i < candidates_.size() - 1; ++i) {
      if (candidates_[i])  // check to make sure not already deleted.
        DeleteSubsumedCandidates(i);
    }
    if (start_offset != 0) {
      if (!PrepareForDataScan(data, 0))
        return false;  // IO error
      while (data->Tell() < start_offset &&
             (result = data->Next(&set_id, &current_set)) > 0) {
        DeleteSubsumedCandidates(current_set);
      }
      if (result < 0)  // IO error
        return false;
    }
    std::cerr << "; Dumping maximal sets." << std::endl;
    DumpMaximalSets();
  } while (resume_offset != 0);
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x26c6
xorl %r13d, %r13d
leaq 0x20(%rsp), %r15
movq %r13, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x10(%rsp), %rax
movq %r13, (%rax)
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2746
testb %al, %al
je 0x2675
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
callq 0x27b2
testb %al, %al
je 0x2675
movq %r14, %rdi
callq 0x291a
movq %r14, %rdi
callq 0x29f6
movl $0x1a, %edx
movq 0x5ae9(%rip), %rdi      # 0x7ff0
leaq 0x2af6(%rip), %rsi      # 0x5004
callq 0x21e0
movq 0x20(%r14), %rsi
subq 0x18(%r14), %rsi
sarq $0x3, %rsi
movq 0x5aca(%rip), %rdi      # 0x7ff0
callq 0x20f0
movb $0xa, 0xf(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xf(%rsp), %rsi
callq 0x21e0
movq %rax, %rbp
movl $0x26, %edx
movq %rax, %rdi
leaq 0x2acb(%rip), %rsi      # 0x501f
callq 0x21e0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x8, %rdx
je 0x25c4
xorl %ebp, %ebp
cmpq $0x0, (%rax,%rbp,8)
je 0x25b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2b0a
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
incl %ebp
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
decq %rdx
cmpq %rbp, %rdx
ja 0x2597
testq %r13, %r13
je 0x2611
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2746
testb %al, %al
je 0x2675
movq %rbx, %rdi
callq 0x3b18
cmpq %r13, %rax
jge 0x260c
movq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
movq %r15, %rdx
callq 0x3b20
movl %eax, %r12d
testl %eax, %eax
jle 0x260c
movq %r14, %rdi
movq %r15, %rsi
callq 0x2b5c
jmp 0x25db
testl %r12d, %r12d
js 0x2675
movl $0x17, %edx
movq 0x59d3(%rip), %rdi      # 0x7ff0
leaq 0x2a22(%rip), %rsi      # 0x5046
callq 0x21e0
movq 0x59c0(%rip), %rcx      # 0x7ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x59a2(%rip), %rdi      # 0x7ff0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2b9a
movq 0x10(%rsp), %r13
testq %r13, %r13
jne 0x24c0
movb $0x1, %bl
jmp 0x2677
xorl %ebx, %ebx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x268e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x26a3
jmp 0x26a3
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x26bd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270
nop