// File: /workspace/github_cpp_makefile_star2_O3/GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2Support.cpp
// Function: GPX2Support::insertGhost(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Node*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, Node*>>>&, Node*)
void GPX2Support::insertGhost(string& id, GPX2Structs::NodeMap& tour, Node* ghost)
{
    Node::node edgeFirst = tour[id]->getEdges()[0]; // edge to be added to the ghostNode
    tour[id]->deleteEdge(0); // delete edge
    tour[id]->addEdge(Node::node(ghost->getId(), 0)); // Adds to the original node the linking edge with the ghost

    for (unsigned i = 0; i < 2; i++) {
        // goes by the linking edges with the node connected with the ghost
        Node::node edge = tour[edgeFirst.first]->getEdges()[i];

        if (edge.first.compare(id) == 0) { // checks if it is the connection

            //adds the connection to the ghost and removes it from the original node
            tour[edgeFirst.first]->deleteEdge(i);
            tour[edgeFirst.first]->addEdge(Node::node(ghost->getId(), edgeFirst.second));
        }
    }

    ghost->addEdge(edgeFirst); // connects the ghost to the edge
    ghost->setAccess(true);
    ghost->addEdge(Node::node(tour[id]->getId(), 0)); // adds the original node as and edge of the ghost

    tour.insert(make_pair(ghost->getId(), ghost)); // inserts the ghost in the parent map
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, 0x28(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
movq %r15, %rsi
callq 0x28dba
movq (%rax), %rdi
callq 0x29f78
movq (%rax), %rbx
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %r12
movq %r12, %rdi
callq 0x82fa
movsd 0x20(%rbx), %xmm0
movsd %xmm0, 0x20(%r12)
movq %r14, 0x30(%rsp)
movq %r14, %rdi
movq %r15, 0x80(%rsp)
movq %r15, %rsi
callq 0x28dba
movq (%rax), %rdi
xorl %esi, %esi
callq 0x29fa2
movq 0x30(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x28dba
movq (%rax), %r12
movq %rsp, %rdi
movq 0x28(%rsp), %rsi
callq 0x29f56
leaq 0xe8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x10(%rsp), %rbx
movq -0x10(%rbx), %rax
cmpq %rbx, %rax
je 0x2d2b6
movq %rax, 0xd8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x2d2bd
movups (%rbx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rsp), %rax
leaq 0xd8(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %rbx, (%rsp)
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rax, 0x20(%rsi)
movq %r12, %rdi
callq 0x29f98
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d307
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x2d31d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
leaq 0x98(%rsp), %r12
movb $0x1, %r14b
xorl %ebp, %ebp
movq %rsp, %r13
movq 0x30(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x28dba
movq (%rax), %rdi
callq 0x29f78
movq (%rax), %r15
leaq (,%rbp,4), %rbx
addq %rbp, %rbx
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq (%r15,%rbx,8), %rsi
movq 0x8(%r15,%rbx,8), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x82fa
leaq (%r15,%rbx,8), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r13, %rdi
movq 0x80(%rsp), %rsi
leaq 0x10(%rsp), %r15
callq 0x5050
testl %eax, %eax
jne 0x2d484
movq 0x30(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x28dba
movq (%rax), %rdi
movl %ebp, %esi
callq 0x29fa2
movq 0x30(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x28dba
movq (%rax), %rbp
leaq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x29f56
movq %r12, %rbx
movq %r12, 0x88(%rsp)
movq 0x38(%rsp), %rax
leaq 0x48(%rsp), %rcx
cmpq %rcx, %rax
je 0x2d406
movq %rax, 0x88(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0x2d40c
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x40(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rcx, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq %rbp, %rdi
leaq 0x88(%rsp), %rsi
callq 0x29f98
movq 0x88(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2d468
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2d484
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x2d49a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movl $0x1, %ebp
testb $0x1, %r14b
movl $0x0, %r14d
jne 0x2d32d
leaq 0x110(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x82fa
movsd 0x78(%rsp), %xmm0
leaq 0x100(%rsp), %rsi
movsd %xmm0, 0x20(%rsi)
movq 0x28(%rsp), %rdi
callq 0x29f98
movq 0x100(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d50f
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x29f92
movq 0x30(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x28dba
movq (%rax), %rsi
movq %rsp, %rdi
callq 0x29f56
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsp), %rax
cmpq %r15, %rax
je 0x2d567
movq %rax, 0xb0(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xc0(%rsp)
jmp 0x2d56f
movups (%r15), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rsp), %rax
leaq 0xb0(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %r15, (%rsp)
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rax, 0x20(%rsi)
movq 0x28(%rsp), %rdi
callq 0x29f98
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d5bb
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %r15, %rdi
leaq 0x48(%rsp), %rbx
je 0x2d5d6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
leaq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x29f56
movq %r15, (%rsp)
movq 0x38(%rsp), %rax
cmpq %rbx, %rax
je 0x2d603
movq %rax, (%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x2d60a
movups (%rbx), %xmm0
movups %xmm0, (%r15)
movq 0x40(%rsp), %rax
movq %rsp, %rsi
movq %rax, 0x8(%rsi)
movq %rbx, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsi)
movq 0x30(%rsp), %rdi
callq 0x29644
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x2d652
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2d669
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2d685
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x53b0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x2d6b0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2d7ac
movq 0x48(%rsp), %rsi
jmp 0x2d79f
jmp 0x2d7a9
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d72d
movq 0xc0(%rsp), %rsi
jmp 0x2d725
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d7ac
movq 0x110(%rsp), %rsi
jmp 0x2d79f
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d72d
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
jne 0x2d79a
jmp 0x2d7ac
jmp 0x2d7a9
jmp 0x2d7a9
jmp 0x2d7a9
movq %rbx, %rcx
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %rcx, %rdi
je 0x2d766
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2d787
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x53b0
jmp 0x2d787
movq %rax, %rbx
leaq 0x10(%rsp), %r15
jmp 0x2d791
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x2d7ac
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
jmp 0x2d7ac
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq 0x58(%rsp), %rdi
cmpq %rax, %rdi
je 0x2d7c8
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %rbx, %rdi
callq 0x5660