// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::deleteExpired()
void MP2Node::deleteExpired()
{
	if (par->getcurrtime() > local_time)
	{
		local_time = par->getcurrtime();
		for (auto it = local_state_.begin(); it != local_state_.end();)
		{
			int trans_id = it->first;
			const auto &state = it->second;
			if (state.expiry < local_time)
			{
				switch (state.type)
				{
				case MessageType::READ:
				{
					log->logReadFail(&(memberNode->addr), true /*is_coordinator*/, trans_id, state.key);
					break;
				}
				case MessageType::CREATE:
				{
					log->logCreateFail(&(memberNode->addr), true /*is_coordinator*/, trans_id, state.key, state.value);
					break;
				}
				case MessageType::UPDATE:
				{
					log->logUpdateFail(&(memberNode->addr), true /*is_coordinator*/, trans_id, state.key, state.value);
					break;
				}
				case MessageType::DELETE:
				{
					log->logDeleteFail(&(memberNode->addr), true /*is_coordinator*/, trans_id, state.key);
					break;
				}
				default:
					break;
				}
				it = local_state_.erase(it);
			}
			else
			{
				++it;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
callq 0xa4d8
cmpl 0xb0(%rbx), %eax
jle 0xf2b1
movq 0x68(%rbx), %rdi
callq 0xa4d8
movl %eax, 0xb0(%rbx)
leaq 0x80(%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x98(%rbx), %r13
leaq 0x88(%rbx), %r15
movq %r15, 0x8(%rsp)
cmpq %r15, %r13
je 0xf2b1
movl 0x70(%r13), %eax
cmpl 0xb0(%rbx), %eax
jge 0xf1c3
movl 0x28(%r13), %eax
cmpq $0x3, %rax
ja 0xf29c
movl 0x20(%r13), %r14d
leaq 0x3ae5(%rip), %rcx      # 0x12c4c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, 0x4(%rsp)
movq 0x60(%rbx), %r12
movq 0x78(%rbx), %r15
leaq 0x30(%r13), %rsi
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x3370
leaq 0x50(%r13), %rsi
leaq 0x98(%rsp), %rbp
movq %rbp, %rdi
callq 0x3370
addq $0x8, %r12
movq %r15, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
movl 0x4(%rsp), %ecx
movq %r14, %r8
movq %rbp, %r9
callq 0xa0b0
movq %r14, %r15
jmp 0xf21e
movq %r13, %rdi
callq 0x31b0
movq %rax, %r13
jmp 0xf139
movl %r14d, 0x4(%rsp)
movq 0x60(%rbx), %r12
movq 0x78(%rbx), %r14
leaq 0x30(%r13), %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x3370
leaq 0x50(%r13), %rsi
leaq 0x78(%rsp), %rbp
movq %rbp, %rdi
callq 0x3370
addq $0x8, %r12
movq %r14, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
movl 0x4(%rsp), %ecx
movq %r15, %r8
movq %rbp, %r9
callq 0xa21e
movq %rbp, %rdi
callq 0x3110
jmp 0xf28f
movq 0x60(%rbx), %r12
movq 0x78(%rbx), %rbp
addq $0x8, %r12
leaq 0x30(%r13), %rsi
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x3370
movq %rbp, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
movl %r14d, %ecx
movq %r15, %r8
callq 0xa2e0
jmp 0xf28f
movq 0x60(%rbx), %r12
movq 0x78(%rbx), %rbp
addq $0x8, %r12
leaq 0x30(%r13), %rsi
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
callq 0x3370
movq %rbp, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
movl %r14d, %ecx
movq %r15, %r8
callq 0xa172
movq %r15, %rdi
callq 0x3110
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1052a
movq %rax, %r13
jmp 0xf139
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x3110
jmp 0xf2d8
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0xf30d
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
jmp 0xf30d
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3110
jmp 0xf2fe
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0xf30d
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450