// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movl %edx, 0x14(%rsp)
movq %rsi, 0x20(%rsp)
leaq 0x8(%rdi), %r14
cmpq 0x8(%rdi), %r14
je 0x19e58
leaq 0x38(%rsp), %rbp
movl $0x0, 0xc(%rsp)
leaq 0x58(%rsp), %rbx
movq %r14, %r15
movq %rbp, 0x18(%rsp)
movq 0x8(%r15), %rax
movq 0x10(%rax), %r13
movq %rbp, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x6924
movq %r13, %rdi
movq %r12, %rsi
callq 0x17d30
movl %eax, %r13d
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x19d21
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5390
incl 0xc(%rsp)
testb %r13b, %r13b
je 0x19e49
movq 0x8(%r15), %rax
movq 0x10(%rax), %r13
movq %rbx, %rbp
movq %rbx, 0x48(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x6924
movq %r13, %rdi
movq %r12, %rsi
movl 0x14(%rsp), %edx
callq 0x17dae
movl %eax, %r13d
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x19d83
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5390
cmpl $0x2, %r13d
leaq 0x38(%rsp), %rbp
je 0x19dd4
movb $0x1, %al
testl %r13d, %r13d
jne 0x19e41
movl $0x8, %edx
movq 0xc21b(%rip), %r12      # 0x25fc0
movq %r12, %rdi
leaq 0x27bc(%rip), %rsi      # 0x1c56b
callq 0x5430
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x5650
movq %rax, %r12
movl $0x14, %edx
movq %rax, %rdi
leaq 0x27a2(%rip), %rsi      # 0x1c574
jmp 0x19e0d
movl $0x8, %edx
movq 0xc1e0(%rip), %r12      # 0x25fc0
movq %r12, %rdi
leaq 0x2781(%rip), %rsi      # 0x1c56b
callq 0x5430
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x5650
movq %rax, %r12
movl $0x18, %edx
movq %rax, %rdi
leaq 0x277c(%rip), %rsi      # 0x1c589
callq 0x5430
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5370
movsbl %al, %esi
movq %r12, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x5280
xorl %eax, %eax
movl %r13d, 0x10(%rsp)
testb %al, %al
je 0x19ecd
movq 0x8(%r15), %r15
cmpq (%r14), %r15
jne 0x19cd3
jmp 0x19e60
movl $0x0, 0xc(%rsp)
movq 0xc159(%rip), %r14      # 0x25fc0
leaq 0x26fd(%rip), %rsi      # 0x1c56b
movl $0x8, %edx
movq %r14, %rdi
callq 0x5430
movq %r14, %rdi
movl 0xc(%rsp), %esi
callq 0x5650
movq %rax, %rbx
leaq 0x26f8(%rip), %rsi      # 0x1c589
movl $0x18, %edx
movq %rax, %rdi
callq 0x5430
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 $0x2, 0x10(%rsp)
movl 0x10(%rsp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
movq %rbp, 0x18(%rsp)
jmp 0x19ef7
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x19f0c
movq 0x18(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x5670