// File: /workspace/github_cpp_makefile_star2_O1/GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2Support.cpp
// Function: GPX2Support::printMap(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*>>>&, std::ostream&)
void GPX2Support::printMap(GPX2Structs::NodeMap& graph, std::ostream& stream)
{
    stream << "size: " << graph.size() << "\n";
    for (map<string, Node*>::iterator it = graph.begin(); it != graph.end(); it++) {
        stream << " " << it->first << " | " << graph[it->first]->getId() <<  "\n";
        if (it->second->getAccess()) {
            stream << "Access: " << true <<  "\n";
        } else {
            stream << "Access: " << false <<  "\n";
        }
        stream << "==================================\n";

        stream << "connections: " << it->second->getEdges().size() <<  "\n";
        for (unsigned i = 0; i < it->second->getEdges().size(); i++) {
            stream << "Edge " << i << ": " << graph[it->second->getEdges()[i].first]->getId();
            stream << "\t#\t";
            stream << "Distance: " << it->second->getEdges()[i].second << "\n";
        }
        stream << "----------------------------------\n";
    }

    stream << "______________________________________________________________THE DIVISION______________________________________________________________\n";

    deque<string> nextToVisit;
    vector<string> isAlreadyVisited;
    bool notAlreadyVisited{ false };
    bool notToVisit{ false };

    Node* city = graph.begin()->second; // Reduzir chamadas (Node dentro do map)

    isAlreadyVisited.push_back(graph.begin()->first);
    stream << graph.begin()->first << "\n";
    nextToVisit.push_back(city->getEdges()[0].first);

    while (!nextToVisit.empty()) {

        stream << nextToVisit.front() << "\n";
        isAlreadyVisited.push_back(nextToVisit.front());
        city = graph[nextToVisit.front()];
        nextToVisit.pop_front();

        for (Node::node n : city->getEdges()) {

            notAlreadyVisited = find(isAlreadyVisited.begin(), isAlreadyVisited.end(), n.first) == isAlreadyVisited.end();
            notToVisit = find(nextToVisit.begin(), nextToVisit.end(), n.first) == nextToVisit.end();

            if (notAlreadyVisited && notToVisit) {
                nextToVisit.push_back(n.first);
            }
        }
    }
    stream << "size " << isAlreadyVisited.size() << "\n";
    stream << "map size " << graph.size() << "\n";
    stream.flush();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x4aea(%rip), %rsi      # 0x3288d
movl $0x6, %edx
movq %rbx, %rdi
callq 0x5440
movq 0x28(%r12), %rsi
movq %rbx, %rdi
callq 0x5280
leaq 0x4a3f(%rip), %rsi      # 0x32803
movl $0x1, %edx
movq %rax, %rdi
callq 0x5440
movq 0x18(%r12), %r15
leaq 0x8(%r12), %rax
movq %rax, 0x8(%rsp)
cmpq %rax, %r15
je 0x2e089
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x35a0(%rip), %rsi      # 0x31398
callq 0x5440
leaq 0x20(%r15), %r14
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
movq %rbx, %rdi
callq 0x5440
movq %rax, %r13
movl $0x3, %edx
movq %rax, %rdi
leaq 0x4b08(%rip), %rsi      # 0x3292b
callq 0x5440
movq %r12, %rdi
movq %r14, %rsi
callq 0x28bca
movq (%rax), %rsi
leaq 0x10(%rsp), %rdi
callq 0x29d42
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0x5440
movl $0x1, %edx
movq %rax, %rdi
leaq 0x49a2(%rip), %rsi      # 0x32803
callq 0x5440
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2de82
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x40(%r15), %rdi
callq 0x29d6a
movl %eax, %ebp
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x4a93(%rip), %rsi      # 0x3292f
callq 0x5440
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x5600
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4947(%rip), %r14      # 0x32803
movq %r14, %rsi
callq 0x5440
movl $0x23, %edx
movq %rbx, %rdi
leaq 0x4a65(%rip), %rsi      # 0x32938
callq 0x5440
movl $0xd, %edx
movq %rbx, %rdi
leaq 0x4a75(%rip), %rsi      # 0x3295c
callq 0x5440
movq 0x40(%r15), %rdi
callq 0x29d64
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x5280
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x5440
movq 0x40(%r15), %rdi
callq 0x29d64
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x2e05f
movl $0x1, %r14d
xorl %r13d, %r13d
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x4a16(%rip), %rsi      # 0x3296a
callq 0x5440
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5280
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
leaq 0x3421(%rip), %rsi      # 0x31397
callq 0x5440
movq 0x40(%r15), %rdi
callq 0x29d64
leaq (%r13,%r13,4), %r13
leaq (,%r13,8), %rsi
addq (%rax), %rsi
movq %r12, %rdi
callq 0x28bca
movq (%rax), %rsi
leaq 0x10(%rsp), %rdi
callq 0x29d42
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rdi
callq 0x5440
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2dfd7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x53c0
movl $0x3, %edx
movq %rbx, %rdi
leaq 0x498a(%rip), %rsi      # 0x32970
callq 0x5440
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x497a(%rip), %rsi      # 0x32974
callq 0x5440
movq 0x40(%r15), %rdi
callq 0x29d64
movq (%rax), %rax
movsd 0x20(%rax,%r13,8), %xmm0
movq %rbx, %rdi
callq 0x55c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x47da(%rip), %rsi      # 0x32803
callq 0x5440
movl %r14d, %r13d
movq 0x40(%r15), %rdi
callq 0x29d64
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
incl %r14d
cmpq %r13, %rcx
ja 0x2df45
movl $0x23, %edx
movq %rbx, %rdi
leaq 0x4911(%rip), %rsi      # 0x3297f
callq 0x5440
movq %r15, %rdi
callq 0x52a0
movq %rax, %r15
cmpq 0x8(%rsp), %rax
jne 0x2dde9
leaq 0x4913(%rip), %rsi      # 0x329a3
movl $0x89, %edx
movq %rbx, %rdi
callq 0x5440
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x2f88c
leaq 0x60(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x18(%r12), %rsi
movq 0x40(%rsi), %r15
addq $0x20, %rsi
callq 0x1a992
movq 0x18(%r12), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq %rbx, %rdi
callq 0x5440
leaq 0x4703(%rip), %rsi      # 0x32803
movl $0x1, %edx
movq %rax, %rdi
callq 0x5440
movq %r12, 0x8(%rsp)
movq %r15, %rdi
callq 0x29d64
movq (%rax), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2f798
movq 0x20(%rsp), %rax
cmpq %rax, 0x40(%rsp)
je 0x2e2aa
leaq 0x88(%rsp), %r15
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x5440
movl $0x1, %edx
movq %rax, %rdi
leaq 0x46a6(%rip), %rsi      # 0x32803
callq 0x5440
movq 0x20(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x1a992
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x28bca
movq (%rax), %r14
leaq 0x10(%rsp), %rdi
callq 0x2f850
movq %r14, %rdi
callq 0x29d64
movq (%rax), %r12
movq 0x8(%rax), %r13
cmpq %r13, %r12
leaq 0x78(%rsp), %r14
je 0x2e29a
movq %r15, 0x78(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x82cc
movsd 0x20(%r12), %xmm0
movsd %xmm0, 0x98(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq %r14, %rdx
callq 0x218f9
movq %r14, %rcx
movq %rax, %r14
movq %rbx, %rbp
movq %r15, %rbx
movq 0x68(%rsp), %r15
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movaps 0x40(%rsp), %xmm2
movaps 0x50(%rsp), %xmm3
movaps %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
callq 0x2fe74
cmpq %r15, %r14
leaq 0x78(%rsp), %r14
jne 0x2e26d
movq 0x40(%rsp), %rax
cmpq %rax, 0xe8(%rsp)
jne 0x2e26d
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x2f798
movq 0x78(%rsp), %rdi
movq %rbx, %r15
cmpq %rbx, %rdi
je 0x2e28a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x53c0
addq $0x28, %r12
cmpq %r13, %r12
movq %rbp, %rbx
jne 0x2e1aa
movq 0x20(%rsp), %rax
cmpq %rax, 0x40(%rsp)
jne 0x2e13f
leaq 0x31f9(%rip), %rsi      # 0x314aa
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5440
movq 0x68(%rsp), %rsi
subq 0x60(%rsp), %rsi
sarq $0x5, %rsi
movq %rbx, %rdi
callq 0x5280
leaq 0x4528(%rip), %rsi      # 0x32803
movl $0x1, %edx
movq %rax, %rdi
callq 0x5440
leaq 0x473e(%rip), %rsi      # 0x32a2d
movl $0x9, %edx
movq %rbx, %rdi
callq 0x5440
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x5280
leaq 0x44ef(%rip), %rsi      # 0x32803
movl $0x1, %edx
movq %rax, %rdi
callq 0x5440
movq %rbx, %rdi
callq 0x5290
leaq 0x60(%rsp), %rdi
callq 0x81e0
leaq 0x10(%rsp), %rdi
callq 0x2f806
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2e384
jmp 0x2e384
jmp 0x2e384
jmp 0x2e384
jmp 0x2e3a3
jmp 0x2e384
jmp 0x2e362
movq %rax, %r14
jmp 0x2e368
movq %rax, %r14
movq %rbx, %r15
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e387
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x53c0
jmp 0x2e387
movq %rax, %r14
leaq 0x60(%rsp), %rdi
callq 0x81e0
leaq 0x10(%rsp), %rdi
callq 0x2f806
movq %r14, %rdi
callq 0x5670
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2e39b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x53c0
jmp 0x2e39b