// File: /workspace/github_cpp_makefile_star2_O2/kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::Init(InitObj*)
Action Node::Init(InitObj *init)
{
    // Initialize pointers and relays
    left = NULL;
    right = NULL;
    node0 = NULL;
    node1 = NULL;
    in = new Relay;

    // Unpack initstructor object:
    num = init->num;
    isReal = init->isReal;
    csvFile = init->csvFile;
    delete init;

    if (isReal) {
        node0left = node1left = false;
        //std::cout << num << " initialized\n";
        // connect to supervisor:
        IdPair *idp = new IdPair(new IdObj(num, new Identity(in), _debugID),
                                 new IdObj(num, new Identity(in), _debugID));
        parent->call(Supervisor::SetLink, idp);

        // create virtual nodes:

        std::shared_ptr<std::ofstream> tmpfile0(csvFile);
        InitObj *n0 = new InitObj(num / 2, false, tmpfile0);
        auto tmpnode0 = (Subject *) new Node((Object* &) n0);

        std::shared_ptr<std::ofstream> tmpfile1(csvFile);
        InitObj *n1 = new InitObj((1 + num) / 2, false, tmpfile1);
        auto tmpnode1 = (Subject *) new Node((Object* &) n1);
        NodePair *np = new NodePair(tmpnode0, tmpnode1);
        parent->call(Supervisor::AddVirtuals, np);
        _create((Subject *) this, (Subject *) tmpnode0);
        _create((Subject *) this, (Subject *) tmpnode1);
    } else {
        //std::cout << "virtual node init: " << num << "\n";
        IdObj *tempid = new IdObj(num, new Identity(in), _debugID);
        parent->call(Node::ConnectChild, tempid);
    }

    //std::cout << num << "\t" << _debugID << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rdi)
movups %xmm0, 0xc8(%rdi)
pushq $0x48
popq %rdi
callq 0x2170
movq %rax, %r14
movq %rax, %rdi
callq 0x927c
movq %r14, 0xc0(%rbx)
movsd 0x28(%r15), %xmm0
movsd %xmm0, 0xb0(%rbx)
movb 0x20(%r15), %al
movb %al, 0xb8(%rbx)
leaq 0x30(%r15), %rsi
leaq 0xa0(%rbx), %r14
movq %r14, %rdi
callq 0x3a68
leaq 0x38(%r15), %rdi
callq 0x3978
pushq $0x40
popq %rsi
movq %r15, %rdi
callq 0x2180
cmpb $0x1, 0xb8(%rbx)
jne 0x6081
andw $0x0, 0x62(%rbx)
pushq $0x30
popq %rdi
callq 0x2170
pushq $0x38
popq %rdi
movq %rax, 0x8(%rsp)
callq 0x2170
movq %rax, %r12
movsd 0xb0(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
pushq $0x28
popq %rdi
callq 0x2170
movq %rax, %r13
movq 0xc0(%rbx), %rsi
movq %rax, %rdi
callq 0x92c2
movl 0x8(%rbx), %ebp
movq %r12, %rdi
callq 0x3a32
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x20(%r12)
movq %r13, 0x28(%r12)
movl %ebp, 0x30(%r12)
pushq $0x38
popq %rdi
callq 0x2170
movq %rax, %r13
movsd 0xb0(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
pushq $0x28
popq %rdi
callq 0x2170
movq %rax, %rbp
movq 0xc0(%rbx), %rsi
movq %rax, %rdi
callq 0x92c2
movl 0x8(%rbx), %r15d
movq %r13, %rdi
callq 0x3a32
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x20(%r13)
movq %rbp, 0x28(%r13)
movl %r15d, 0x30(%r13)
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3a32
movq %r12, 0x20(%r15)
movq %r13, 0x28(%r15)
movq 0x28(%rbx), %r12
pushq $0x38
popq %rdi
callq 0x2170
leaq 0xa31b(%rip), %rbp      # 0x101b8
movq (%rbp), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
leaq -0x3899(%rip), %rcx     # 0x2620
movq %rcx, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r15, 0x28(%rax)
andq $0x0, 0x30(%rax)
movq (%r12), %rcx
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq *0x8(%rcx)
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x39fe
pushq $0x40
popq %rdi
callq 0x2170
movq %rax, %r15
movsd 0xb0(%rbx), %xmm0
mulsd 0x44bd(%rip), %xmm0     # 0xa3c0
movsd %xmm0, 0x8(%rsp)
leaq 0x58(%rsp), %r12
leaq 0x38(%rsp), %rsi
movq %r12, %rdi
callq 0x39fe
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
movq %r12, %rdx
callq 0x3608
leaq 0x60(%rsp), %rdi
callq 0x3978
movq %r15, 0x30(%rsp)
movl $0xe8, %edi
callq 0x2170
movq %rax, %r15
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0x3650
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x39fe
pushq $0x40
popq %rdi
callq 0x2170
movq %rax, %r14
movsd 0xb0(%rbx), %xmm0
addsd 0x4449(%rip), %xmm0     # 0xa3c8
mulsd 0x4439(%rip), %xmm0     # 0xa3c0
movsd %xmm0, 0x8(%rsp)
leaq 0x48(%rsp), %r12
leaq 0x20(%rsp), %rsi
movq %r12, %rdi
callq 0x39fe
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
movq %r12, %rdx
callq 0x3608
leaq 0x50(%rsp), %rdi
callq 0x3978
movq %r14, 0x18(%rsp)
movl $0xe8, %edi
callq 0x2170
movq %rax, %r14
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x3650
pushq $0x30
popq %rdi
callq 0x2170
movq %rax, %r12
movq %rax, %rdi
callq 0x3a32
movq %r15, 0x20(%r12)
movq %r14, 0x28(%r12)
movq 0x28(%rbx), %r13
pushq $0x38
popq %rdi
callq 0x2170
movq (%rbp), %rcx
movq %rcx, (%rax)
incq %rcx
movq %rcx, (%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
leaq -0x33e6(%rip), %rcx     # 0x2c3a
movq %rcx, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r12, 0x28(%rax)
andq $0x0, 0x30(%rax)
movq (%r13), %rcx
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq *0x8(%rcx)
movq %rbx, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x370c
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x370c
leaq 0x28(%rsp), %rdi
callq 0x3978
leaq 0x40(%rsp), %rdi
callq 0x3978
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x38
popq %rdi
callq 0x2170
movq %rax, %r14
movsd 0xb0(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
pushq $0x28
popq %rdi
callq 0x2170
movq %rax, %r15
movq 0xc0(%rbx), %rsi
movq %rax, %rdi
callq 0x92c2
movl 0x8(%rbx), %ebp
movq %r14, %rdi
callq 0x3a32
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x20(%r14)
movq %r15, 0x28(%r14)
movl %ebp, 0x30(%r14)
movq 0x28(%rbx), %r15
pushq $0x38
popq %rdi
callq 0x2170
leaq 0xa0d2(%rip), %rcx      # 0x101b8
movq (%rcx), %rdx
movq %rdx, (%rax)
incq %rdx
movq %rdx, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
leaq 0xfc(%rip), %rcx        # 0x61fc
movq %rcx, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r14, 0x28(%rax)
andq $0x0, 0x30(%rax)
movq (%r15), %rcx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movq %rax, %rbx
movl $0xe8, %esi
movq %r14, %rdi
callq 0x2180
jmp 0x61df
jmp 0x61dc
jmp 0x61dc
movq %rax, %rbx
movl $0xe8, %esi
movq %r15, %rdi
callq 0x2180
jmp 0x61e9
jmp 0x6168
movq %rax, %rbx
jmp 0x61e9
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %rbp, %rdi
callq 0x2180
jmp 0x6180
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r13, %rdi
jmp 0x61b1
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %r13, %rdi
callq 0x2180
jmp 0x61ab
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x2180
jmp 0x61bb
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r12, %rdi
callq 0x2180
jmp 0x61c2
movq %rax, %rbx
pushq $0x38
jmp 0x61d1
movq %rax, %rbx
pushq $0x30
popq %rsi
movq 0x8(%rsp), %rdi
jmp 0x61d5
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x2180
jmp 0x61f3
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3978
leaq 0x40(%rsp), %rdi
callq 0x3978
movq %rbx, %rdi
callq 0x2290
nop