// File: migueeelvargas[P]Auto-Complete/util.cpp
// Function: Utils::load_dict(DictionaryBST&, std::istream&, unsigned int)
void Utils::load_dict(DictionaryBST& dict, istream& words, unsigned int num_words)
{
  string junk;
  string data = "";
  string temp_word = "";
  string word = "";
  vector<string> word_string;
  unsigned int i = 0;
  unsigned int j = 0;

  for(; j < num_words; j++)
    {
      getline(words, data);
      if(words.eof()) break;
      temp_word = "";
      word = "";
      data = data + " .";
      istringstream iss(data);
      iss >> junk;
      while(1)
        {
          iss >> temp_word;
          if(temp_word == ".") break;
          if(temp_word.length() > 0) word_string.push_back(temp_word);
        }
      for(i = 0; i < word_string.size(); i++)
        {
          if(i > 0) word = word + " ";
          word = word + word_string[i];
        }
      dict.insert(word);
      word_string.clear();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3340
leaq -0x59(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x33d0
movq -0x2e8(%rbp), %rdx
leaq 0x6f9b(%rip), %rsi      # 0xe098
leaq -0x58(%rbp), %rdi
callq 0x4c60
jmp 0x7108
leaq -0x59(%rbp), %rdi
callq 0x3280
leaq -0x91(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x33d0
movq -0x2f0(%rbp), %rdx
leaq 0x6f66(%rip), %rsi      # 0xe098
leaq -0x90(%rbp), %rdi
callq 0x4c60
jmp 0x7140
leaq -0x91(%rbp), %rdi
callq 0x3280
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x33d0
movq -0x2f8(%rbp), %rdx
leaq 0x6f2b(%rip), %rsi      # 0xe098
leaq -0xb8(%rbp), %rdi
callq 0x4c60
jmp 0x717b
leaq -0xb9(%rbp), %rdi
callq 0x3280
leaq -0xd8(%rbp), %rdi
callq 0x4b30
movl $0x0, -0xdc(%rbp)
movl $0x0, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x74d9
movq -0x10(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3080
jmp 0x71c5
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33f0
movb %al, -0x2f9(%rbp)
jmp 0x71e0
movb -0x2f9(%rbp), %al
testb $0x1, %al
jne 0x71ec
jmp 0x7256
jmp 0x74d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x59(%rbp), %rdi
callq 0x3280
jmp 0x7545
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x3280
jmp 0x753c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x3280
jmp 0x7530
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7518
leaq 0x6e3b(%rip), %rsi      # 0xe098
leaq -0x90(%rbp), %rdi
callq 0x3330
jmp 0x726b
leaq 0x6e26(%rip), %rsi      # 0xe098
leaq -0xb8(%rbp), %rdi
callq 0x3330
jmp 0x7280
leaq 0x6e7a(%rip), %rdx      # 0xe101
leaq -0x100(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8840
jmp 0x7299
leaq -0x58(%rbp), %rdi
movq %rdi, -0x308(%rbp)
leaq -0x100(%rbp), %rsi
movq %rsi, -0x310(%rbp)
callq 0x32c0
movq -0x310(%rbp), %rdi
callq 0x3170
movq -0x308(%rbp), %rsi
leaq -0x280(%rbp), %rdi
movl $0x8, %edx
callq 0x33b0
jmp 0x72dd
leaq -0x280(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x32f0
jmp 0x72ef
jmp 0x72f1
jmp 0x72f3
leaq -0x280(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x32f0
jmp 0x7308
leaq 0x6df3(%rip), %rsi      # 0xe102
leaq -0x90(%rbp), %rdi
callq 0x88c0
movb %al, -0x311(%rbp)
jmp 0x7323
movb -0x311(%rbp), %al
testb $0x1, %al
jne 0x732f
jmp 0x7342
jmp 0x736d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x74cb
leaq -0x90(%rbp), %rdi
callq 0x3360
cmpq $0x0, %rax
jbe 0x736b
leaq -0xd8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x88f0
jmp 0x7369
jmp 0x736b
jmp 0x72f1
movl $0x0, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq %rax, -0x320(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movq -0x320(%rbp), %rax
cmpq %rcx, %rax
jae 0x7446
cmpl $0x0, -0xdc(%rbp)
jbe 0x73e7
leaq 0x6d51(%rip), %rdx      # 0xe104
leaq -0x2a0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x8840
jmp 0x73c8
leaq -0xb8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x32c0
leaq -0x2a0(%rbp), %rdi
callq 0x3170
movl -0xdc(%rbp), %eax
movl %eax, %esi
leaq -0xd8(%rbp), %rdi
callq 0x89e0
movq %rax, %rdx
leaq -0x2c0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x8960
jmp 0x7413
leaq -0xb8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x32c0
leaq -0x2c0(%rbp), %rdi
callq 0x3170
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x7377
movq -0x8(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0x2e0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x30f0
jmp 0x7466
movq -0x328(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0xae00
jmp 0x747b
leaq -0x2e0(%rbp), %rdi
callq 0x3170
leaq -0xd8(%rbp), %rdi
callq 0x8a00
leaq -0x280(%rbp), %rdi
callq 0x3120
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0x71a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x3170
leaq -0x280(%rbp), %rdi
callq 0x3120
jmp 0x7518
leaq -0xd8(%rbp), %rdi
callq 0x4b50
leaq -0xb8(%rbp), %rdi
callq 0x3170
leaq -0x90(%rbp), %rdi
callq 0x3170
leaq -0x58(%rbp), %rdi
callq 0x3170
leaq -0x38(%rbp), %rdi
callq 0x3170
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0xd8(%rbp), %rdi
callq 0x4b50
leaq -0xb8(%rbp), %rdi
callq 0x3170
leaq -0x90(%rbp), %rdi
callq 0x3170
leaq -0x58(%rbp), %rdi
callq 0x3170
leaq -0x38(%rbp), %rdi
callq 0x3170
movq -0x68(%rbp), %rdi
callq 0x33c0
nopw (%rax,%rax)