// File: /workspace/github_cpp_makefile_star2_O3/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 0xa79b
jp 0xa79b
movq 0xc8(%rbx), %rsi
movl %eax, %edx
testq %rsi, %rsi
je 0xa779
movsd 0x20(%rsi), %xmm1
ucomisd %xmm0, %xmm1
movl %eax, %edx
jne 0xa779
jp 0xa779
movb $0x1, 0x60(%rbx)
movb $0x1, %dl
movq 0xd0(%rbx), %rsi
testq %rsi, %rsi
je 0xa7bb
movsd 0x20(%rsi), %xmm1
ucomisd %xmm0, %xmm1
jne 0xa7bb
jp 0xa7bb
movb $0x1, 0x61(%rbx)
movb $0x1, %sil
jmp 0xa7ee
jbe 0xa7bf
movq 0xc8(%rbx), %rdx
testq %rdx, %rdx
je 0xa7bf
ucomisd 0x20(%rdx), %xmm0
setnp %sil
sete %dl
andb %sil, %dl
movb %dl, 0x60(%rbx)
movl %ecx, %esi
jmp 0xa7ee
ucomisd %xmm1, %xmm0
movl %ecx, %esi
movl %eax, %edx
jbe 0xa7ee
movq 0xd0(%rbx), %rdi
movl %ecx, %esi
movl %eax, %edx
testq %rdi, %rdi
je 0xa7ee
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 0xa84a
xorb %sil, %cl
xorb %dl, %al
movq 0xd0(%rbx), %r15
testq %r15, %r15
sete %dl
orb %cl, %al
je 0xa84a
orb %dl, %sil
je 0xa84a
testq %rdi, %rdi
je 0xa850
movsd 0x20(%rdi), %xmm0
movq 0x679f(%rip), %rdi      # 0x10fd0
callq 0x2230
movq %rax, %r14
leaq 0x1cec(%rip), %rsi      # 0xc52c
movl $0x5, %edx
movq %rax, %rdi
jmp 0xa866
popq %rbx
popq %r14
popq %r15
retq
movq 0x6779(%rip), %r14      # 0x10fd0
leaq 0x1cca(%rip), %rsi      # 0xc528
movl $0x9, %edx
movq %r14, %rdi
callq 0x21a0
movsd 0xb0(%rbx), %xmm0
movq %r14, %rdi
callq 0x2230
movq %rax, %r14
testq %r15, %r15
je 0xa8bc
leaq 0x1ca2(%rip), %rsi      # 0xc52c
movl $0x5, %edx
movq %r14, %rdi
callq 0x21a0
movq 0xd0(%rbx), %rax
movsd 0x20(%rax), %xmm0
movq %r14, %rdi
callq 0x2230
leaq 0x1bbd(%rip), %rsi      # 0xc46f
movl $0x1, %edx
movq %rax, %rdi
jmp 0xa8cb
leaq 0x1c5a(%rip), %rsi      # 0xc51d
movl $0xa, %edx
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x21a0
nop