// File: /workspace/github_cpp_makefile_star2_O2/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 $0x218, %rsp            # imm = 0x218
movq %rcx, (%rsp)
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xf0(%rsp), %rdi
callq 0x54a0
leaq 0x150(%rsp), %rdi
movq %r12, %rsi
callq 0x1db20
leaq 0xf0(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x23d18
movl %eax, %ebx
leaq 0x150(%rsp), %rdi
callq 0x1dd56
leaq 0xf0(%rsp), %rdi
callq 0x56f8
leaq 0xc(%rsp), %rsi
movl %ebx, (%rsi)
movq %r12, %rdi
callq 0x1d860
movq (%rax), %rdi
callq 0x223a8
leaq 0xd8(%rsp), %rdi
movq %rax, %rsi
callq 0x12b1e
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x25e64
leaq 0x68(%rsp), %rdi
movq %r14, 0x30(%rsp)
movq %r14, %rsi
callq 0x25ce4
leaq 0xb8(%rsp), %rbx
leaq 0x1a8(%rsp), %rbp
leaq 0x180(%rsp), %r14
movq %r15, 0x40(%rsp)
movq %r12, 0x38(%rsp)
movq 0x98(%rsp), %rsi
cmpq 0x78(%rsp), %rsi
je 0x23a91
cmpq 0xa0(%rsp), %rsi
jne 0x238c4
movq 0xb0(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0x5210
leaq 0x68(%rsp), %rdi
callq 0x25d0e
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x14efa
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x20910
movq (%rax), %rdi
callq 0x21c02
leaq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x20a64
movq 0x50(%rsp), %r13
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
xorl %r12d, %r12d
cmpq 0x48(%rsp), %r13
je 0x23a1e
movq %r14, %rdi
movq %r13, %rsi
callq 0x209fc
movq %rbp, %rbx
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0x1abd1
movq %rax, %rbp
movq 0x18(%rsp), %r15
movupd 0x78(%rsp), %xmm0
movups 0x88(%rsp), %xmm1
movups 0x98(%rsp), %xmm2
movups 0xa8(%rsp), %xmm3
movapd %xmm0, 0x130(%rsp)
movaps %xmm1, 0x140(%rsp)
movaps %xmm2, 0x110(%rsp)
movaps %xmm3, 0x120(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0x110(%rsp), %rdx
movq %r14, %rcx
callq 0x25d2c
movsd 0x1a0(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
cmpq %r15, %rbp
jne 0x239f1
movq 0x98(%rsp), %rax
cmpq %rax, 0x1c8(%rsp)
jne 0x239f1
movsd 0x28(%rsp), %xmm0
ucomisd 0x3918(%rip), %xmm0     # 0x272f8
jne 0x239f1
jp 0x239f1
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x25ce4
movsd 0x28(%rsp), %xmm0
ucomisd 0x38f9(%rip), %xmm0     # 0x272f8
setp %al
setne %cl
orb %al, %cl
orb %cl, %r12b
movq %r14, %rdi
callq 0x56f8
addq $0x28, %r13
movq %rbx, %rbp
jmp 0x2391a
testb $0x1, %r12b
movq 0x40(%rsp), %r15
movq 0x38(%rsp), %r12
je 0x23a7a
movq %rbp, %rdi
leaq 0xb8(%rsp), %rsi
callq 0x54a0
leaq 0x1e8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1db20
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x23d18
movq %rbx, %rdi
movq %rbp, %rbx
movl %eax, %ebp
callq 0x1dd56
movq %rbx, %rdi
callq 0x56f8
cmpl %ebp, 0xc(%rsp)
movq %rbx, %rbp
jne 0x23adf
leaq 0x50(%rsp), %rdi
callq 0x20abe
leaq 0xb8(%rsp), %rbx
jmp 0x23893
movq (%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x20910
movq (%rax), %rdi
xorl %esi, %esi
callq 0x21c1c
movq 0x18(%rsp), %rsi
addq $-0x20, %rsi
movq (%rsp), %rdi
callq 0x20910
movq (%rax), %rdi
xorl %esi, %esi
callq 0x21c1c
movl $0x1, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
leaq 0x10(%rsp), %rsi
callq 0x12b1e
jmp 0x23afe
andl $0x0, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
leaq 0x10(%rsp), %rsi
callq 0x12b1e
leaq 0x50(%rsp), %rdi
callq 0x20abe
leaq 0x68(%rsp), %rdi
callq 0x25d6e
leaq 0x10(%rsp), %rdi
callq 0x709c
leaq 0xd8(%rsp), %rdi
callq 0x709c
leaq 0xb8(%rsp), %rdi
callq 0x56f8
movq %r15, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x23ba4
jmp 0x23b9d
movq %rax, %rbx
jmp 0x23bcf
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x1dd56
jmp 0x23b62
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x56f8
jmp 0x23be6
jmp 0x23b73
movq %rax, %rbx
jmp 0x23be6
jmp 0x23b9d
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
callq 0x1dd56
jmp 0x23b8f
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
jmp 0x23bb6
jmp 0x23ba4
jmp 0x23b9d
movq %rax, %rbx
jmp 0x23bc5
jmp 0x23bab
movq %rax, %rbx
jmp 0x23bbb
jmp 0x23bab
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x56f8
leaq 0x50(%rsp), %rdi
callq 0x20abe
leaq 0x68(%rsp), %rdi
callq 0x25d6e
leaq 0x10(%rsp), %rdi
callq 0x709c
leaq 0xd8(%rsp), %rdi
callq 0x709c
leaq 0xb8(%rsp), %rdi
callq 0x56f8
movq %rbx, %rdi
callq 0x5610