// File: /workspace/github_cpp_makefile_star2_O1/kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::doListHop(SearchJob*)
void Node::doListHop(SearchJob *sj)
{
    double hashedkey = sj->sid;
    if (left == NULL && right == NULL) {
        //std::cout << "SearchJob " << sj->sid << " waiting at " << num << " (3)\n";
        call(Node::Search, sj);//because of virtual nodes, every node will eventually have at least one neighbor
        return;
    }
    //do normal routing if possible
    if (hashedkey < num) {
        if (left == NULL) {
            delegateSearchJobToLastNode(sj);
            return;
        } else if (leftstable) {
            sj->round++;
            sj->hopcount++;
            if (sj->type == LOOKUP || sj->type == INSERT || sj->type == DELETE) {
                std::cout << "(" << sj->_debugID << ") " << num << "<-doListHop(" <<  sj->sid << ") to left \n";
            }
            left->out->call(Node::Search, sj);
            return;
        } else {
            //std::cout << "SearchJob " << sj->sid << " waiting at " << num << " (4)\n";
            call(Node::Search, sj);
            return;
        }
    } else if (hashedkey >= num) {//find the right end of a sequence of nodes with the same id
        if (rightstable) {//at this point right must be !=NULL, otherwise we would not reach this point
            sj->round++;
            sj->hopcount++;
            if (sj->type == LOOKUP || sj->type == INSERT || sj->type == DELETE) {
                std::cout << "(" << sj->_debugID << ") " << num << "<-doListHop(" <<  sj->sid << ") to right \n";
            }
            right->out->call(Node::Search, sj);
            return;
        } else {
            //std::cout << "SearchJob " << sj->sid << " waiting at " << num << " (5)\n";
            call(Node::Search, sj);
            return;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0xc8(%rdi), %rax
movq 0xd0(%rdi), %rcx
orq %rax, %rcx
jne 0xab20
movl $0x38, %edi
callq 0x3160
leaq 0x76cd(%rip), %rcx      # 0x121a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x13cd(%rip), %rcx     # 0x972a
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq (%rbx), %rcx
movq 0x48(%rcx), %rcx
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %r15
jmpq *%rcx
movsd 0x20(%r14), %xmm0
movsd 0xb0(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xabec
testq %rax, %rax
je 0xacf4
cmpb $0x1, 0x60(%rbx)
jne 0xaaca
incl 0x48(%r14)
incl 0x4c(%r14)
cmpl $0x2, 0x38(%r14)
ja 0xabe0
movq 0x746f(%rip), %r15      # 0x11fd0
leaq 0x28f5(%rip), %rsi      # 0xd45d
movl $0x1, %edx
movq %r15, %rdi
callq 0x31a0
movq (%r14), %rsi
movq %r15, %rdi
callq 0x30e0
movq %rax, %r15
leaq 0x28ac(%rip), %rsi      # 0xd436
movl $0x2, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r15, %rdi
callq 0x3230
movq %rax, %r15
leaq 0x28ef(%rip), %rsi      # 0xd4a0
movl $0xc, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0x20(%r14), %xmm0
movq %r15, %rdi
callq 0x3230
leaq 0x28da(%rip), %rsi      # 0xd4ad
movl $0xb, %edx
movq %rax, %rdi
callq 0x31a0
movq 0xc8(%rbx), %rax
jmp 0xaca2
ucomisd %xmm1, %xmm0
jae 0xabf8
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x1, 0x61(%rbx)
jne 0xaaca
incl 0x48(%r14)
incl 0x4c(%r14)
cmpl $0x2, 0x38(%r14)
ja 0xac9b
movq 0x73b4(%rip), %r15      # 0x11fd0
leaq 0x283a(%rip), %rsi      # 0xd45d
movl $0x1, %edx
movq %r15, %rdi
callq 0x31a0
movq (%r14), %rsi
movq %r15, %rdi
callq 0x30e0
movq %rax, %r15
leaq 0x27f1(%rip), %rsi      # 0xd436
movl $0x2, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r15, %rdi
callq 0x3230
movq %rax, %r15
leaq 0x2834(%rip), %rsi      # 0xd4a0
movl $0xc, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0x20(%r14), %xmm0
movq %r15, %rdi
callq 0x3230
leaq 0x282b(%rip), %rsi      # 0xd4b9
movl $0xc, %edx
movq %rax, %rdi
callq 0x31a0
movq 0xd0(%rbx), %rax
movq 0x28(%rax), %r15
movl $0x38, %edi
callq 0x3160
leaq 0x74f1(%rip), %rcx      # 0x121a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x15a9(%rip), %rcx     # 0x972a
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq (%r15), %rcx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
jmp 0xab13
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x20(%r14)
movl $0x0, 0x48(%r14)
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x972a