// File: /workspace/github_cpp_makefile_star2_O3/GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2Support.cpp
// Function: GPX2Support::tourToMap[abi:cxx11](std::vector<int, std::allocator<int>>&)
GPX2Structs::NodeMap GPX2Support::tourToMap(vector<int> &t)
{
    //Maps the tour to a graph with connections between the nodes
    std::map<string, Node*> aux; 
    double dist = 0;
    vector<int> cities{ t };
    unsigned size = t.size();

    for (unsigned i = 0; i < size; i++) {
        Node* cn = new Node(to_string(cities[i]));
        if(i==0){
            //if the current node is the first one, connect it with the last one and the next
            //Node::node is a pair of string and double, the ID and distance
            dist = distance(cities[size-1],cities[i]);
            cn->getEdges().push_back(Node::node(to_string(cities[size-1]), dist));
            dist = distance(cities[i],cities[i+1]);
            cn->getEdges().push_back(Node::node(to_string(cities[i+1]), dist));
        }else if(i==(size-1)){
            //if the current node is the last one, connect it with the previous and the first node
            dist = distance(cities[i-1],cities[i]);
            cn->getEdges().push_back(Node::node(to_string(cities[i-1]), dist));
            dist = distance(cities[i],cities[0]);
            cn->getEdges().push_back(Node::node(to_string(cities[0]), dist));
        }else{
            //for all the other nodes connect if with the previous and next
            dist = distance(cities[i-1],cities[i]);
            cn->getEdges().push_back(Node::node(to_string(cities[i-1]), dist));
            dist = distance(cities[i],cities[i+1]);
            cn->getEdges().push_back(Node::node(to_string(cities[i+1]), dist));
        }

        aux.insert(make_pair(cn->getId(), cn));
    }

    return (aux); //returns a map with the nodes already instantiated and added 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
leaq 0x8(%rdi), %rax
movl $0x0, 0x8(%rdi)
xorl %ecx, %ecx
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rdi, 0x70(%rsp)
movq %rcx, 0x28(%rdi)
leaq 0x58(%rsp), %rdi
callq 0xb078
movq 0x8(%rbx), %rax
subq (%rbx), %rax
movq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
je 0x2f8fa
sarq $0x2, %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
addl %eax, %r15d
movl %eax, %eax
movq %rax, 0xa0(%rsp)
xorl %r12d, %r12d
leaq 0x78(%rsp), %r13
movq %r15, 0x98(%rsp)
movl $0x40, %edi
callq 0x53a0
movq %rax, 0x48(%rsp)
movq 0x58(%rsp), %rax
movl (%rax,%r12,4), %r14d
movl %r14d, %ebp
negl %ebp
cmovsl %r14d, %ebp
movl $0x1, %ebx
cmpl $0xa, %ebp
jb 0x2efe0
movl $0x4, %ebx
movl %ebp, %eax
cmpl $0x63, %eax
jbe 0x2efd9
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2efde
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2efe0
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %ebx
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2efa6
addl $-0x3, %ebx
jmp 0x2efe0
addl $-0x2, %ebx
jmp 0x2efe0
decl %ebx
shrl $0x1f, %r14d
leal (%rbx,%r14), %esi
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r13, %rdi
movl $0x2d, %edx
callq 0x5460
addq 0x78(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0xe98e
movq 0x48(%rsp), %rdi
movq %r13, %rsi
callq 0x29f28
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2f042
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x53b0
testq %r12, %r12
movq %r12, 0x50(%rsp)
je 0x2f0ed
cmpq %r15, %r12
jne 0x2f17d
movq 0x58(%rsp), %rax
movl -0x4(%rax,%r15,4), %edi
movl (%rax,%r15,4), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl -0x4(%rax,%r15,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f415
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f403
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f412
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f415
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f0a9
addl $-0x3, %r12d
jmp 0x2f415
movq 0x58(%rsp), %rax
movl (%rax,%r15,4), %edi
movl (%rax), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl (%rax,%r15,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f21a
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f211
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f217
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f21a
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f139
addl $-0x3, %r12d
jmp 0x2f21a
movq 0x58(%rsp), %rax
movl -0x4(%rax,%r12,4), %edi
movl (%rax,%r12,4), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl -0x4(%rax,%r12,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f573
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f409
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f570
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f573
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f1cd
addl $-0x3, %r12d
jmp 0x2f573
addl $-0x2, %r12d
jmp 0x2f21a
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
je 0x2f26d
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f276
movups (%r13), %xmm0
movups %xmm0, (%r15)
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r13, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f2c4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2f2da
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x58(%rsp), %rax
movl (%rax), %edi
movl 0x4(%rax), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl 0x4(%rax), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f35e
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f355
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f35b
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f35e
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f320
addl $-0x3, %r12d
jmp 0x2f35e
addl $-0x2, %r12d
jmp 0x2f35e
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
movq %r13, %rbx
je 0x2f3b4
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f3bd
movupd (%rbx), %xmm0
movupd %xmm0, (%r15)
movq 0x50(%rsp), %r12
leaq 0x78(%rsp), %r13
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
jmp 0x2f81d
addl $-0x2, %r12d
jmp 0x2f415
addl $-0x2, %r12d
jmp 0x2f573
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
movq %r13, %rbx
je 0x2f46b
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f472
movups (%rbx), %xmm0
movups %xmm0, (%r15)
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f4c0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %rbx, %rdi
movq 0x98(%rsp), %rbx
je 0x2f4de
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x58(%rsp), %rax
movl (%rax,%rbx,4), %edi
movl (%rax), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl (%rax), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f6d5
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f567
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f6d2
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f6d5
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f527
addl $-0x3, %r12d
jmp 0x2f6d5
addl $-0x2, %r12d
jmp 0x2f6d5
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
movq %r13, %rbx
je 0x2f5c9
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f5d0
movups (%rbx), %xmm0
movups %xmm0, (%r15)
movq 0x50(%rsp), %r12
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f623
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x2f639
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq 0x58(%rsp), %rax
movl (%rax,%r12,4), %edi
movl 0x4(%rax,%r12,4), %esi
callq 0xf23e
movl %eax, %r14d
movq 0x48(%rsp), %rdi
callq 0x29f78
movq %rax, %rbp
movq 0x58(%rsp), %rax
movl 0x4(%rax,%r12,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f77d
movl $0x4, %r12d
movl %r15d, %eax
cmpl $0x63, %eax
jbe 0x2f6c9
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2f77a
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2f77d
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x2f689
addl $-0x3, %r12d
jmp 0x2f77d
addl $-0x2, %r12d
jmp 0x2f77d
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
movq %r13, %rbx
je 0x2f72b
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f734
movupd (%rbx), %xmm0
movupd %xmm0, (%r15)
movq 0x50(%rsp), %r12
leaq 0x78(%rsp), %r13
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
jmp 0x2f81d
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5460
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe98e
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %r13, %rax
movq %r13, %rbx
je 0x2f7d3
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f7dc
movupd (%rbx), %xmm0
movupd %xmm0, (%r15)
movq 0x50(%rsp), %r12
leaq 0x78(%rsp), %r13
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x30648
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f834
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x2f84a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
movq %rsp, %rdi
movq 0x48(%rsp), %rsi
callq 0x29f56
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbx, %rax
je 0x2f876
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f87f
movupd (%rbx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x29644
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f8cb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
cmpq %rbx, %rdi
movq 0x98(%rsp), %r15
je 0x2f8e9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
incq %r12
cmpq 0xa0(%rsp), %r12
jne 0x2ef74
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2f911
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
movq 0x70(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x2f9d7
jmp 0x2f9bd
jmp 0x2f986
jmp 0x2f9bd
jmp 0x2f986
jmp 0x2f9bd
jmp 0x2f986
jmp 0x2f986
jmp 0x2f9bd
jmp 0x2f9bd
jmp 0x2f986
jmp 0x2f9bd
jmp 0x2f986
movq %rax, %r14
jmp 0x2f978
movq %rax, %r14
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2f978
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x53b0
movl $0x40, %esi
movq 0x48(%rsp), %rdi
jmp 0x2f9b6
jmp 0x2f9bd
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f9a0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2f9c0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53b0
jmp 0x2f9c0
movq %rax, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2f9d7
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x53b0
movq 0x70(%rsp), %rdi
callq 0x29084
movq %r14, %rdi
callq 0x5660
nop