// File: /workspace/github_cpp_makefile_star2_O1/kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::Leave()
Action Node::Leave()
{
    std::cout << num << "<-Leave();\n";
    if (leftstable && left != NULL) { //first node must be a virtual node, so it must exist
        for (HashMap::iterator it = data.begin(); it != data.end(); ++it) {
            DateObj *dob = new DateObj(it->first, it->second);
            if (left->_owner == node0->_owner) {
                //the first real node whats to leave. the left neighbor is the very first node and it is node0, which is also leaving

                SearchJob *sj = new SearchJob(MAX, INSERT,
                                              Node::calcRoutingBound(), dob, num);
                Search(sj);
            } else {
                left->out->call(Node::Insert, dob);//do not use DataInsert!
            }
        }
        data.clear();

        std::cout << "Node " << num << " is preparing to leave system.\n";
        num = num + MAX; // increase num to get to end of list
        delete in; // invalidate existing links/identities to 'in'
        in = new Relay; // create new 'in' to be used for new 'num'

        node0->out->call(Node::VirtualNodeLeave, NONE);
        node1->out->call(Node::VirtualNodeLeave, NONE);
    } else {
        call(Node::Leave, NONE);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movsd 0xb0(%rdi), %xmm0
movq 0x6e92(%rip), %rdi      # 0x11fd0
callq 0x3230
leaq 0x23a7(%rip), %rsi      # 0xd4f1
movl $0xb, %edx
movq %rax, %rdi
callq 0x31a0
cmpb $0x1, 0x60(%rbx)
jne 0xb4dd
cmpq $0x0, 0xc8(%rbx)
je 0xb4dd
movq 0x78(%rbx), %r13
testq %r13, %r13
je 0xb2f3
leaq 0x18(%rsp), %r12
movl $0x48, %edi
callq 0x3160
movq %rax, %r14
movl 0x8(%r13), %ebp
movq %r12, 0x8(%rsp)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc8fa
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x4faa
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb1d3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3170
movq %r12, %rbp
movq 0xc8(%rbx), %rax
movq 0xd8(%rbx), %rcx
movq 0x8(%rax), %rdx
cmpq 0x8(%rcx), %rdx
je 0xb246
movq 0x28(%rax), %r12
movl $0x38, %edi
callq 0x3160
leaq 0x6fa5(%rip), %rdx      # 0x121a8
movq (%rdx), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%rdx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x1c39(%rip), %rcx     # 0x95e6
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq (%r12), %rcx
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq *0x8(%rcx)
jmp 0xb2e3
movl $0x60, %edi
callq 0x3160
movq %rax, %r12
movq %rbx, %rdi
callq 0x8b0a
movsd 0xb0(%rbx), %xmm1
leaq 0x6f1e(%rip), %rcx      # 0x12188
movq (%rcx), %rax
movq %rax, (%r12)
incq %rax
movq %rax, (%rcx)
xorps %xmm2, %xmm2
movups %xmm2, 0x8(%r12)
movq $0x0, 0x18(%r12)
leaq 0x6f10(%rip), %rax      # 0x121a0
movq (%rax), %rax
testq %rax, %rax
je 0xb2a0
leaq 0x8(%r12), %rcx
movq %rax, (%rcx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x20(%r12)
movq %r14, 0x28(%r12)
xorl %eax, %eax
movq %rax, 0x30(%r12)
movl %eax, 0x38(%r12)
movsd %xmm0, 0x40(%r12)
movq %rax, 0x48(%r12)
movl %eax, 0x50(%r12)
movsd %xmm1, 0x58(%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x972a
movq (%r13), %r13
testq %r13, %r13
movq %rbp, %r12
jne 0xb181
leaq 0x68(%rbx), %rdi
callq 0x5df6
movq 0x6ccd(%rip), %r14      # 0x11fd0
leaq 0x1f18(%rip), %rsi      # 0xd222
movl $0x5, %edx
movq %r14, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x3230
leaq 0x21cf(%rip), %rsi      # 0xd4fd
movl $0x1f, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
addsd 0x2075(%rip), %xmm0     # 0xd3c0
movsd %xmm0, 0xb0(%rbx)
movq 0xc0(%rbx), %r14
testq %r14, %r14
je 0xb374
movq %r14, %rdi
callq 0x5b6e
movl $0x48, %esi
movq %r14, %rdi
callq 0x3170
movl $0x48, %edi
callq 0x3160
movq %rax, %r14
leaq 0x6898(%rip), %rax      # 0x11c20
movq %rax, (%r14)
leaq 0x6e0e(%rip), %rax      # 0x121a0
movq (%rax), %rax
movq %rax, 0x18(%r14)
movq %r14, %rdi
callq 0x58ce
movq 0x18(%r14), %rax
testq %rax, %rax
je 0xb40d
movq 0x20(%rax), %rax
testq %rax, %rax
je 0xb40d
movq %rax, 0x28(%r14)
movq 0x20(%rax), %r15
movq (%r15), %rcx
testq %rcx, %rcx
je 0xb3e0
xorl %eax, %eax
movl $0x1, %edx
cmpq %r14, (%rcx)
movq 0x8(%rcx), %rsi
cmovel %edx, %eax
movq %rsi, %rcx
testq %rsi, %rsi
jne 0xb3ca
testl %eax, %eax
jne 0xb40d
movl $0x10, %edi
callq 0x3160
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
movq 0x8(%r15), %rcx
xorl %edx, %edx
testq %rcx, %rcx
setne %dl
cmoveq %r15, %rcx
movq %rax, 0x8(%rcx)
movq %rax, (%r15,%rdx,8)
movq %r14, 0xc0(%rbx)
movq 0xd8(%rbx), %rax
movq 0x28(%rax), %r14
movl $0x38, %edi
callq 0x3160
leaq 0x6d78(%rip), %r15      # 0x121a8
movq (%r15), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq 0x134(%rip), %r13       # 0xb580
movq %r13, 0x18(%rax)
xorl %r12d, %r12d
movq %r12, 0x20(%rax)
leaq 0x6d52(%rip), %rbp      # 0x121b0
movq (%rbp), %rcx
movq %rcx, 0x28(%rax)
movq %r12, 0x30(%rax)
movq %r12, (%rbp)
movq (%r14), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq *0x8(%rcx)
movq 0xe0(%rbx), %rax
movq 0x28(%rax), %r14
movl $0x38, %edi
callq 0x3160
movq (%r15), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
movq %r13, 0x18(%rax)
movq %r12, 0x20(%rax)
movq (%rbp), %rcx
movq %rcx, 0x28(%rax)
movq %r12, 0x30(%rax)
movq %r12, (%rbp)
movq (%r14), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq *0x8(%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x38, %edi
callq 0x3160
leaq 0x6cba(%rip), %rcx      # 0x121a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x3ec(%rip), %rcx      # 0xb11e
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
leaq 0x6c95(%rip), %rdx      # 0x121b0
movq (%rdx), %rsi
movq %rsi, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq %rcx, (%rdx)
movq (%rbx), %rcx
movq 0x48(%rcx), %rcx
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
jmp 0xb54b
movq %rax, %rbx
jmp 0xb56a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb56a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3170
movl $0x48, %esi
movq %r14, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3280
nop