// File: /workspace/github_cpp_makefile_star2_O1/prakhar2808[P]DBEngine/dbengine/sstable.cc
// Function: sstable::loadIndexInMemory()
void sstable::loadIndexInMemory() {
  std::ifstream readfd;
  std::string indexFilePath = filePath + ".index";
  readfd.open(indexFilePath);
  readfd >> std::noskipws;
  unsigned char ch;
  long long offset;
  while(readfd.peek() != EOF) {
    // Length of key
    readfd >> ch;
    std::string key((int)ch, '\0');
    // The key
    readfd.read(&key[0], (int)ch);
    std::cout << "Index : Read key " << key;
    // Length of offset
    readfd >> ch;
    offset = 0;
    // The offset
    std::string offsetStr((int)ch, '\0');
    readfd.read(&offsetStr[0], (int)ch);
    // Converting offset to long long from string
    for(int i = 0; i < (int)ch; i++) {
      offset = offset * 10 + (long long)(offsetStr[i] - '0');
    }
    std::cout << " Offset = " << offset << std::endl; 
    index[key] = offset;
  }
  readfd.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdi, %rbx
leaq 0x70(%rsp), %rdi
callq 0x5420
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rbx), %rsi
movq %rbx, 0x68(%rsp)
movq 0x40(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x6924
leaq 0x4de9(%rip), %rsi      # 0x1c543
leaq 0x8(%rsp), %rdi
callq 0x56f0
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq 0x5320
leaq 0x70(%rsp), %r14
movq (%r14), %rax
movq -0x18(%rax), %rax
andl $0xffffefff, 0x88(%rsp,%rax) # imm = 0xFFFFEFFF
leaq 0x38(%rsp), %r15
leaq 0x58(%rsp), %rbx
leaq 0x7(%rsp), %r13
movq %r14, %rdi
callq 0x5190
cmpl $-0x1, %eax
je 0x1791a
movq %r14, %rdi
movq %r13, %rsi
callq 0x54c0
movzbl 0x7(%rsp), %esi
movq %r15, 0x28(%rsp)
leaq 0x28(%rsp), %rdi
xorl %edx, %edx
callq 0x5450
movq 0x28(%rsp), %rsi
movzbl 0x7(%rsp), %edx
movq %r14, %rdi
callq 0x5490
movl $0x11, %edx
movq 0xe7d2(%rip), %rdi      # 0x25fc0
leaq 0x4d00(%rip), %rsi      # 0x1c4f5
callq 0x5430
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0xe7b5(%rip), %rdi      # 0x25fc0
callq 0x5430
movq %r14, %rdi
movq %r13, %rsi
callq 0x54c0
movzbl 0x7(%rsp), %esi
movq %rbx, %r12
movq %rbx, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
xorl %edx, %edx
callq 0x5450
movq 0x48(%rsp), %rsi
movzbl 0x7(%rsp), %edx
movq %r14, %rdi
callq 0x5490
movzbl 0x7(%rsp), %eax
testq %rax, %rax
je 0x1787b
movq 0x48(%rsp), %rcx
xorl %edx, %edx
xorl %ebp, %ebp
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
movsbq (%rcx,%rdx), %rdi
leaq (%rdi,%rsi,2), %rbp
addq $-0x30, %rbp
incq %rdx
cmpq %rdx, %rax
jne 0x17859
jmp 0x1787d
xorl %ebp, %ebp
movl $0xa, %edx
movq 0xe737(%rip), %rdi      # 0x25fc0
leaq 0x4c77(%rip), %rsi      # 0x1c507
callq 0x5430
movq 0xe724(%rip), %rdi      # 0x25fc0
movq %rbp, %rsi
callq 0x5160
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5370
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x5280
movq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x18570
movq %rbp, (%rax)
movq 0x48(%rsp), %rdi
movq %r12, %rbx
cmpq %r12, %rdi
je 0x178fa
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x1779e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x1779e
leaq 0x70(%rsp), %rdi
callq 0x50b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x17940
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
leaq 0x70(%rsp), %rdi
callq 0x50d0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1796b
jmp 0x1796b
jmp 0x1796b
movq %rax, %rbx
jmp 0x179c2
jmp 0x17970
jmp 0x1796b
movq %rax, %rbx
jmp 0x179a6
movq %rax, %rbx
jmp 0x1798f
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x1798f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x179a6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x179c2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
leaq 0x70(%rsp), %rdi
callq 0x50d0
movq %rbx, %rdi
callq 0x5670