// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::updateToBeDeletedMap()
void MP1Node::updateToBeDeletedMap() {

    std::map<int, int>::iterator it = this->tobedeleted->begin();
    
    while(it != this->tobedeleted->end()) {
        it->second = it->second + 1;
        if (it->second >= TREMOVE) {
            // log the removal
            Address address;
            string _address = to_string(it->first) + ":" + to_string(0);
            address = Address(_address);
            log->logNodeRemove(&memberNode->addr, &address);

            // remove from member list
            bool found = false;
            memberNode->myPos = memberNode->memberList.begin();
            while (memberNode->myPos != memberNode->memberList.end()) {
                if ((*memberNode->myPos).getid() == it->first) {
                    // found it
                    found = true;
                    memberNode->myPos = memberNode->memberList.erase(memberNode->myPos);
                    break;
                }
                ++memberNode->myPos;
            }
            if (!found) {
                cout << "the should-be-deleted entry is not found in member list; sth goes wrong" << endl;
            }

            // remove from to-be-deleted map; can be re-added by membership protocol now
            it = this->tobedeleted->erase(it);
        } else {
            ++it;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq 0x38(%rdi), %rax
movq 0x18(%rax), %r14
addq $0x8, %rax
cmpq %rax, %r14
je 0x6221
movq %rdi, %rbx
leaq 0x28(%rsp), %rbp
movq %rdi, 0x88(%rsp)
movl 0x24(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x24(%r14)
cmpl $0x9, %eax
jl 0x5f0c
movl 0x20(%r14), %r15d
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x5f25
movl $0x4, %r13d
movl %r12d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x5f1c
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x5f22
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x5f25
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r13d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x5edc
addl $-0x3, %r13d
jmp 0x5f25
movq %r14, %rdi
callq 0x31b0
movq %rax, %r14
jmp 0x6210
addl $-0x2, %r13d
jmp 0x5f25
decl %r13d
movq %rbp, %rbx
shrl $0x1f, %r15d
movl %r15d, %esi
addl %r13d, %esi
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x68(%rsp), %rbp
movq %rbp, %rdi
movl $0x2d, %edx
callq 0x32f0
movq 0x68(%rsp), %rdi
addq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x67a3
movq %rbp, %rdi
leaq 0x11da2(%rip), %rsi     # 0x17d0d
callq 0x3480
leaq 0x38(%rsp), %r12
movq %r12, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x18(%rsp), %r15
leaq 0x58(%rsp), %r13
je 0x5fa2
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x5faa
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rbx, %rbp
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r13, 0x48(%rsp)
movl $0x1, %esi
leaq 0x48(%rsp), %rdi
movl $0x2d, %edx
callq 0x32f0
movq 0x48(%rsp), %rax
movb $0x30, (%rax)
movq 0x28(%rsp), %rcx
movl $0xf, %esi
cmpq %r12, %rcx
je 0x5ffa
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %r8
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x6023
movl $0xf, %esi
cmpq %r13, 0x48(%rsp)
je 0x601e
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x6032
movq 0x48(%rsp), %rsi
movq %rbp, %rdi
callq 0x30d0
jmp 0x6040
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x6060
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x6067
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x609b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x90(%rsp), %rbx
leaq 0xb2(%rsp), %r13
je 0x60c2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
leaq 0xa0(%rsp), %r12
je 0x60e6
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r12, 0x90(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x6810
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x634c
movq %r13, %rdi
movq %rbp, %rsi
callq 0xd17e
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x6136
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x88(%rsp), %rbx
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsi
movq %r13, %rdx
callq 0xc82a
movq 0x20(%rbx), %rax
movq 0x28(%rax), %rcx
movq %rcx, 0x40(%rax)
movq 0x20(%rbx), %rax
movq 0x40(%rax), %rdi
cmpq 0x30(%rax), %rdi
movq 0x18e5f(%rip), %r12     # 0x1efd0
je 0x6194
callq 0xd1f2
movq 0x20(%rbx), %rcx
cmpl 0x20(%r14), %eax
je 0x61d2
movq 0x40(%rcx), %rdi
addq $0x18, %rdi
movq %rdi, 0x40(%rcx)
cmpq 0x30(%rcx), %rdi
jne 0x6173
movl $0x47, %edx
movq %r12, %rdi
leaq 0x10e76(%rip), %rsi     # 0x17019
callq 0x32d0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31a0
jmp 0x61ea
movq 0x40(%rcx), %rsi
addq $0x28, %rcx
movq %rcx, %rdi
callq 0x6b16
movq 0x20(%rbx), %rcx
movq %rax, 0x40(%rcx)
movq 0x38(%rbx), %rdi
movq %r14, %rsi
callq 0x6ada
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6210
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x38(%rbx), %rax
addq $0x8, %rax
cmpq %rax, %r14
jne 0x5ea4
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x62c0
movq %rax, %rbx
jmp 0x6263
movq %rax, %rbx
jmp 0x62b7
jmp 0x62c0
movq %rax, %rbx
jmp 0x627f
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x6263
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x627f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x62da
movq 0x78(%rsp), %rsi
jmp 0x62d2
jmp 0x62c0
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x62b7
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x18(%rsp), %r15
jmp 0x62c3
jmp 0x62c0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x62da
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450