// File: yasz24[P]eau2/src/network/./../application/../store/../utils/map.h
// Function: Map::get(Object*)
Object* get(Object* key) {
      //std::cout << "Map get: " << "key: " << key->serialize() << "\n";
      size_t key_hash = key->hash();
      //std::cout << "get hash" << key_hash << "\n";
      KeyVal *wrappedkey = new KeyVal(key, nullptr);
      size_t index = key_hash % this->numBuckets_;
      //std::cout << "map get queue index: " << index << " num buckets: "<< numBuckets_<<"\n";
      Queue *queue_at_index = dynamic_cast<Queue*>(this->buckets_->get(index));
      //std::cout << "get queue: " << queue_at_index->serialize() << "\n";
      Object* keyVal = queue_at_index->get(wrappedkey);
      if (keyVal != nullptr) {
        //key is in map.
        //std::cout << "found key in map\n";
        KeyVal *key_val = dynamic_cast<KeyVal*>(keyVal);
        Object* val = key_val->getVal();
        // if (val == nullptr) {
        //   std::cout << "val is null " << "\n";
        // }
        // std::cout << "val is not null " << "\n";
        return val;
      } else {
        std::cout << "ERROR: Key not found in map" << "key: " << key->serialize() << "\n";
        //key is not in map
        //std::cout<<"ERROR: Key not found in map\n";
        return nullptr;
      }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x20(%rbp)
movl $0x20, %edi
callq 0x8290
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xee50
jmp 0xecbf
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
xorl %edx, %edx
divq 0x10(%rcx)
movq -0x70(%rbp), %rax
movq %rdx, -0x40(%rbp)
movq 0x28(%rax), %rdi
movq -0x40(%rbp), %rsi
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0xed30
movq -0x78(%rbp), %rdi
leaq 0x2b3c0(%rip), %rsi     # 0x3a0c0
leaq 0x2bb61(%rip), %rdx     # 0x3a868
xorl %eax, %eax
movl %eax, %ecx
callq 0x82f0
movq %rax, -0x80(%rbp)
jmp 0xed38
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x8260
jmp 0xee23
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0xed38
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xeea0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0xedbd
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0xed90
movq -0x88(%rbp), %rdi
leaq 0x2b349(%rip), %rsi     # 0x3a0c0
leaq 0x2bb02(%rip), %rdx     # 0x3a880
xorl %eax, %eax
movl %eax, %ecx
callq 0x82f0
movq %rax, -0x90(%rbp)
jmp 0xed9b
xorl %eax, %eax
movq %rax, -0x90(%rbp)
jmp 0xed9b
movq -0x90(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0xef50
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xee16
movq 0x2d1fc(%rip), %rdi     # 0x3bfc0
leaq 0x1d68f(%rip), %rsi     # 0x2c45a
callq 0x8280
movq %rax, %rdi
leaq 0x1db6a(%rip), %rsi     # 0x2c944
callq 0x8280
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x8280
movq %rax, %rdi
leaq 0x1d324(%rip), %rsi     # 0x2c12d
callq 0x8280
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x8400
nopl (%rax)