// File: /workspace/github_cpp_makefile_star2_O3/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::updateKeyValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReplicaType)
bool MP2Node::updateKeyValue(string key, string value, ReplicaType replica)
{
	/*
	 * Implement this
	 */
	// Update key in local hash table and return true or false
	switch (replica)
	{
	case ReplicaType::PRIMARY:
	{
		return ht->update(key, value);
	}
	case ReplicaType::SECONDARY:
	{
		return secondary->update(key, value);
	}
	case ReplicaType::TERTIARY:
	{
		return tertiary->update(key, value);
	}
	default:
		break;
	}
	return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
cmpl $0x2, %ecx
je 0x113dc
cmpl $0x1, %ecx
je 0x1135c
testl %ecx, %ecx
jne 0x11460
movq 0x48(%rdi), %r14
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0xa8(%rsp), %rdi
movq %rax, %rsi
callq 0xba52
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0xba52
leaq 0xa8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
callq 0x14af4
movl %eax, %ebx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x1134f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0xa8(%rsp), %rdi
jmp 0x1144e
movq 0x50(%rdi), %r14
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0xba52
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0xba52
leaq 0x88(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x14af4
movl %eax, %ebx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x113d2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x88(%rsp), %rdi
jmp 0x1144e
movq 0x58(%rdi), %r14
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0xba52
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xba52
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x14af4
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11449
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x11462
movq (%r15), %rsi
incq %rsi
callq 0x3280
jmp 0x11462
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x114ca
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x114ca
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x114d7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x114d7
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x114e1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x114e1
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
jmp 0x114e9
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x114e9
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0x114f9
movq (%r15), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3470
nop