// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x60(%rdi), %al
movb 0x61(%rdi), %cl
movsd 0xb0(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jne 0x889a
jp 0x889a
movq 0xc8(%rbx), %rsi
movl %eax, %edx
testq %rsi, %rsi
je 0x8878
movsd 0x20(%rsi), %xmm1
ucomisd %xmm0, %xmm1
movl %eax, %edx
jne 0x8878
jp 0x8878
movb $0x1, 0x60(%rbx)
movb $0x1, %dl
movq 0xd0(%rbx), %rsi
testq %rsi, %rsi
je 0x88ba
movsd 0x20(%rsi), %xmm1
ucomisd %xmm0, %xmm1
jne 0x88ba
jp 0x88ba
movb $0x1, 0x61(%rbx)
movb $0x1, %sil
jmp 0x88ed
jbe 0x88be
movq 0xc8(%rbx), %rdx
testq %rdx, %rdx
je 0x88be
ucomisd 0x20(%rdx), %xmm0
setnp %sil
sete %dl
andb %sil, %dl
movb %dl, 0x60(%rbx)
movl %ecx, %esi
jmp 0x88ed
ucomisd %xmm1, %xmm0
movl %ecx, %esi
movl %eax, %edx
jbe 0x88ed
movq 0xd0(%rbx), %rdi
movl %ecx, %esi
movl %eax, %edx
testq %rdi, %rdi
je 0x88ed
ucomisd 0x20(%rdi), %xmm0
setnp %dl
sete %sil
andb %dl, %sil
movb %sil, 0x61(%rbx)
movl %eax, %edx
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
sete %r8b
orb %dl, %r8b
cmpb $0x1, %r8b
jne 0x8941
xorb %sil, %cl
xorb %dl, %al
movq 0xd0(%rbx), %r14
testq %r14, %r14
sete %dl
orb %cl, %al
je 0x8941
orb %dl, %sil
je 0x8941
testq %rdi, %rdi
je 0x8949
movsd 0x20(%rdi), %xmm0
movq 0x76a0(%rip), %rdi      # 0xffd0
callq 0x2240
leaq 0x1bf0(%rip), %rsi      # 0xa52c
movq %rax, %rdi
jmp 0x8957
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x7680(%rip), %rdi      # 0xffd0
leaq 0x1bd1(%rip), %rsi      # 0xa528
callq 0x2160
movsd 0xb0(%rbx), %xmm0
movq %rax, %rdi
callq 0x2240
testq %r14, %r14
je 0x899d
leaq 0x1bb4(%rip), %rsi      # 0xa52c
movq %rax, %rdi
callq 0x2160
movq 0xd0(%rbx), %rcx
movsd 0x20(%rcx), %xmm0
movq %rax, %rdi
callq 0x2240
leaq 0x1ad4(%rip), %rsi      # 0xa46f
jmp 0x89a4
leaq 0x1b79(%rip), %rsi      # 0xa51d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2160
nop