// File: /workspace/github_cpp_makefile_star2_O1/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 0xb05c
movq 0x8(%rbx), %rax
subq (%rbx), %rax
movq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
je 0x2f6a3
sarq $0x2, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addl %eax, %ecx
movq %rcx, 0x78(%rsp)
movl %eax, %eax
movq %rax, 0xa0(%rsp)
xorl %r13d, %r13d
leaq 0x80(%rsp), %r15
movl $0x40, %edi
callq 0x53b0
movq %rax, %r12
movq 0x58(%rsp), %rax
movl (%rax,%r13,4), %r14d
movl %r14d, %ebp
negl %ebp
cmovsl %r14d, %ebp
movl $0x1, %ebx
cmpl $0xa, %ebp
jb 0x2ed7a
movl $0x4, %ebx
movl %ebp, %eax
cmpl $0x63, %eax
jbe 0x2ed73
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x2ed78
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x2ed7a
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 0x2ed40
addl $-0x3, %ebx
jmp 0x2ed7a
addl $-0x2, %ebx
jmp 0x2ed7a
decl %ebx
shrl $0x1f, %r14d
leal (%rbx,%r14), %esi
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r15, %rdi
movl $0x2d, %edx
movq %r12, 0x48(%rsp)
callq 0x5470
addq 0x80(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0xe9a5
movq %r12, %rdi
movq %r15, %rsi
callq 0x29d14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x2ede8
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x53c0
testq %r13, %r13
movq %r13, 0x50(%rsp)
je 0x2ee92
movq 0x58(%rsp), %rax
movl -0x4(%rax,%r13,4), %edi
movl (%rax,%r13,4), %esi
cmpq 0x78(%rsp), %r13
jne 0x2ef29
callq 0xf232
movl %eax, %ebp
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rcx
movl -0x4(%rcx,%r13,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f1bb
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2f1a9
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2f1b8
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2f1bb
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2ee4b
addl $-0x3, %r12d
jmp 0x2f1bb
movq 0x58(%rsp), %rax
movq 0x78(%rsp), %rcx
movl (%rax,%rcx,4), %edi
movl (%rax,%r13,4), %esi
callq 0xf232
movl %eax, %ebp
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rdx
movq 0x78(%rsp), %rcx
movl (%rdx,%rcx,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2efb5
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2efac
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2efb2
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2efb5
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2eee2
addl $-0x3, %r12d
jmp 0x2efb5
callq 0xf232
movl %eax, %ebp
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rcx
movl -0x4(%rcx,%r13,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f31e
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2f1af
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2f31b
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2f31e
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2ef65
addl $-0x3, %r12d
jmp 0x2f31e
addl $-0x2, %r12d
jmp 0x2efb5
decl %r12d
movl %ebp, %r13d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f00e
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f016
movups (%rbp), %xmm0
movups %xmm0, (%r15)
movq 0x48(%rsp), %r12
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
callq 0x303c6
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
movq 0x50(%rsp), %r14
je 0x2f06e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f084
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x58(%rsp), %rax
movl (%rax,%r14,4), %edi
movl 0x4(%rax), %esi
callq 0xf232
movl %eax, %r13d
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rcx
movl 0x4(%rcx), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f108
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2f0ff
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2f105
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2f108
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2f0c7
addl $-0x3, %r12d
jmp 0x2f108
addl $-0x2, %r12d
jmp 0x2f108
decl %r12d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f15e
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f168
movupd (%rbp), %xmm0
movupd %xmm0, (%r15)
movq 0x48(%rsp), %r12
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
callq 0x303c6
jmp 0x2f5c7
addl $-0x2, %r12d
jmp 0x2f1bb
addl $-0x2, %r12d
jmp 0x2f31e
decl %r12d
movl %ebp, %r13d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f214
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f21c
movups (%rbp), %xmm0
movups %xmm0, (%r15)
movq 0x48(%rsp), %r12
movq %r14, %rdi
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
leaq 0x20(%rsp), %rsi
callq 0x303c6
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
movq 0x50(%rsp), %r14
je 0x2f274
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f28a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x58(%rsp), %rax
movl (%rax,%r14,4), %edi
movl (%rax), %esi
callq 0xf232
movl %eax, %r13d
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rcx
movl (%rcx), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f487
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2f312
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2f484
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2f487
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2f2cf
addl $-0x3, %r12d
jmp 0x2f487
addl $-0x2, %r12d
jmp 0x2f487
decl %r12d
movl %ebp, %r13d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f377
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f37f
movups (%rbp), %xmm0
movups %xmm0, (%r15)
movq 0x48(%rsp), %r12
movq %r14, %rdi
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
leaq 0x20(%rsp), %rsi
callq 0x303c6
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
movq 0x50(%rsp), %r14
je 0x2f3d7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f3ed
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x58(%rsp), %rax
movl (%rax,%r14,4), %edi
movl 0x4(%rax,%r14,4), %esi
callq 0xf232
movl %eax, %r13d
movq %r12, %rdi
callq 0x29d64
movq 0x58(%rsp), %rcx
movl 0x4(%rcx,%r14,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x2f52b
movl $0x4, %r12d
movl %r15d, %esi
cmpl $0x63, %esi
jbe 0x2f47b
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0x2f528
cmpl $0x2710, %esi           # imm = 0x2710
jb 0x2f52b
movl %esi, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0x2f438
addl $-0x3, %r12d
jmp 0x2f52b
addl $-0x2, %r12d
jmp 0x2f52b
decl %r12d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f4dd
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f4e7
movupd (%rbp), %xmm0
movupd %xmm0, (%r15)
movq 0x48(%rsp), %r12
movq %r14, %rdi
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
leaq 0x20(%rsp), %rsi
callq 0x303c6
jmp 0x2f5c7
decl %r12d
movq %rax, %r14
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq 0x10(%rsp), %rbp
movq %rbp, (%rsp)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x5470
addq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xe9a5
leaq 0x30(%rsp), %r15
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f581
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f58b
movupd (%rbp), %xmm0
movupd %xmm0, (%r15)
movq 0x48(%rsp), %r12
movq %r14, %rdi
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movsd %xmm0, 0x40(%rsp)
leaq 0x20(%rsp), %rsi
callq 0x303c6
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
movq 0x50(%rsp), %r13
je 0x2f5e3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f5f9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
movq %rsp, %rdi
movq %r12, %rsi
callq 0x29d42
movq %r15, 0x20(%rsp)
movq (%rsp), %rax
cmpq %rbp, %rax
je 0x2f623
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2f62d
movupd (%rbp), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %r12, 0x40(%rsp)
movq 0x70(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2944c
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f674
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x80(%rsp), %r15
je 0x2f692
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
incq %r13
cmpq 0xa0(%rsp), %r13
jne 0x2ed10
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2f6ba
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq 0x70(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x2f786
jmp 0x2f76c
jmp 0x2f735
jmp 0x2f76c
jmp 0x2f735
jmp 0x2f76c
jmp 0x2f735
jmp 0x2f735
jmp 0x2f76c
jmp 0x2f76c
jmp 0x2f735
jmp 0x2f76c
jmp 0x2f735
movq %rax, %r14
jmp 0x2f727
movq %rax, %r14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x2f727
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x53c0
movl $0x40, %esi
movq 0x48(%rsp), %rdi
jmp 0x2f765
jmp 0x2f76c
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f74f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2f76f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53c0
jmp 0x2f76f
movq %rax, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2f786
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq 0x70(%rsp), %rdi
callq 0x28e8c
movq %r14, %rdi
callq 0x5670