// File: /workspace/github_cpp_makefile_star2_O1/prakhar2808[P]DBEngine/dbengine/memtableWrapper.cc
// Function: memtableWrapper::getValueFromKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
opStatus memtableWrapper::getValueFromKey(std::string key, int clientSocket) {
  std::list<memtable*>::iterator iter;
  for(iter = index; iter != memtableObjPointersList.begin(); iter--) {
    if((*iter)->isKeyPresent(key)) {
      std::string val = (*iter)->getValueFromKey(key);
      if(val == "") {
        return opStatus::opKeyNotFound;
      }
      sendToClient(clientSocket, val);
      sendEndMsgToClient(clientSocket);
      return opStatus::opSuccess;
    }
  }

  // Checking in the memtable at the head of the list.
  if((*iter)->isKeyPresent(key)) {
    std::string val = (*iter)->getValueFromKey(key);
    if(val == "") {
      return opStatus::opKeyNotFound;
    }
    sendToClient(clientSocket, val);
    sendEndMsgToClient(clientSocket);
    return opStatus::opSuccess;
  }
  
  return opStatus::opFail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq 0x18(%rdi), %rbx
cmpq %rbx, (%rdi)
je 0x16fcb
movq %rdi, %r15
leaq 0x78(%rsp), %r12
movq 0x10(%rbx), %r13
movq %r12, 0x68(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rbp
movq %rbp, %rdi
callq 0x6924
movq %r13, %rdi
movq %rbp, %rsi
callq 0x15d06
movl %eax, %ebp
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x16fb9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5390
testb %bpl, %bpl
jne 0x170f4
movq 0x8(%rbx), %rbx
cmpq (%r15), %rbx
jne 0x16f75
movq 0x10(%rbx), %r15
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %r12
movq %r12, %rdi
callq 0x6924
movq %r15, %rdi
movq %r12, %rsi
callq 0x15d06
movl %eax, %r15d
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x17020
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5390
movl $0x3, %ebp
testb %r15b, %r15b
je 0x171d3
movq 0x10(%rbx), %r15
leaq 0xb8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x6924
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x15d1c
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
movl 0x4(%rsp), %ebx
je 0x1708a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x5390
leaq 0x4353(%rip), %rsi      # 0x1b3e4
leaq 0x8(%rsp), %rdi
callq 0x50f0
testl %eax, %eax
je 0x171b3
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x6924
leaq 0x28(%rsp), %rsi
movl %ebx, %edi
callq 0x1aa0a
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x170e6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5390
xorl %ebp, %ebp
movl %ebx, %edi
callq 0x1aa44
jmp 0x171b8
movq 0x10(%rbx), %r15
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0x6924
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x15d1c
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
movl 0x4(%rsp), %ebx
je 0x17150
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x5390
leaq 0x428d(%rip), %rsi      # 0x1b3e4
leaq 0x8(%rsp), %rdi
callq 0x50f0
testl %eax, %eax
je 0x171b3
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x6924
leaq 0x48(%rsp), %rsi
movl %ebx, %edi
callq 0x1aa0a
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x171a8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5390
xorl %ebp, %ebp
movl %ebx, %edi
callq 0x1aa44
jmp 0x171b8
movl $0x2, %ebp
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x171d3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x17236
movq 0x58(%rsp), %rsi
jmp 0x1720d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x17236
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x17236
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0x17240
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
jmp 0x17240
jmp 0x17233
movq %rax, %rbx
leaq 0x18(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x1727f
movq (%r12), %rsi
jmp 0x17277
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x1727f
movq 0x98(%rsp), %rsi
jmp 0x17277
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x1727f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x5670
nop