// File: /workspace/github_cpp_makefile_star2_O1/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 0xce42
cmpl 0xb0(%rbx), %eax
jle 0x13772
movq 0x68(%rbx), %rdi
callq 0xce42
movl %eax, 0xb0(%rbx)
movq 0x98(%rbx), %r15
leaq 0x88(%rbx), %r13
cmpq %r13, %r15
je 0x13772
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 0x135b4
movl 0x28(%r15), %eax
cmpq $0x3, %rax
ja 0x1374b
movl 0x20(%r15), %r12d
leaq 0x57bc(%rip), %rcx      # 0x18ca8
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 0xbb34
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 0xbb34
addq $0x8, %r13
movq %rbp, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl 0x8(%rsp), %ecx
movq %r12, %r8
movq %r14, %r9
callq 0xc942
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
movq 0x18(%rsp), %r13
leaq 0x20(%rsp), %r14
je 0x13593
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rcx
movq %rcx, %rax
cmpq %rcx, %rdi
jne 0x13740
jmp 0x1374b
movq %r15, %rdi
callq 0x31b0
movq %rax, %r12
jmp 0x13766
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 0xbb34
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 0xbb34
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 0xcb18
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
movq 0x18(%rsp), %r13
je 0x13655
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 0x13740
jmp 0x1374b
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 0xbb34
movq %rbp, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl %r12d, %ecx
leaq 0xa8(%rsp), %r8
callq 0xcc0a
movq 0xa8(%rsp), %rdi
movq %r14, %rax
cmpq %r14, %rdi
jmp 0x13734
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 0xbb34
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movl $0x1, %edx
movl %r12d, %ecx
movq %r14, %r8
callq 0xca34
movq 0xc8(%rsp), %rdi
movq %rbp, %rax
cmpq %rbp, %rdi
movq 0x18(%rsp), %r13
leaq 0x20(%rsp), %r14
je 0x1374b
movq (%rax), %rsi
incq %rsi
callq 0x3280
movq %r15, %rdi
callq 0x31b0
movq %rax, %r12
movq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x149c4
movq %r12, %r15
cmpq %r13, %r12
jne 0x134c3
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 0x137a8
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x137a8
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
jmp 0x13804
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
movq %rbp, 0x10(%rsp)
cmpq %rbp, %rdi
jne 0x13809
jmp 0x13819
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x137f5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x137f5
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %rdi
je 0x13819
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 0x13809
jmp 0x13819