// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::clientRead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void MP2Node::clientRead(string key)
{
	/*
	 * Implement this
	 */
	int current = g_transID++;
	std::cout << "Start clientRead " << memberNode->addr.getAddress() << " ";
	PrintRing(ring);
	auto nodes = findNodes(key);
	for (auto node_id = 0; node_id < nodes.size(); ++node_id)
	{
		std::cout << "clientRead on " << nodes[node_id].getAddress()->getAddress() << " for " << key << "\n";
		auto req = Message(current, memberNode->addr, MessageType::READ, key);
		emulNet->ENsend(&(memberNode->addr), nodes[node_id].getAddress(), req.toString());
	}
	local_state_[current] = {MessageType::READ, key, "", par->getcurrtime() + READ_TIMEOUT, 0};
	// std::cout << "End clientRead\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movl 0x16111(%rip), %ecx     # 0x238bc
leal 0x1(%rcx), %eax
movl %eax, 0x16108(%rip)     # 0x238bc
movq %rcx, 0x40(%rsp)
movl %ecx, 0x1c(%rsp)
movq 0xd804(%rip), %rdi      # 0x1afc8
leaq 0x54b9(%rip), %rsi      # 0x12c84
callq 0x3250
movq %rax, %r14
movq %rbx, 0x8(%rsp)
movq 0x60(%rbx), %rsi
addq $0x8, %rsi
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x8da4
movq %r14, %rdi
movq %r15, %rsi
callq 0x3210
leaq 0x4ab7(%rip), %rsi      # 0x122b6
movq %rax, %rdi
callq 0x3250
leaq 0x48(%rsp), %rdi
callq 0x3110
movq 0x8(%rsp), %rbx
leaq 0x30(%rbx), %rsi
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0xf52e
movq %r14, %rdi
callq 0xc4f8
leaq 0xc0(%rsp), %rdi
callq 0x8f1a
leaq 0xd8(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x3370
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xd54e
leaq 0xd8(%rsp), %rdi
callq 0x3110
xorl %r15d, %r15d
leaq 0xf8(%rsp), %r13
xorl %ebx, %ebx
movq 0x30(%rsp), %rax
subq 0x28(%rsp), %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0xd9b3
movq 0xd72c(%rip), %rdi      # 0x1afc8
leaq 0x53f3(%rip), %rsi      # 0x12c96
callq 0x3250
movq %rax, %r12
movq 0x28(%rsp), %rdi
addq %r15, %rdi
callq 0x107d2
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x8da4
movq %r12, %rdi
movq %r14, %rsi
callq 0x3210
movq %rax, %rdi
leaq 0x5417(%rip), %rsi      # 0x12cf4
callq 0x3250
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x3210
movq %rax, %rdi
leaq 0x49fc(%rip), %rsi      # 0x122f5
callq 0x3250
leaq 0x48(%rsp), %rdi
callq 0x3110
movq 0x8(%rsp), %rax
movq 0x60(%rax), %rsi
addq $0x8, %rsi
leaq 0x22(%rsp), %rdi
callq 0xa4e4
leaq 0x118(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x3370
leaq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x22(%rsp), %rdx
pushq $0x1
popq %rcx
movq %r14, %r8
callq 0x119f8
movq %r14, %rdi
callq 0x3110
movq 0x8(%rsp), %rax
movq 0x60(%rax), %r12
movq 0x70(%rax), %r14
movq 0x28(%rsp), %rdi
addq %r15, %rdi
callq 0x107d2
movq %rax, %rbp
movq %r13, %rdi
leaq 0x48(%rsp), %rsi
callq 0x11c40
addq $0x8, %r12
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x5d28
movq %r13, %rdi
callq 0x3110
leaq 0x48(%rsp), %rdi
callq 0xf466
incq %rbx
addq $0x20, %r15
jmp 0xd87e
leaq 0x50(%rsp), %r15
movl $0x1, -0x8(%r15)
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x3370
leaq 0x70(%rsp), %r14
leaq 0x491d(%rip), %rsi      # 0x122f6
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x8ed6
movq 0x8(%rsp), %rbx
movq 0x68(%rbx), %rdi
callq 0xa4d8
addl $0xf, %eax
movl %eax, 0x90(%rsp)
andq $0x0, 0x98(%rsp)
subq $-0x80, %rbx
leaq 0x1c(%rsp), %rsi
movq %rbx, %rdi
callq 0xf48a
leaq 0x48(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf4d8
movq %rbx, %rdi
callq 0xf514
leaq 0x28(%rsp), %rdi
callq 0x8f1a
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xf514
jmp 0xdae2
movq %rax, %rbx
movq %r14, %rdi
callq 0x3110
jmp 0xda6e
movq %rax, %rbx
movq %r15, %rdi
jmp 0xdadd
jmp 0xdad0
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
jmp 0xda97
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0xdae7
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3110
jmp 0xdaec
jmp 0xdad0
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x3110
jmp 0xdac2
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0xdadd
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xf466
jmp 0xdae2
jmp 0xdad0
movq %rax, %rbx
jmp 0xdae2
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x8f1a
movq %rbx, %rdi
callq 0x3450