// File: /workspace/github_cpp_makefile_star2_O1/kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::checkStable(double)
void Node::checkStable(double id)
{
    bool changedleftstable = leftstable;
    bool changedrightstable = rightstable;

    if (id == num) {
        if (left != NULL && left->num == id) {
            leftstable = true;
        }

        if (right != NULL && right->num == id) {
            rightstable = true;
        }

    } else if (id < num && left != NULL) {
        leftstable = left->num == id;
    } else if (id > num && right != NULL) {
        rightstable = right->num == id;
    }

    changedleftstable = changedleftstable != leftstable;
    changedrightstable = changedrightstable != rightstable;

    if ((leftstable || left == NULL) && (rightstable || right == NULL) && (changedleftstable || changedrightstable)) {
        //if((leftstable) && (rightstable) &&  (changedleftstable || changedrightstable)) {
        if (left != NULL && right != NULL) {
            std::cout << left->num << " <-> " << num << " <-> " << right->num << "\n";
        } else if (left != NULL) {
            std::cout << left->num << " <-> " << num << " <-> NULL\n";
        } else if (right != NULL) {
            std::cout << "NULL <-> " << num << " <-> " << right->num << "\n";
        } else {
            std::cout << "NULL <-> " << num << " <-> NULL\n";
        }
    }


}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb 0x60(%rdi), %al
movb 0x61(%rdi), %cl
movsd 0xb0(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jne 0xb6da
jp 0xb6da
movq 0xc8(%rbx), %rdx
testq %rdx, %rdx
je 0xb6bb
movsd 0x20(%rdx), %xmm1
ucomisd %xmm0, %xmm1
jne 0xb6bb
jp 0xb6bb
movb $0x1, 0x60(%rbx)
movq 0xd0(%rbx), %rdx
testq %rdx, %rdx
je 0xb722
movsd 0x20(%rdx), %xmm1
ucomisd %xmm0, %xmm1
jne 0xb722
jp 0xb722
movb $0x1, 0x61(%rbx)
jmp 0xb722
jbe 0xb6fd
movq 0xc8(%rbx), %rdx
testq %rdx, %rdx
je 0xb6fd
ucomisd 0x20(%rdx), %xmm0
setnp %dl
sete %sil
andb %dl, %sil
movb %sil, 0x60(%rbx)
jmp 0xb722
ucomisd %xmm1, %xmm0
jbe 0xb722
movq 0xd0(%rbx), %rdx
testq %rdx, %rdx
je 0xb722
ucomisd 0x20(%rdx), %xmm0
setnp %dl
sete %sil
andb %dl, %sil
movb %sil, 0x61(%rbx)
movb 0x60(%rbx), %sil
movq 0xc8(%rbx), %rdx
testq %rdx, %rdx
sete %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0xb7c4
movb 0x61(%rbx), %dil
xorb %dil, %cl
xorb %sil, %al
movq 0xd0(%rbx), %r15
testq %r15, %r15
sete %sil
orb %dil, %sil
orb %cl, %al
andb %sil, %al
cmpb $0x1, %al
jne 0xb7c4
testq %r15, %r15
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
je 0xb7ca
testq %rdx, %rdx
je 0xb845
movsd 0x20(%rdx), %xmm0
movq 0x6846(%rip), %rdi      # 0x11fd0
callq 0x3230
movq %rax, %r14
leaq 0x1d93(%rip), %rsi      # 0xd52c
movl $0x5, %edx
movq %rax, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x3230
leaq 0x1d60(%rip), %rsi      # 0xd51d
movl $0xa, %edx
jmp 0xb838
popq %rbx
popq %r14
popq %r15
retq
movsd 0x20(%rdx), %xmm0
movq 0x67fa(%rip), %rdi      # 0x11fd0
callq 0x3230
movq %rax, %r14
leaq 0x1d47(%rip), %r15      # 0xd52c
movl $0x5, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x3230
movq %rax, %r14
movl $0x5, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x31a0
movq 0xd0(%rbx), %rax
movsd 0x20(%rax), %xmm0
movq %r14, %rdi
callq 0x3230
leaq 0x1c3c(%rip), %rsi      # 0xd46f
movl $0x1, %edx
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x31a0
movq 0x6784(%rip), %r14      # 0x11fd0
leaq 0x1cd5(%rip), %rsi      # 0xd528
movl $0x9, %edx
movq %r14, %rdi
callq 0x31a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x3230
movq %rax, %r14
testq %r15, %r15
je 0xb889
leaq 0x1cad(%rip), %rsi      # 0xd52c
movl $0x5, %edx
movq %r14, %rdi
jmp 0xb813
leaq 0x1c8d(%rip), %rsi      # 0xd51d
movl $0xa, %edx
movq %r14, %rdi
jmp 0xb83b