// File: roberto-bayardo[P]google-extremal-sets/main-lexicographic.cc
// Function: main
int main(int argc, char** argv) {
  time_t start_time;
  time(&start_time);

  // Verify input arguments.
  if (argc != 2) {
    std::cerr << "ERROR: Usage is: ./ams-lexicographic <dataset_path>\n";
    return 1;
  }

  {
    std::auto_ptr<DataSourceIterator> data(DataSourceIterator::Get(argv[1]));
    if (!data.get())
      return 2;

    google_extremal_sets::AllMaximalSetsLexicographic ap;
    ap.SetMaxItemsInRam(1000000000);
    ap.SetOutputMode(google_extremal_sets::COUNT_ONLY);
    //ap.SetOutputMode(google_extremal_sets::ID_AND_ITEMS);

    bool result = ap.FindAllMaximalSets(data.get(), 8000000/*max_item_id*/);

    if (!result) {
      std::cerr << "IO ERROR: " << data->GetErrorMessage() << "\n";
      return 3;
    }

    std::cerr << "; Found " << ap.MaximalSetsCount() << " maximal itemsets.\n"
              << "; Number of itemsets in the input: " << ap.InputSetsCount()
              << "\n"
              << "; Number of candidate seeks performed: "
              << ap.CandidateSeekCount() << "\n";
  }

  time_t end_time;
  time(&end_time);
  std::cerr << "; Total running time: " << (end_time - start_time)
            << " seconds" << std::endl;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x21e0
cmpl $0x2, -0x8(%rbp)
je 0x5fc7
movq 0x8041(%rip), %rdi      # 0xdff0
leaq 0x377c(%rip), %rsi      # 0x9732
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x6315
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x68b0
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x6330
leaq -0x20(%rbp), %rdi
callq 0x6350
cmpq $0x0, %rax
jne 0x6002
movl $0x2, -0x4(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x6291
leaq -0x88(%rbp), %rdi
callq 0x6370
jmp 0x6010
leaq -0x88(%rbp), %rdi
movl $0x3b9aca00, %esi       # imm = 0x3B9ACA00
callq 0x63c0
jmp 0x6023
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0x63e0
jmp 0x6033
leaq -0x20(%rbp), %rdi
callq 0x6350
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
movl $0x7a1200, %edx         # imm = 0x7A1200
callq 0x2600
movb %al, -0xc1(%rbp)
jmp 0x6058
movb -0xc1(%rbp), %al
andb $0x1, %al
movb %al, -0x95(%rbp)
testb $0x1, -0x95(%rbp)
jne 0x614a
movq 0x7f76(%rip), %rdi      # 0xdff0
leaq 0x36e6(%rip), %rsi      # 0x9767
callq 0x2200
movq %rax, -0xd0(%rbp)
jmp 0x608f
leaq -0x20(%rbp), %rdi
callq 0x6400
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x6420
jmp 0x60a9
movq -0xd0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x21d0
movq %rax, -0xd8(%rbp)
jmp 0x60c5
movq -0xd8(%rbp), %rdi
leaq 0x2faa(%rip), %rsi      # 0x907d
callq 0x2200
jmp 0x60da
leaq -0xb8(%rbp), %rdi
callq 0x2130
movl $0x3, -0x4(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x6285
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x630a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x62fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2130
jmp 0x62fe
movq 0x7e9f(%rip), %rdi      # 0xdff0
leaq 0x361a(%rip), %rsi      # 0x9772
callq 0x2200
movq %rax, -0xe0(%rbp)
jmp 0x6166
leaq -0x88(%rbp), %rdi
callq 0x6450
movq %rax, -0xe8(%rbp)
jmp 0x617b
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0x23a0
movq %rax, -0xf0(%rbp)
jmp 0x6197
movq -0xf0(%rbp), %rdi
leaq 0x2ec6(%rip), %rsi      # 0x906b
callq 0x2200
movq %rax, -0xf8(%rbp)
jmp 0x61b3
movq -0xf8(%rbp), %rdi
leaq 0x35ba(%rip), %rsi      # 0x977b
callq 0x2200
movq %rax, -0x100(%rbp)
jmp 0x61cf
leaq -0x88(%rbp), %rdi
callq 0x6470
movq %rax, -0x108(%rbp)
jmp 0x61e4
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdi
callq 0x2100
movq %rax, -0x110(%rbp)
jmp 0x6200
movq -0x110(%rbp), %rdi
leaq 0x2e6f(%rip), %rsi      # 0x907d
callq 0x2200
movq %rax, -0x118(%rbp)
jmp 0x621c
movq -0x118(%rbp), %rdi
leaq 0x3575(%rip), %rsi      # 0x979f
callq 0x2200
movq %rax, -0x120(%rbp)
jmp 0x6238
leaq -0x88(%rbp), %rdi
callq 0x6490
movq %rax, -0x128(%rbp)
jmp 0x624d
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdi
callq 0x2100
movq %rax, -0x130(%rbp)
jmp 0x6269
movq -0x130(%rbp), %rdi
leaq 0x2e06(%rip), %rsi      # 0x907d
callq 0x2200
jmp 0x627e
movl $0x0, -0x24(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x64b0
leaq -0x20(%rbp), %rdi
callq 0x64e0
movl -0x24(%rbp), %eax
testl %eax, %eax
je 0x62a5
jmp 0x62a3
jmp 0x6315
leaq -0xc0(%rbp), %rdi
callq 0x21e0
movq 0x7d38(%rip), %rdi      # 0xdff0
leaq 0x3508(%rip), %rsi      # 0x97c7
callq 0x2200
movq %rax, %rdi
movq -0xc0(%rbp), %rsi
subq -0x18(%rbp), %rsi
callq 0x23a0
movq %rax, %rdi
leaq 0x34fd(%rip), %rsi      # 0x97de
callq 0x2200
movq %rax, %rdi
movq 0x7cc8(%rip), %rsi      # 0xdfb8
callq 0x2240
movl $0x0, -0x4(%rbp)
jmp 0x6315
leaq -0x88(%rbp), %rdi
callq 0x64b0
leaq -0x20(%rbp), %rdi
callq 0x64e0
jmp 0x6321
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x2370
nopl (%rax)