// File: /workspace/github_cpp_makefile_star2_O3/kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::BuildSide(IdObj*, NodeRelay**, bool)
void Node::BuildSide(IdObj *ido, NodeRelay **side, bool right)
{
    auto compare = [right](double x, double y) -> bool {
        if (right) {
            return x > y;
        } else
        {
            return x < y;
        }
    };

    if (*side == NULL) { // link not yet defined
        //std::cout << "Node " << num << ": creating link to " << ido->num
        //          << ".\n";
        if (ido->num < MAX) {
            *side = new NodeRelay(ido);//do not link to leaving nodes

            if (right) {

                rightstable = false;
            } else {

                leftstable = false;
            }
        } else {
            delete ido; //ido references to a leaving node.
        }
    } else {
        if (compare(ido->num, (*side)->num)) { // ido beyond link
            //std::cout << "Node " << num << ": forwarding " << ido->num
            //          << " to " << (*side)->num << ".\n";
            (*side)->out->call(Node::BuildList, ido);
        } else {
            // ido between node and link
            if (idle((*side)->out)) {
                //std::cout << "Node " << num << ": new side " << ido->num
                //          << ", forwarding " << (*side)->num << ".\n";
                IdObj *tempido = new IdObj((*side)->num,
                                           extractIdentity((*side)->out),
                                           (*side)->debugID);

                if (right) {
                    rightstable = (rightstable && (*side)->num == ido->num);
                } else {
                    leftstable = (leftstable && (*side)->num == ido->num);
                }
                delete *side;
                (*side) = new NodeRelay(ido);
                (*side)->out->call(Node::BuildList, tempido);
            } else {
                call(Node::BuildList, ido);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdx), %rax
movsd 0x20(%rsi), %xmm0
testq %rax, %rax
je 0xa974
movsd 0x20(%rax), %xmm1
xorl %ecx, %ecx
ucomisd %xmm1, %xmm0
seta %cl
xorl %edx, %edx
ucomisd %xmm0, %xmm1
seta %dl
testb %bpl, %bpl
cmovnel %ecx, %edx
movq 0x28(%rax), %r15
cmpb $0x1, %dl
jne 0xa9b4
movl $0x38, %edi
callq 0x2160
leaq 0x6871(%rip), %rcx      # 0x111a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x35ef(%rip), %rcx     # 0x7364
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 0xac2e
movsd 0x1a44(%rip), %xmm1     # 0xc3c0
ucomisd %xmm0, %xmm1
jbe 0xaa7e
movl $0x38, %edi
callq 0x2160
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x3d6c
movq %r15, (%r12)
testb %bpl, %bpl
je 0xaaef
movb $0x0, 0x61(%rbx)
jmp 0xaaf3
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x58(%rax)
movl %eax, %r13d
movl $0x38, %edi
callq 0x2160
movq %rax, %r15
testl %r13d, %r13d
je 0xaa99
movq (%r12), %rax
movq %rax, 0x10(%rsp)
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x67ac(%rip), %rax      # 0x111a0
movq (%rax), %r13
testq %r13, %r13
je 0xab02
cmpq $0x0, 0x10(%rbx)
jne 0xaa12
cmpq $0x0, 0x8(%rbx)
jne 0xab05
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
je 0xab05
cmpq %rbx, 0x18(%rax)
jne 0xab05
movq %rax, 0x18(%rsp)
movl $0x28, %edi
callq 0x2160
movq %rax, 0x8(%rsp)
leaq 0x673f(%rip), %rax      # 0x11188
movq (%rax), %rcx
movq 0x8(%rsp), %rdx
movq %rcx, (%rdx)
incq %rcx
movq %rcx, (%rax)
movq %r13, 0x8(%rdx)
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r13
movq %r13, 0x10(%rdx)
cmpl $0x0, 0x14(%rax)
je 0xac44
movq 0x20(%rbx), %rax
jmp 0xac46
movl $0x38, %esi
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
leaq 0x6708(%rip), %rax      # 0x111a8
movq (%rax), %rcx
movq %rcx, (%r15)
incq %rcx
movq %rcx, (%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%r15)
leaq -0x3759(%rip), %rax     # 0x7364
movq %rax, 0x18(%r15)
xorl %eax, %eax
movq %rax, 0x20(%r15)
movq %r14, 0x28(%r15)
movq %rax, 0x30(%r15)
movq (%rbx), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
movq %rbx, %rsi
movq %r15, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movb $0x0, 0x60(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rax
movl 0x30(%rax), %eax
leaq 0x666b(%rip), %rcx      # 0x11188
movq (%rcx), %rdx
movq %rdx, (%r15)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%r15)
movq $0x0, 0x18(%r15)
testq %r13, %r13
je 0xab4a
movq %r15, %rcx
addq $0x8, %rcx
movq %r13, (%rcx)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%r15)
movq 0x8(%rsp), %rcx
movq %rcx, 0x28(%r15)
movl %eax, 0x30(%r15)
testb %bpl, %bpl
je 0xab89
cmpb $0x1, 0x61(%rbx)
jne 0xabaa
movsd 0x20(%r14), %xmm0
movq 0x10(%rsp), %rax
cmpeqsd 0x20(%rax), %xmm0
movq %xmm0, %rax
andl $0x1, %eax
jmp 0xabac
cmpb $0x1, 0x60(%rbx)
jne 0xabb1
movsd 0x20(%r14), %xmm0
movq 0x10(%rsp), %rax
cmpeqsd 0x20(%rax), %xmm0
movq %xmm0, %rax
andl $0x1, %eax
jmp 0xabb3
xorl %eax, %eax
movb %al, 0x61(%rbx)
jmp 0xabb6
xorl %eax, %eax
movb %al, 0x60(%rbx)
movl $0x38, %esi
movq 0x10(%rsp), %rdi
callq 0x2170
movl $0x38, %edi
callq 0x2160
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x3d6c
movq %r13, (%r12)
movq 0x28(%r13), %r14
movl $0x38, %edi
callq 0x2160
leaq 0x65b2(%rip), %rcx      # 0x111a8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rax)
leaq -0x38ae(%rip), %rcx     # 0x7364
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %r15, 0x28(%rax)
movq %rcx, 0x30(%rax)
movq (%r14), %rcx
movq 0x8(%rcx), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movq %rax, 0x18(%rcx)
movq 0x18(%rsp), %rdi
movq 0x30(%rdi), %rax
movq %rax, 0x20(%rcx)
testq %r13, %r13
je 0xac98
movl $0x18, %edi
callq 0x2160
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x40(%r13), %rcx
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0xac84
movq %rax, (%rdx)
movq %rdx, 0x8(%rax)
movq %rcx, (%rax)
movq %rax, 0x8(%rcx)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x28(%rax)
movq (%r12), %rax
movq %rax, 0x10(%rsp)
leaq 0x64e5(%rip), %rax      # 0x111a0
movq (%rax), %r13
jmp 0xab0e
jmp 0xacc5
movq %rax, %rbx
jmp 0xacd0
movq %rax, %rbx
movq %r13, %r15
movl $0x38, %esi
movq %r15, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2280
nop