// File: /workspace/github_cpp_makefile_star2_O3/prakhar2808[P]DBEngine/dbengine/sstableWrapper.cc
// Function: sstableWrapper::getValueFromKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
opStatus sstableWrapper::getValueFromKey(std::string key, int clientSocket) {
  std::list<sstable*>::reverse_iterator iter;
  int count = 0;
  for(iter = sstableObjRefList.rbegin();
      iter != sstableObjRefList.rend();
      ++iter) {
    ++count;
    // Check the in-memory bloom filter first.
    if(!((*iter)->isKeyPresent(key))) {
      continue;
    }
    // Now the SSTable may contain the key.
    opStatus ret = (*iter)->getValueFromKey(key, clientSocket);
    // The key is found in the SSTable then the return will be opSuccess.
    if(ret == opStatus::opSuccess) {
      std::cout << "Checked " << count << " SSTables and found!" << std::endl;
      return ret;
    }
    // The key is found as a tombstone.
    if(ret == opStatus::opKeyNotFound) {
      std::cout << "Checked " << count << " SSTables but NOT found!" 
                << std::endl;
      return ret;
    }
  }
  std::cout << "Checked " << count << " SSTables but NOT found!" << std::endl;
  return opStatus::opKeyNotFound;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, 0x4(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x8(%rdi), %r12
cmpq 0x8(%rdi), %r12
je 0x19e08
leaq 0x28(%rsp), %r15
xorl %ebx, %ebx
movq %r12, %rbp
movq %r15, 0x8(%rsp)
movq 0x8(%rbp), %rax
movq 0x10(%rax), %r13
movq %r15, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x6924
movq %r13, %rdi
movq %r14, %rsi
callq 0x17d90
movl %eax, %r13d
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x19d76
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5390
incl %ebx
testb %r13b, %r13b
je 0x19df8
movl %ebx, %r15d
movq %r12, %rbx
movq 0x8(%rbp), %rax
movq 0x10(%rax), %r13
leaq 0x48(%rsp), %r12
movq %r12, 0x38(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x6924
movq %r13, %rdi
movq %r14, %rsi
movl 0x4(%rsp), %edx
callq 0x17e0e
movl %eax, %r13d
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x19dda
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5390
cmpl $0x2, %r13d
je 0x19ec3
movq %rbx, %r12
testl %r13d, %r13d
movl %r15d, %ebx
leaq 0x28(%rsp), %r15
je 0x19e83
movq 0x8(%rbp), %rbp
cmpq (%r12), %rbp
jne 0x19d28
jmp 0x19e0a
xorl %ebx, %ebx
movq 0xc1af(%rip), %r14      # 0x25fc0
leaq 0x2753(%rip), %rsi      # 0x1c56b
movl $0x8, %edx
movq %r14, %rdi
callq 0x5430
movq %r14, %rdi
movl %ebx, %esi
callq 0x5650
movq %rax, %rbx
leaq 0x2750(%rip), %rsi      # 0x1c589
movl $0x18, %edx
movq %rax, %rdi
callq 0x5430
movl $0x2, %ebp
movq (%rbx), %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
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc136(%rip), %r14      # 0x25fc0
leaq 0x26da(%rip), %rsi      # 0x1c56b
movl $0x8, %edx
movq %r14, %rdi
callq 0x5430
movq %r14, %rdi
movl %ebx, %esi
callq 0x5650
movq %rax, %rbx
leaq 0x26c2(%rip), %rsi      # 0x1c574
movl $0x14, %edx
movq %rax, %rdi
callq 0x5430
xorl %ebp, %ebp
jmp 0x19e4b
movq 0xc0f6(%rip), %r14      # 0x25fc0
leaq 0x269a(%rip), %rsi      # 0x1c56b
movl $0x8, %edx
movq %r14, %rdi
callq 0x5430
movq %r14, %rdi
movl %r15d, %esi
jmp 0x19e2a
movq %rax, %rbx
movq 0x38(%rsp), %rdi
movq %r12, 0x8(%rsp)
cmpq %r12, %rdi
jne 0x19f0a
jmp 0x19f1a
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x19f1a
movq 0x8(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x5670