// File: migueeelvargas[P]Auto-Complete/test.cpp
// Function: main
int main(int argc, char* argv[]) {
  int mode = 0;
  
  if (strcmp(argv[1], "ht") == 0)
    mode = 1;
  else if(strcmp(argv[1], "trie") == 0)
    mode = 2;

  DictionaryBST* dictionaryBST = new DictionaryBST();
  DictionaryHashtable* dictionaryHT = new DictionaryHashtable();
  DictionaryTrie* dictionaryTrie = new DictionaryTrie();

  std::vector<std::string> words;
  std::vector<std::string> wordsNotIn;

  // words.push_back("basketball");
  // words.push_back("basket");
  // words.push_back("ball");
  // words.push_back("basement");

  words.push_back("b");
  words.push_back("bb");
  words.push_back("bbb bbb");
  words.push_back("c");
  words.push_back("ddd");
  words.push_back("dd dd dd");
  words.push_back("d");
  // words.push_back("miguel");
  // words.push_back("miguel");

  wordsNotIn.push_back("base");
  wordsNotIn.push_back("ba");
  wordsNotIn.push_back("bas");


  if (mode == 0) {
    std::cout << "Mode: BST" << std::endl << std::endl;
    modeBST(dictionaryBST, words);
  }
  else if (mode == 1) {
    std::cout << "Mode: Hashtable" << std::endl << std::endl;
    modeHT(dictionaryHT, words);
  }

  else {
    std::cout << "Mode: Trie" << std::endl << std::endl;
    modeTrie(dictionaryTrie, words, wordsNotIn);
  }

  delete(dictionaryBST);
  delete(dictionaryHT);
  delete(dictionaryTrie);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x8aa5(%rip), %rsi      # 0xb004
callq 0x2280
cmpl $0x0, %eax
jne 0x2572
movl $0x1, -0x14(%rbp)
jmp 0x2594
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x8a86(%rip), %rsi      # 0xb007
callq 0x2280
cmpl $0x0, %eax
jne 0x2592
movl $0x2, -0x14(%rbp)
jmp 0x2594
movl $0x30, %edi
callq 0x21b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x208(%rbp)
callq 0x6eb0
jmp 0x25b2
movq -0x208(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x38, %edi
callq 0x21b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x210(%rbp)
callq 0x53a0
jmp 0x25db
movq -0x210(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x10, %edi
callq 0x21b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x218(%rbp)
callq 0x7fd0
jmp 0x2604
movq -0x218(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4280
leaq -0x70(%rbp), %rdi
callq 0x4280
leaq -0x91(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x22f0
movq -0x220(%rbp), %rdx
leaq 0x89d0(%rip), %rsi      # 0xb012
leaq -0x90(%rbp), %rdi
callq 0x42d0
jmp 0x2650
leaq -0x58(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x42a0
jmp 0x2662
leaq -0x90(%rbp), %rdi
callq 0x2100
leaq -0x91(%rbp), %rdi
callq 0x2210
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x22f0
movq -0x228(%rbp), %rdx
leaq 0x8976(%rip), %rsi      # 0xb011
leaq -0xb8(%rbp), %rdi
callq 0x42d0
jmp 0x26a9
leaq -0x58(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x42a0
jmp 0x26bb
leaq -0xb8(%rbp), %rdi
callq 0x2100
leaq -0xb9(%rbp), %rdi
callq 0x2210
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x22f0
movq -0x230(%rbp), %rdx
leaq 0x8918(%rip), %rsi      # 0xb00c
leaq -0xe0(%rbp), %rdi
callq 0x42d0
jmp 0x2702
leaq -0x58(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x42a0
jmp 0x2714
leaq -0xe0(%rbp), %rdi
callq 0x2100
leaq -0xe1(%rbp), %rdi
callq 0x2210
leaq -0x109(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x22f0
movq -0x238(%rbp), %rdx
leaq 0x88c7(%rip), %rsi      # 0xb014
leaq -0x108(%rbp), %rdi
callq 0x42d0
jmp 0x275b
leaq -0x58(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42a0
jmp 0x276d
leaq -0x108(%rbp), %rdi
callq 0x2100
leaq -0x109(%rbp), %rdi
callq 0x2210
leaq -0x131(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x22f0
movq -0x240(%rbp), %rdx
leaq 0x8870(%rip), %rsi      # 0xb016
leaq -0x130(%rbp), %rdi
callq 0x42d0
jmp 0x27b4
leaq -0x58(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x42a0
jmp 0x27c6
leaq -0x130(%rbp), %rdi
callq 0x2100
leaq -0x131(%rbp), %rdi
callq 0x2210
leaq -0x159(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x22f0
movq -0x248(%rbp), %rdx
leaq 0x881b(%rip), %rsi      # 0xb01a
leaq -0x158(%rbp), %rdi
callq 0x42d0
jmp 0x280d
leaq -0x58(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x42a0
jmp 0x281f
leaq -0x158(%rbp), %rdi
callq 0x2100
leaq -0x159(%rbp), %rdi
callq 0x2210
leaq -0x181(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x22f0
movq -0x250(%rbp), %rdx
leaq 0x87c9(%rip), %rsi      # 0xb021
leaq -0x180(%rbp), %rdi
callq 0x42d0
jmp 0x2866
leaq -0x58(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x42a0
jmp 0x2878
leaq -0x180(%rbp), %rdi
callq 0x2100
leaq -0x181(%rbp), %rdi
callq 0x2210
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x22f0
movq -0x258(%rbp), %rdx
leaq 0x8772(%rip), %rsi      # 0xb023
leaq -0x1a8(%rbp), %rdi
callq 0x42d0
jmp 0x28bf
leaq -0x70(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x42a0
jmp 0x28d1
leaq -0x1a8(%rbp), %rdi
callq 0x2100
leaq -0x1a9(%rbp), %rdi
callq 0x2210
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x22f0
movq -0x260(%rbp), %rdx
leaq 0x871e(%rip), %rsi      # 0xb028
leaq -0x1d0(%rbp), %rdi
callq 0x42d0
jmp 0x2918
leaq -0x70(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x42a0
jmp 0x292a
leaq -0x1d0(%rbp), %rdi
callq 0x2100
leaq -0x1d1(%rbp), %rdi
callq 0x2210
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x22f0
movq -0x268(%rbp), %rdx
leaq 0x86c8(%rip), %rsi      # 0xb02b
leaq -0x1f8(%rbp), %rdi
callq 0x42d0
jmp 0x2971
leaq -0x70(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x42a0
jmp 0x2983
leaq -0x1f8(%rbp), %rdi
callq 0x2100
leaq -0x1f9(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x14(%rbp)
jne 0x2ca3
movq 0xe62c(%rip), %rdi      # 0x10fd8
leaq 0x867c(%rip), %rsi      # 0xb02f
callq 0x21a0
movq %rax, -0x270(%rbp)
jmp 0x29c1
movq -0x270(%rbp), %rdi
movq 0xe5f9(%rip), %rsi      # 0x10fc8
callq 0x21e0
movq %rax, -0x278(%rbp)
jmp 0x29dd
movq -0x278(%rbp), %rdi
movq 0xe5dd(%rip), %rsi      # 0x10fc8
callq 0x21e0
jmp 0x29f2
movq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2e40
jmp 0x2a01
jmp 0x2d6b
movq -0x208(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x30, %esi
callq 0x21c0
jmp 0x2e2c
movq -0x210(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x38, %esi
callq 0x21c0
jmp 0x2e2c
movq -0x218(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x21c0
jmp 0x2e2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2a92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2100
leaq -0x91(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2ac9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2100
leaq -0xb9(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2b00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2100
leaq -0xe1(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2b37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x2100
leaq -0x109(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2b6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x2100
leaq -0x131(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2ba5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x2100
leaq -0x159(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x2100
leaq -0x181(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2c13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x2100
leaq -0x1a9(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2c4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x2100
leaq -0x1d1(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2c81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x2100
leaq -0x1f9(%rbp), %rdi
callq 0x2210
jmp 0x2e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2e1a
cmpl $0x1, -0x14(%rbp)
jne 0x2d07
movq 0xe328(%rip), %rdi      # 0x10fd8
leaq 0x8382(%rip), %rsi      # 0xb039
callq 0x21a0
movq %rax, -0x280(%rbp)
jmp 0x2cc5
movq -0x280(%rbp), %rdi
movq 0xe2f5(%rip), %rsi      # 0x10fc8
callq 0x21e0
movq %rax, -0x288(%rbp)
jmp 0x2ce1
movq -0x288(%rbp), %rdi
movq 0xe2d9(%rip), %rsi      # 0x10fc8
callq 0x21e0
jmp 0x2cf6
movq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3310
jmp 0x2d05
jmp 0x2d69
movq 0xe2ca(%rip), %rdi      # 0x10fd8
leaq 0x8334(%rip), %rsi      # 0xb049
callq 0x21a0
movq %rax, -0x290(%rbp)
jmp 0x2d23
movq -0x290(%rbp), %rdi
movq 0xe297(%rip), %rsi      # 0x10fc8
callq 0x21e0
movq %rax, -0x298(%rbp)
jmp 0x2d3f
movq -0x298(%rbp), %rdi
movq 0xe27b(%rip), %rsi      # 0x10fc8
callq 0x21e0
jmp 0x2d54
movq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x3740
jmp 0x2d67
jmp 0x2d69
jmp 0x2d6b
movq -0x20(%rbp), %rax
movq %rax, -0x2a0(%rbp)
cmpq $0x0, %rax
je 0x2d99
movq -0x2a0(%rbp), %rdi
callq 0x6fd0
movq -0x2a0(%rbp), %rdi
movl $0x30, %esi
callq 0x21c0
movq -0x38(%rbp), %rax
movq %rax, -0x2a8(%rbp)
cmpq $0x0, %rax
je 0x2dc7
movq -0x2a8(%rbp), %rdi
callq 0x54c0
movq -0x2a8(%rbp), %rdi
movl $0x38, %esi
callq 0x21c0
movq -0x40(%rbp), %rax
movq %rax, -0x2b0(%rbp)
cmpq $0x0, %rax
je 0x2df5
movq -0x2b0(%rbp), %rdi
callq 0x7ff0
movq -0x2b0(%rbp), %rdi
movl $0x10, %esi
callq 0x21c0
movl $0x0, -0x4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4380
leaq -0x58(%rbp), %rdi
callq 0x4380
movl -0x4(%rbp), %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x4380
leaq -0x58(%rbp), %rdi
callq 0x4380
movq -0x28(%rbp), %rdi
callq 0x22e0
nopw %cs:(%rax,%rax)