// File: /workspace/github_cpp_makefile_star2_O3/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 0x6dda(%rip), %rdi      # 0x10fd0
callq 0x2230
leaq 0x22ef(%rip), %rsi      # 0xc4f1
movl $0xb, %edx
movq %rax, %rdi
callq 0x21a0
cmpb $0x1, 0x60(%rbx)
jne 0xa595
cmpq $0x0, 0xc8(%rbx)
je 0xa595
movq 0x78(%rbx), %r13
testq %r13, %r13
je 0xa3ab
leaq 0x18(%rsp), %r12
movl $0x48, %edi
callq 0x2160
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 0xb930
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x3f6a
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xa28b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
movq %r12, %rbp
movq 0xc8(%rbx), %rax
movq 0xd8(%rbx), %rcx
movq 0x8(%rax), %rdx
cmpq 0x8(%rcx), %rdx
je 0xa2fe
movq 0x28(%rax), %r12
movl $0x38, %edi
callq 0x2160
leaq 0x6eed(%rip), %rdx      # 0x111a8
movq (%rdx), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%rdx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x1ca7(%rip), %rcx     # 0x8630
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 0xa39b
movl $0x60, %edi
callq 0x2160
movq %rax, %r12
movq %rbx, %rdi
callq 0x7a80
movsd 0xb0(%rbx), %xmm1
leaq 0x6e66(%rip), %rcx      # 0x11188
movq (%rcx), %rax
movq %rax, (%r12)
incq %rax
movq %rax, (%rcx)
xorps %xmm2, %xmm2
movups %xmm2, 0x8(%r12)
movq $0x0, 0x18(%r12)
leaq 0x6e58(%rip), %rax      # 0x111a0
movq (%rax), %rax
testq %rax, %rax
je 0xa358
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 0x8774
movq (%r13), %r13
testq %r13, %r13
movq %rbp, %r12
jne 0xa239
leaq 0x68(%rbx), %rdi
callq 0x4d34
movq 0x6c15(%rip), %r14      # 0x10fd0
leaq 0x1e60(%rip), %rsi      # 0xc222
movl $0x5, %edx
movq %r14, %rdi
callq 0x21a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x2230
leaq 0x2117(%rip), %rsi      # 0xc4fd
movl $0x1f, %edx
movq %rax, %rdi
callq 0x21a0
movsd 0xb0(%rbx), %xmm0
addsd 0x1fbd(%rip), %xmm0     # 0xc3c0
movsd %xmm0, 0xb0(%rbx)
movq 0xc0(%rbx), %r14
testq %r14, %r14
je 0xa41f
movq %r14, %rdi
callq 0x4acc
movl $0x48, %esi
movq %r14, %rdi
callq 0x2170
movl $0x48, %edi
callq 0x2160
movq %rax, %r14
leaq 0x6818(%rip), %rax      # 0x10c58
movq %rax, (%r14)
leaq 0x6d56(%rip), %rax      # 0x111a0
movq (%rax), %rax
movq %rax, 0x18(%r14)
movq %r14, %rdi
callq 0x4856
movq 0x18(%r14), %rax
testq %rax, %rax
je 0xa4c5
movq 0x20(%rax), %rax
testq %rax, %rax
je 0xa4c5
movq %rax, 0x28(%r14)
movq 0x20(%rax), %r15
movq (%r15), %rcx
testq %rcx, %rcx
je 0xa498
xorl %eax, %eax
movl $0x1, %edx
cmpq %r14, (%rcx)
movq 0x8(%rcx), %rsi
cmovel %edx, %eax
movq %rsi, %rcx
testq %rsi, %rsi
jne 0xa482
testl %eax, %eax
jne 0xa4c5
movl $0x10, %edi
callq 0x2160
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 0x2160
leaq 0x6cc0(%rip), %r15      # 0x111a8
movq (%r15), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq 0x134(%rip), %r13       # 0xa638
movq %r13, 0x18(%rax)
xorl %r12d, %r12d
movq %r12, 0x20(%rax)
leaq 0x6c9a(%rip), %rbp      # 0x111b0
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 0x2160
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 0x2160
leaq 0x6c02(%rip), %rcx      # 0x111a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x3ec(%rip), %rcx      # 0xa1d6
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
leaq 0x6bdd(%rip), %rdx      # 0x111b0
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 0xa603
movq %rax, %rbx
jmp 0xa622
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xa622
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
movl $0x48, %esi
movq %r14, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2280
nop