// File: roberto-bayardo[P]google-extremal-sets/all-maximal-sets-satelite.cc
// Function: google_extremal_sets::AllMaximalSetsSateLite::FindAllMaximalSets(google_extremal_sets::DataSourceIterator*, unsigned int, unsigned int, google_extremal_sets::OutputModeEnum)
bool AllMaximalSetsSateLite::FindAllMaximalSets(
    DataSourceIterator* data,
    uint32_t max_item_id,
    uint32_t max_items_in_ram,
    OutputModeEnum output_mode) {
  Init();

  // Vars set by the data source iterator.
  int result;
  uint32_t set_id;
  std::vector<uint32_t> current_set;

  if (!PrepareForDataScan(data, max_item_id, 0))
    return false;  // IO error
  uint32_t items_in_ram = 0;
  CleanerUpper cleanup(&all_sets_);

  // This loop scans the input data from beginning to end and indexes
  // each candidate on the occurrs_ lists.
  while ((result = data->Next(&set_id, &current_set)) > 0) {
    SetProperties* index_me = SetProperties::Create(set_id, current_set);
    items_in_ram += current_set.size();
    all_sets_.push_back(index_me);
    if (items_in_ram >= max_items_in_ram) {
      std::cerr << "; ERROR: max_items_in_ram exceeded." << std::endl;
      return false;
    }
    ++input_sets_count_;
    for (unsigned int i = 0; i < index_me->size; ++i) {
      occurs_[index_me->item[i]].push_back(index_me);
    }
  }
  if (result != 0)
    return false;  // IO error

  std::cerr << "; Starting subsumption checking scan." << std::endl;
  for (unsigned int i = 0; i < all_sets_.size(); ++i) {
    if (!IsSubsumed(*all_sets_[i]))
      FoundMaximalSet(*(all_sets_[i]), output_mode);
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x2900
leaq -0x48(%rbp), %rdi
callq 0x2d00
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2930
movb %al, -0x79(%rbp)
jmp 0x2652
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x267c
jmp 0x265b
movb $0x0, -0x1(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x28d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x28eb
movq -0x88(%rbp), %rsi
movl $0x0, -0x5c(%rbp)
addq $0x18, %rsi
leaq -0x68(%rbp), %rdi
callq 0x29b0
jmp 0x2699
jmp 0x269b
movq -0x18(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x53e0
movl %eax, -0x8c(%rbp)
jmp 0x26b4
movl -0x8c(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
jle 0x27d6
movl -0x2c(%rbp), %edi
leaq -0x48(%rbp), %rsi
callq 0x6d30
movq %rax, -0x98(%rbp)
jmp 0x26db
movq -0x98(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x2d20
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl -0x5c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
addq $0x18, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2d40
jmp 0x2710
movl -0x5c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jb 0x2773
movq 0x88d1(%rip), %rdi      # 0xaff0
leaq 0x48de(%rip), %rsi      # 0x7004
callq 0x2200
movq %rax, -0xa0(%rbp)
jmp 0x2734
movq -0xa0(%rbp), %rdi
movq 0x887e(%rip), %rsi      # 0xafc0
callq 0x2240
jmp 0x2749
movb $0x0, -0x1(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x28cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2bb0
jmp 0x28eb
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
movq -0x70(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x27d1
movq -0x88(%rbp), %rdi
addq $0x30, %rdi
movq -0x70(%rbp), %rax
movl -0x74(%rbp), %ecx
movl 0x8(%rax,%rcx,4), %eax
movl %eax, %esi
callq 0x2db0
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2d40
jmp 0x27c4
jmp 0x27c6
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x278d
jmp 0x269b
cmpl $0x0, -0x28(%rbp)
je 0x27ec
movb $0x0, -0x1(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x28cb
movq 0x87fd(%rip), %rdi      # 0xaff0
leaq 0x482e(%rip), %rsi      # 0x7028
callq 0x2200
movq %rax, -0xa8(%rbp)
jmp 0x2808
movq -0xa8(%rbp), %rdi
movq 0x87aa(%rip), %rsi      # 0xafc0
callq 0x2240
jmp 0x281d
movl $0x0, -0x78(%rbp)
movq -0x88(%rbp), %rdi
movl -0x78(%rbp), %eax
movq %rax, -0xb0(%rbp)
addq $0x18, %rdi
callq 0x2dd0
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jae 0x28c0
movq -0x88(%rbp), %rdi
addq $0x18, %rdi
movl -0x78(%rbp), %eax
movl %eax, %esi
callq 0x2df0
movq -0x88(%rbp), %rdi
movq (%rax), %rsi
callq 0x29d0
movb %al, -0xb1(%rbp)
jmp 0x2879
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x28b0
jmp 0x2885
movq -0x88(%rbp), %rdi
addq $0x18, %rdi
movl -0x78(%rbp), %eax
movl %eax, %esi
callq 0x2df0
movq -0x88(%rbp), %rdi
movq (%rax), %rsi
movl -0x24(%rbp), %edx
callq 0x2a90
jmp 0x28ae
jmp 0x28b0
jmp 0x28b2
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2824
movb $0x1, -0x1(%rbp)
movl $0x1, -0x58(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2bb0
leaq -0x48(%rbp), %rdi
callq 0x2e10
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x2e10
movq -0x50(%rbp), %rdi
callq 0x2370
nopl (%rax)