// File: 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
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rsi, -0x208(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x200(%rbp)
movl 0x24c11(%rip), %eax     # 0x4295c
movl %eax, %ecx
incl %ecx
movl %ecx, 0x24c07(%rip)     # 0x4295c
movl %eax, -0x14(%rbp)
movq 0x1c269(%rip), %rdi     # 0x39fc8
leaq 0xcf7e(%rip), %rsi      # 0x2ace4
callq 0x42f0
movq %rax, %rcx
movq -0x200(%rbp), %rax
movq %rcx, -0x1f8(%rbp)
movq 0x60(%rax), %rsi
addq $0x8, %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x12740
movq -0x1f8(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
callq 0x42a0
movq %rax, -0x1e8(%rbp)
jmp 0x1ddb0
movq -0x1e8(%rbp), %rdi
leaq 0xc548(%rip), %rsi      # 0x2a306
callq 0x42f0
jmp 0x1ddc5
leaq -0x38(%rbp), %rdi
callq 0x41e0
movq -0x200(%rbp), %rsi
addq $0x30, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x21440
movq -0x210(%rbp), %rdi
callq 0x1be40
jmp 0x1ddf7
leaq -0x60(%rbp), %rdi
callq 0x12c30
movq -0x208(%rbp), %rsi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x4150
movq -0x200(%rbp), %rsi
movq -0x218(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x1d870
jmp 0x1de33
leaq -0x98(%rbp), %rdi
callq 0x41e0
movl $0x0, -0x9c(%rbp)
movslq -0x9c(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x12c90
movq %rax, %rcx
movq -0x220(%rbp), %rax
cmpq %rcx, %rax
jae 0x1e121
movq 0x1c14e(%rip), %rdi     # 0x39fc8
leaq 0xce75(%rip), %rsi      # 0x2acf6
callq 0x42f0
movq %rax, -0x228(%rbp)
jmp 0x1de8f
movslq -0x9c(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x15460
movq %rax, %rdi
callq 0x25a90
movq %rax, -0x230(%rbp)
jmp 0x1deb0
movq -0x230(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x12740
jmp 0x1dec5
movq -0x228(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x42a0
movq %rax, -0x238(%rbp)
jmp 0x1dee1
movq -0x238(%rbp), %rdi
leaq 0xce65(%rip), %rsi      # 0x2ad54
callq 0x42f0
movq %rax, -0x240(%rbp)
jmp 0x1defd
movq -0x208(%rbp), %rsi
movq -0x240(%rbp), %rdi
callq 0x42a0
movq %rax, -0x248(%rbp)
jmp 0x1df19
movq -0x248(%rbp), %rdi
leaq 0xc41e(%rip), %rsi      # 0x2a345
callq 0x42f0
jmp 0x1df2e
leaq -0xc0(%rbp), %rdi
callq 0x41e0
movq -0x200(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, -0x24c(%rbp)
movq 0x60(%rax), %rsi
addq $0x8, %rsi
leaq -0x13e(%rbp), %rdi
callq 0x170d0
jmp 0x1df60
movq -0x208(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4150
jmp 0x1df75
movl -0x24c(%rbp), %esi
leaq -0x138(%rbp), %rdi
leaq -0x13e(%rbp), %rdx
movl $0x1, %ecx
leaq -0x160(%rbp), %r8
callq 0x288e0
jmp 0x1df9c
leaq -0x160(%rbp), %rdi
callq 0x41e0
movq -0x200(%rbp), %rcx
movq 0x60(%rcx), %rax
movq 0x70(%rcx), %rcx
movq %rcx, -0x268(%rbp)
addq $0x8, %rax
movq %rax, -0x260(%rbp)
movslq -0x9c(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x15460
movq %rax, %rdi
callq 0x25a90
movq %rax, -0x258(%rbp)
jmp 0x1dfea
leaq -0x180(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x28bb0
jmp 0x1dfff
movq -0x258(%rbp), %rdx
movq -0x260(%rbp), %rsi
movq -0x268(%rbp), %rdi
leaq -0x180(%rbp), %rcx
callq 0xcce0
jmp 0x1e022
leaq -0x180(%rbp), %rdi
callq 0x41e0
leaq -0x138(%rbp), %rdi
callq 0x21280
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x1de49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x41e0
jmp 0x1e29d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x12c30
jmp 0x1e29d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x41e0
jmp 0x1e29d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1e294
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x41e0
jmp 0x1e294
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x41e0
jmp 0x1e294
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1e110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x41e0
leaq -0x138(%rbp), %rdi
callq 0x21280
jmp 0x1e294
movq -0x208(%rbp), %rsi
movl $0x1, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x4150
jmp 0x1e147
movb $0x1, -0x1da(%rbp)
leaq -0x1b0(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x4580
movq -0x280(%rbp), %rdi
movq -0x278(%rbp), %rdx
leaq 0xc1c2(%rip), %rsi      # 0x2a346
callq 0x12b10
jmp 0x1e18b
movq -0x200(%rbp), %rax
leaq -0x190(%rbp), %rcx
movq %rcx, -0x290(%rbp)
movq 0x68(%rax), %rdi
callq 0x17080
movl %eax, -0x284(%rbp)
jmp 0x1e1b1
movq -0x200(%rbp), %rdi
movq -0x290(%rbp), %rax
movl -0x284(%rbp), %ecx
addl $0xf, %ecx
movl %ecx, (%rax)
movq $0x0, -0x188(%rbp)
movb $0x0, -0x1da(%rbp)
subq $-0x80, %rdi
leaq -0x14(%rbp), %rsi
callq 0x212c0
movq %rax, -0x298(%rbp)
jmp 0x1e1f2
movq -0x298(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x213a0
leaq -0x1d8(%rbp), %rdi
callq 0x21410
leaq -0x1d9(%rbp), %rdi
callq 0x4370
leaq -0x78(%rbp), %rdi
callq 0x12c30
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1e26f
movq -0x280(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x41e0
jmp 0x1e26f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x21410
leaq -0x1d9(%rbp), %rdi
callq 0x4370
testb $0x1, -0x1da(%rbp)
jne 0x1e286
jmp 0x1e292
movq -0x270(%rbp), %rdi
callq 0x41e0
jmp 0x1e294
leaq -0x78(%rbp), %rdi
callq 0x12c30
movq -0x40(%rbp), %rdi
callq 0x4570
nopw %cs:(%rax,%rax)