// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
callq 0xcd1e
cmpl 0xb0(%rbx), %eax
jle 0x1347e
movq 0x68(%rbx), %rdi
callq 0xcd1e
movl %eax, 0xb0(%rbx)
movq 0x98(%rbx), %r15
leaq 0x88(%rbx), %r13
cmpq %r13, %r15
je 0x1347e
leaq 0x80(%rbx), %rax
movq %rax, 0x80(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %r14
movq %r13, 0x18(%rsp)
movl 0x70(%r15), %eax
cmpl 0xb0(%rbx), %eax
jge 0x132c0
movl 0x28(%r15), %eax
cmpq $0x3, %rax
ja 0x13457
movl 0x20(%r15), %r12d
leaq 0x5a70(%rip), %rcx      # 0x18c68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r12d, 0x8(%rsp)
movq 0x60(%rbx), %r13
movq 0x78(%rbx), %rbp
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x30(%r15), %rsi
movq 0x38(%r15), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %r12
movq %r12, %rdi
callq 0xba52
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0xba52
addq $0x8, %r13
movq %rbp, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl 0x8(%rsp), %ecx
movq %r12, %r8
movq %r14, %r9
callq 0xc81e
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
movq 0x18(%rsp), %r13
leaq 0x20(%rsp), %r14
je 0x1329f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rcx
movq %rcx, %rax
cmpq %rcx, %rdi
jne 0x1344c
jmp 0x13457
movq %r15, %rdi
callq 0x31b0
movq %rax, %r12
jmp 0x13472
movl %r12d, 0x8(%rsp)
movq 0x60(%rbx), %r13
movq 0x78(%rbx), %rbp
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%r15), %rsi
movq 0x38(%r15), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xba52
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rdx
addq %rsi, %rdx
movq %r14, %r12
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0xba52
addq $0x8, %r13
movq %rbp, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl 0x8(%rsp), %ecx
movq %r12, %rbp
movq %r12, %r8
movq %r14, %r9
callq 0xc9f4
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
movq 0x18(%rsp), %r13
je 0x13361
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movq %rcx, %rax
cmpq %rcx, %rdi
movq %rbp, %r14
jne 0x1344c
jmp 0x13457
movq 0x60(%rbx), %r13
movq 0x78(%rbx), %rbp
addq $0x8, %r13
leaq 0xb8(%rsp), %r14
movq %r14, 0xa8(%rsp)
movq 0x30(%r15), %rsi
movq 0x38(%r15), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0xba52
movq %rbp, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl %r12d, %ecx
leaq 0xa8(%rsp), %r8
callq 0xcae6
movq 0xa8(%rsp), %rdi
movq %r14, %rax
cmpq %r14, %rdi
jmp 0x13440
movq 0x60(%rbx), %r13
movq 0x78(%rbx), %rax
movq %rax, 0x8(%rsp)
addq $0x8, %r13
leaq 0xd8(%rsp), %rbp
movq %rbp, 0xc8(%rsp)
movq 0x30(%r15), %rsi
movq 0x38(%r15), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0xba52
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl $0x1, %edx
movl %r12d, %ecx
movq %r14, %r8
callq 0xc910
movq 0xc8(%rsp), %rdi
movq %rbp, %rax
cmpq %rbp, %rdi
movq 0x18(%rsp), %r13
leaq 0x20(%rsp), %r14
je 0x13457
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq %r15, %rdi
callq 0x31b0
movq %rax, %r12
movq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x146f2
movq %r12, %r15
cmpq %r13, %r12
jne 0x131cf
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x134b4
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x134b4
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
jmp 0x13510
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
movq %rbp, 0x10(%rsp)
cmpq %rbp, %rdi
jne 0x13515
jmp 0x13525
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x13501
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x13501
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %rdi
je 0x13525
movq 0x10(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3470
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
movq %r14, 0x10(%rsp)
cmpq %r14, %rdi
jne 0x13515
jmp 0x13525