// File: /workspace/github_cpp_makefile_star2_O3/GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2Support.cpp
// Function: GPX2Support::DFS_outside(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<int, Partition*, std::less<int>, std::allocator<std::pair<int const, Partition*>>>&, 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*>>>&)
pair<GPX2Structs::SearchResult, vector<string>> GPX2Support::DFS_outside(string id, GPX2Structs::PartitionMap &partitions, GPX2Structs::NodeMap &unitedGraph)
{
    string now;
    int idPartition = whichPartition(id, partitions);
    vector<string> partition = partitions[idPartition]->getNodes();
    vector<string> alreadyVisited;
    deque<string> nextToVisit;
    int partitionConnected{ -1 };
    bool notAlreadyVisited{ false };
    bool notToVisit{ false };
    bool cutEdge{ false };

    nextToVisit.push_back(id);
    
    while (!nextToVisit.empty()) {
        now = nextToVisit.back();
        nextToVisit.pop_back();

        alreadyVisited.push_back(now);

        bool endNode{false};

        vector<Node::node> edges = unitedGraph[now]->getEdges();
        for (Node::node cn : edges) {
            notAlreadyVisited = (find(alreadyVisited.begin(), alreadyVisited.end(), cn.first) == alreadyVisited.end());
            notToVisit = (find(nextToVisit.begin(), nextToVisit.end(), cn.first) == nextToVisit.end());
            cutEdge = (cn.second == 0);
            if (notAlreadyVisited && notToVisit && cutEdge) {
                nextToVisit.push_back(cn.first);
            }
            //if the node has a edge that was not cut, it must be a endNode
            if(!cutEdge){
                endNode = true;
            }
        }

        if(endNode){
            partitionConnected = whichPartition(now, partitions);
            if(idPartition != partitionConnected){
                return make_pair(GPX2Structs::SearchResult::CONNECTED_TO_PARTITION, alreadyVisited);
            }
        }
    }
    
    unitedGraph[id]->setAccess(false);
    unitedGraph[alreadyVisited.back()]->setAccess(false);
    return make_pair(GPX2Structs::SearchResult::CONNECTED_TO_SELF, alreadyVisited);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rcx, (%rsp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xe0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsi), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0x82fa
leaq 0x1a8(%rsp), %rdi
movq %rbx, 0x38(%rsp)
movq %rbx, %rsi
callq 0x2545c
leaq 0xd0(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x2c9dd
movl %eax, %ebx
leaq 0x1a8(%rsp), %rdi
callq 0x25630
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c37c
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x53b0
leaq 0xc(%rsp), %rsi
movl %ebx, (%rsi)
movq 0x38(%rsp), %rdi
callq 0x2524c
movq (%rax), %rdi
callq 0x2a8d0
leaq 0x148(%rsp), %rdi
movq %rax, %rsi
callq 0x17d42
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0xf0(%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
movq %r15, 0x30(%rsp)
leaq 0xf0(%rsp), %rdi
movq %r12, 0xb0(%rsp)
movq %r12, %rsi
callq 0x2f9ea
movq 0x120(%rsp), %rsi
cmpq 0x100(%rsp), %rsi
je 0x2c68f
leaq 0x48(%rsp), %r15
leaq 0xb8(%rsp), %rbx
leaq 0x88(%rsp), %r12
cmpq 0x128(%rsp), %rsi
jne 0x2c445
movq 0x138(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
movq %r15, %rdi
callq 0x5210
leaq 0xf0(%rsp), %rdi
callq 0x2fa28
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x1aa0a
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x28dba
movq (%rax), %rdi
callq 0x29f78
movq %rbx, %rdi
movq %rax, %rsi
callq 0x28efa
movq 0xb8(%rsp), %rbx
movq 0xc0(%rsp), %r14
cmpq %r14, %rbx
je 0x2c669
xorl %r15d, %r15d
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x82fa
movsd 0x20(%rbx), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r12, %rdx
callq 0x219d3
movq %rax, %r13
movq 0x18(%rsp), %rbp
movapd 0x100(%rsp), %xmm0
movaps 0x110(%rsp), %xmm1
movaps 0x120(%rsp), %xmm2
movaps 0x130(%rsp), %xmm3
movapd %xmm0, 0x180(%rsp)
movaps %xmm1, 0x190(%rsp)
movaps %xmm2, 0x160(%rsp)
movaps %xmm3, 0x170(%rsp)
leaq 0x1d8(%rsp), %rdi
leaq 0x180(%rsp), %rsi
leaq 0x160(%rsp), %rdx
movq %r12, %rcx
callq 0x300dc
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
cmpq %rbp, %r13
jne 0x2c59a
movq 0x120(%rsp), %rax
cmpq %rax, 0x1d8(%rsp)
jne 0x2c59a
movsd 0x40(%rsp), %xmm0
ucomisd 0x4da2(%rip), %xmm0     # 0x31328
jne 0x2c59a
jp 0x2c59a
leaq 0xf0(%rsp), %rdi
movq %r12, %rsi
callq 0x2f9ea
movsd 0x40(%rsp), %xmm0
ucomisd 0x4d80(%rip), %xmm0     # 0x31328
setp %r13b
setne %bpl
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x2c5d5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x53b0
orb %r13b, %bpl
orb %bpl, %r15b
addq $0x28, %rbx
cmpq %r14, %rbx
jne 0x2c4a6
testb $0x1, %r15b
leaq 0x48(%rsp), %r15
je 0x2c669
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x82fa
leaq 0x1f8(%rsp), %r14
movq %r14, %rdi
movq 0x38(%rsp), %rsi
callq 0x2545c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2c9dd
movl %eax, %r13d
movq %r14, %rdi
callq 0x25630
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x2c65e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x53b0
cmpl %r13d, 0xc(%rsp)
jne 0x2c734
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
callq 0x28f94
movq 0x120(%rsp), %rsi
cmpq 0x100(%rsp), %rsi
jne 0x2c427
movq (%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x28dba
movq (%rax), %rdi
xorl %esi, %esi
callq 0x29f92
movq 0x18(%rsp), %rsi
addq $-0x20, %rsi
movq (%rsp), %rdi
callq 0x28dba
movq (%rax), %rdi
xorl %esi, %esi
callq 0x29f92
movq 0x30(%rsp), %rbx
movl $0x1, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x17d42
leaq 0xf0(%rsp), %rdi
callq 0x2fa58
leaq 0x10(%rsp), %rdi
callq 0x8206
leaq 0x148(%rsp), %rdi
callq 0x8206
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2c71f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %rbx, %rax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %rbx
movl $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x17d42
leaq 0xb8(%rsp), %rdi
callq 0x28f94
jmp 0x2c6df
jmp 0x2c7ea
jmp 0x2c7e1
movq %rax, %rbx
jmp 0x2c831
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x25630
jmp 0x2c780
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c848
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x53b0
jmp 0x2c848
jmp 0x2c7a8
movq %rax, %rbx
jmp 0x2c848
jmp 0x2c7e1
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x25630
jmp 0x2c7c7
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x2c817
movq 0x78(%rsp), %rsi
jmp 0x2c80f
jmp 0x2c7ea
jmp 0x2c7e1
movq %rax, %rbx
jmp 0x2c824
jmp 0x2c7ef
jmp 0x2c7ef
movq %rax, %rbx
jmp 0x2c817
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x2c817
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x53b0
leaq 0xb8(%rsp), %rdi
callq 0x28f94
leaq 0xf0(%rsp), %rdi
callq 0x2fa58
leaq 0x10(%rsp), %rdi
callq 0x8206
leaq 0x148(%rsp), %rdi
callq 0x8206
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2c864
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %rbx, %rdi
callq 0x5660