// File: /workspace/github_cpp_makefile_star2_O2/GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2Support.cpp
// Function: GPX2Support::findPartition(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*>>>&)
vector<string> GPX2Support::findPartition(const string nodeOne, GPX2Structs::NodeMap &unitedGraph)
{ //Given a value, this method will use nodeOne as a root which will be the first point of the search in Gu', when it finds the partition in which the node is contained the method will return a vector with the ids of the citites that compose the partition

    Node* root; // node to be verified
    vector<string> idAlreadyVisited; // visited nodes list
    deque<string> nextToVisit; // list of the next nodes to visit
    vector<string> partition;

    bool notAlreadyVisited{ false };
    bool notToVisit{ false };
    bool notCut{ false };

    nextToVisit.push_back(nodeOne); // first node to be visited

    while (!nextToVisit.empty()) { // while there are nodes to visit
        root = unitedGraph[nextToVisit.front()]; // node in which the BFS will start
        nextToVisit.pop_front(); // Removes the node from the list
        partition.push_back(root->getId()); // inserts the node in the partition
        idAlreadyVisited.push_back(root->getId()); // Nodes in the "Already visited" list

        for (Node::node n : root->getEdges()) { //goes through the connected edges
            notAlreadyVisited = find(idAlreadyVisited.begin(), idAlreadyVisited.end(), n.first) == idAlreadyVisited.end(); // checks if the edge was visited
            notToVisit = find(nextToVisit.begin(), nextToVisit.end(), n.first) == nextToVisit.end(); //checks if it isn't in the list to be visited
            notCut = n.second != 0; // checks if the edge was "cut"
            if (notAlreadyVisited && notToVisit && notCut) { // case if all conditions are satisfied
                nextToVisit.push_back(
                    n.first); // puts in the list of the next to be visited
            }
        }
    }
    return (partition); // returns a vector with the partition
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %r13
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x25e64
xorpd %xmm0, %xmm0
movupd %xmm0, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x25ce4
leaq 0x78(%rsp), %r12
movq 0x38(%rsp), %rsi
cmpq %rsi, 0x58(%rsp)
je 0x23f22
movq 0x20(%rsp), %rdi
callq 0x20910
movq (%rax), %r14
leaq 0x28(%rsp), %rdi
callq 0x25dba
movq %r12, %rdi
movq %r14, %rsi
callq 0x21bf4
movq %r13, %rdi
movq %r12, %rsi
callq 0x1940c
movq %r12, %rdi
callq 0x56f8
movq %r12, %rdi
movq %r14, %rsi
callq 0x21bf4
movq %rsp, %rdi
movq %r12, %rsi
callq 0x1940c
movq %r12, %rdi
callq 0x56f8
movq %r14, %rdi
callq 0x21c02
movq (%rax), %r14
movq 0x8(%rax), %rbp
cmpq %rbp, %r14
je 0x23de4
movq %r12, %rdi
movq %r14, %rsi
callq 0x209fc
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
callq 0x1abd1
movq %rax, %r15
movq %r13, %rbx
movq 0x8(%rsp), %r13
movupd 0x38(%rsp), %xmm0
movups 0x48(%rsp), %xmm1
movups 0x58(%rsp), %xmm2
movups 0x68(%rsp), %xmm3
movapd %xmm0, 0xc0(%rsp)
movaps %xmm1, 0xd0(%rsp)
movaps %xmm2, 0xa0(%rsp)
movaps %xmm3, 0xb0(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
movq %r12, %rcx
callq 0x25d2c
cmpq %r13, %r15
jne 0x23f0e
movq 0x58(%rsp), %rax
cmpq %rax, 0xe8(%rsp)
jne 0x23f0e
movsd 0x98(%rsp), %xmm0
ucomisd 0x33fb(%rip), %xmm0     # 0x272f8
jne 0x23f01
jnp 0x23f0e
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x25ce4
movq %r12, %rdi
callq 0x56f8
addq $0x28, %r14
movq %rbx, %r13
jmp 0x23e56
leaq 0x28(%rsp), %rdi
callq 0x25d6e
movq %rsp, %rdi
callq 0x709c
movq %r13, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x23f5e
movq %rax, %r14
jmp 0x23f8a
jmp 0x23f5e
jmp 0x23f63
jmp 0x23f5e
jmp 0x23f5e
jmp 0x23f5e
jmp 0x23f63
jmp 0x23f68
movq %rax, %r14
jmp 0x23f78
movq %rax, %r14
jmp 0x23f6e
movq %rax, %r14
movq %rbx, %r13
leaq 0x78(%rsp), %rdi
callq 0x56f8
movq %r13, %rdi
callq 0x709c
leaq 0x28(%rsp), %rdi
callq 0x25d6e
movq %rsp, %rdi
callq 0x709c
movq %r14, %rdi
callq 0x5610