// File: /workspace/github_cpp_makefile_star2_O1/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, 0x48(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x50(%rsp), %rdi
movapd %xmm0, 0x40(%rdi)
movapd %xmm0, 0x30(%rdi)
movapd %xmm0, 0x20(%rdi)
movapd %xmm0, 0x10(%rdi)
movapd %xmm0, (%rdi)
xorl %esi, %esi
callq 0x2f88c
xorpd %xmm0, %xmm0
movupd %xmm0, (%r14)
movq %r14, (%rsp)
movq $0x0, 0x10(%r14)
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x2f798
movq 0x60(%rsp), %rsi
cmpq %rsi, 0x80(%rsp)
je 0x2ca70
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x48(%rsp), %rdi
callq 0x28bca
movq (%rax), %r14
leaq 0x50(%rsp), %rdi
callq 0x2f850
movq %r12, %rdi
movq %r14, %rsi
callq 0x29d42
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x1f51c
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2c927
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
movq %r12, %rdi
movq %r14, %rsi
callq 0x29d42
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x1f51c
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2c956
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
movq %r14, %rdi
callq 0x29d64
movq (%rax), %rbp
movq 0x8(%rax), %r13
cmpq %r13, %rbp
je 0x2ca5d
movq %r15, 0x8(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x82cc
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
callq 0x218f9
movq %rax, %r14
movq 0x38(%rsp), %rbx
movapd 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movaps 0x80(%rsp), %xmm2
movaps 0x90(%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 0x2fe74
cmpq %rbx, %r14
jne 0x2ca3d
movq 0x80(%rsp), %rax
cmpq %rax, 0xe8(%rsp)
jne 0x2ca3d
movsd 0x28(%rsp), %xmm0
ucomisd 0x48fc(%rip), %xmm0     # 0x31328
jne 0x2ca30
jnp 0x2ca3d
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x2f798
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ca54
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
addq $0x28, %rbp
jmp 0x2c965
movq 0x60(%rsp), %rsi
cmpq %rsi, 0x80(%rsp)
jne 0x2c8e2
leaq 0x50(%rsp), %rdi
callq 0x2f806
leaq 0x30(%rsp), %rdi
callq 0x81e0
movq (%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2caaf
movq %rax, %rbx
jmp 0x2cae3
jmp 0x2caaf
jmp 0x2caaf
jmp 0x2cab6
jmp 0x2caaf
jmp 0x2cab6
jmp 0x2caaf
jmp 0x2cab6
movq %rax, %rbx
jmp 0x2cad0
jmp 0x2cab6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cad0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
callq 0x81e0
leaq 0x50(%rsp), %rdi
callq 0x2f806
leaq 0x30(%rsp), %rdi
callq 0x81e0
movq %rbx, %rdi
callq 0x5670