// File: /workspace/github_cpp_makefile_star2_O3/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 0x2fae6
xorpd %xmm0, %xmm0
movupd %xmm0, (%r14)
movq %r14, (%rsp)
movq $0x0, 0x10(%r14)
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x2f9ea
movq 0x60(%rsp), %rsi
cmpq %rsi, 0x80(%rsp)
je 0x2cc7a
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x48(%rsp), %rdi
callq 0x28dba
movq (%rax), %r14
leaq 0x50(%rsp), %rdi
callq 0x2faa2
movq %r12, %rdi
movq %r14, %rsi
callq 0x29f56
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x1f5dc
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cb31
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %r12, %rdi
movq %r14, %rsi
callq 0x29f56
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x1f5dc
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cb60
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %r14, %rdi
callq 0x29f78
movq (%rax), %rbp
movq 0x8(%rax), %r13
cmpq %r13, %rbp
je 0x2cc67
movq %r15, 0x8(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x82fa
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
callq 0x219d3
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 0x300dc
cmpq %rbx, %r14
jne 0x2cc47
movq 0x80(%rsp), %rax
cmpq %rax, 0xe8(%rsp)
jne 0x2cc47
movsd 0x28(%rsp), %xmm0
ucomisd 0x46f2(%rip), %xmm0     # 0x31328
jne 0x2cc3a
jnp 0x2cc47
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x2f9ea
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2cc5e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53b0
addq $0x28, %rbp
jmp 0x2cb6f
movq 0x60(%rsp), %rsi
cmpq %rsi, 0x80(%rsp)
jne 0x2caec
leaq 0x50(%rsp), %rdi
callq 0x2fa58
leaq 0x30(%rsp), %rdi
callq 0x8206
movq (%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ccb9
movq %rax, %rbx
jmp 0x2cced
jmp 0x2ccb9
jmp 0x2ccb9
jmp 0x2ccc0
jmp 0x2ccb9
jmp 0x2ccc0
jmp 0x2ccb9
jmp 0x2ccc0
movq %rax, %rbx
jmp 0x2ccda
jmp 0x2ccc0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ccda
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
callq 0x8206
leaq 0x50(%rsp), %rdi
callq 0x2fa58
leaq 0x30(%rsp), %rdi
callq 0x8206
movq %rbx, %rdi
callq 0x5660