// File: kiudee[P]VAHD-Projekt/./Subjects1-6.h
// Function: Subject::_extract(Subject*, Relay*&)
Identity *Subject::_extract(Subject *s, Relay* &r)
{
    Identity *id;
    _idLinks *idl;

    id = NULL;
    if (_activeSubject == NULL || (_parent == NULL && _debugID > 0)) {
        if (WARNING) {
            std::cout << "-- Warning! " << _debugID << "called 'delete' outside of the subjects environment.\n";
        }
    } else {
        if (r == NULL) {
            if (WARNING) {
                std::cout << "-- Warning! " << _debugID << " cannot destruct NULL.\n";
            }
        } else {
            if (s != this) {
                if (WARNING) {
                    std::cout << "-- Warning! " << s->_debugID << " cannot call 'delete' for subject " << _debugID << ".\n";
                }
            } else {
                if (s != r->_home) {
                    if (WARNING) {
                        std::cout << "-- Warning! " << _debugID << " cannot call 'delete' for relay " << r->ID << ".\n";
                    }
                } else {
                    id = new Identity;
                    id->_source = r->_oLink;
                    if (r->_private) {
                        id->_sink = _sink;
                    } else {
                        id->_sink = NULL;
                    }
                    id->_base = r->_base;
                    if (id->_source != NULL) {
                        idl = new _idLinks(id);  // add identity at beginning of list
                        if (id->_source->_identities->next != NULL) {
                            id->_source->_identities->next->prev = idl;
                        }
                        idl->next = id->_source->_identities->next;
                        idl->prev = id->_source->_identities;
                        id->_source->_identities->next = idl;
                    }
                    r->_destruct();  // delete relay r
                    r = NULL;
                }
            }
        }
    }
    return id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x20(%rbp)
leaq 0xbbf5(%rip), %rax      # 0x21210
cmpq $0x0, (%rax)
je 0x15637
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x1563c
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jbe 0x1563c
jmp 0x157de
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1564b
jmp 0x157dc
movq -0x40(%rbp), %rax
cmpq %rax, -0x10(%rbp)
je 0x1565a
jmp 0x157da
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x18(%rcx), %rax
je 0x15670
jmp 0x157d8
movl $0x28, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
callq 0x15d70
jmp 0x1568b
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x14(%rax)
je 0x156e4
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x156f0
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x28, %esi
callq 0x31d0
jmp 0x157e8
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x157c0
movl $0x18, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rsi
callq 0x73b0
jmp 0x15731
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x15781
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
jmp 0x15781
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x18, %esi
callq 0x31d0
jmp 0x157e8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
jmp 0x157da
jmp 0x157dc
jmp 0x157de
movq -0x20(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x3330
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)