// File: /workspace/github_cpp_makefile_star2_O2/gty980218[P]ee450/hospitalC.cpp
// Function: init(int)
Dist_list* init(int loc){                               // input the location #
    double** dist_map=readTxt("map.txt");                  //load the map.txt and create indice mapping and distance graph

    map<int, int>::iterator iter;
    iter=indice_map.find(loc);                          //find the indice mapped to location #
    if(iter!=indice_map.end()){                         //determine if the location exists
        int indice=iter->second;
        int size=indice_map.size();
        Dist_list *dist_list;
        dist_list=new Dist_list[size];                  //to store the shortest path from loc

        for(int i=0;i<size;i++){                         //initialize the dist_list
            if(dist_map[indice][i]==0){
                dist_list[i].val=-1;
            }else{
                dist_list[i].val=dist_map[indice][i];
            }
            dist_list[i].vstd=false;
        }
        dist_list[indice].vstd=true;
        
        while(true){                           
            double min=-1;
            int num=-1;
            for(int i=0;i<size;i++){                    //find the shortest path in each round
                if(!dist_list[i].vstd && dist_list[i].val!=-1){
                    if(min==-1){
                        min=dist_list[i].val;
                        num=i;
                    }else{
                        if(dist_list[i].val<min){
                            min=dist_list[i].val;
                            num=i;
                        }
                    }
                }
            }
            if(num==-1){                                 //done, time to quit the loop
                break;
            }
            dist_list[num].vstd=true;
            for(int i=0;i<size;i++){                     // according to the candidate points, update the dist_list
                if(dist_map[num][i]!=0 && !dist_list[i].vstd){
                    if(dist_list[i].val==-1 || (min+dist_map[num][i])<dist_list[i].val){
                        dist_list[i].val=min+dist_map[num][i];
                    }
                }
            }
        }
        dist_list[indice].val=0;
        return dist_list;
    }else{
        fprintf(stderr,"Location not found !\n");
        exit(1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edi, -0x20(%rbp)
leaq 0x1da6(%rip), %rsi      # 0x434a
leaq -0x40(%rbp), %rbx
leaq -0x19(%rbp), %rdx
movq %rbx, %rdi
callq 0x3136
movq %rbx, %rdi
callq 0x2db9
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2110
leaq 0x3be9(%rip), %rdi      # 0x61b8
leaq -0x20(%rbp), %rsi
callq 0x32cc
leaq 0x3be1(%rip), %rcx      # 0x61c0
cmpq %rcx, %rax
je 0x2741
movslq 0x24(%rax), %r14
movq 0x3bed(%rip), %r15      # 0x61e0
movq %r15, %rax
shlq $0x20, %rax
movq %rax, %rcx
sarq $0x1c, %rcx
testq %rax, %rax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x2030
xorl %esi, %esi
testl %r15d, %r15d
movl $0x0, %ecx
cmovgl %r15d, %ecx
leaq (,%rcx,8), %rdx
xorpd %xmm0, %xmm0
movsd 0x19d6(%rip), %xmm1     # 0x4008
cmpq %rsi, %rdx
je 0x2669
movq (%rbx,%r14,8), %rdi
movsd (%rdi,%rsi), %xmm2
movapd %xmm2, %xmm3
cmpeqsd %xmm0, %xmm3
movapd %xmm3, %xmm4
andnpd %xmm2, %xmm4
andpd %xmm1, %xmm3
orpd %xmm4, %xmm3
movlpd %xmm3, 0x8(%rax,%rsi,2)
movb $0x0, (%rax,%rsi,2)
addq $0x8, %rsi
jmp 0x2632
shlq $0x4, %r14
leaq (%rax,%r14), %rsi
movb $0x1, (%rax,%r14)
pushq $-0x1
popq %rdi
movsd 0x1987(%rip), %xmm0     # 0x4008
xorl %r8d, %r8d
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
movl %edi, %r9d
cmpq %rcx, %r8
je 0x26cd
movq %r8, %r10
shlq $0x4, %r10
cmpb $0x0, (%rax,%r10)
jne 0x26c8
addq %rax, %r10
movsd 0x8(%r10), %xmm3
ucomisd %xmm0, %xmm3
jne 0x26b3
jnp 0x26c8
ucomisd %xmm0, %xmm2
jne 0x26bb
jnp 0x26c1
ucomisd %xmm3, %xmm2
jbe 0x26c8
movapd %xmm3, %xmm2
movl %r8d, %r9d
incq %r8
jmp 0x268f
cmpl $-0x1, %r9d
je 0x2731
movslq %r9d, %r8
movq %r8, %r9
shlq $0x4, %r9
movb $0x1, (%rax,%r9)
xorl %r9d, %r9d
cmpq %r9, %rdx
je 0x2729
movq (%rbx,%r8,8), %r10
movsd (%r10,%r9), %xmm3
ucomisd %xmm1, %xmm3
jne 0x26fc
jnp 0x2723
cmpb $0x0, (%rax,%r9,2)
jne 0x2723
movsd 0x8(%rax,%r9,2), %xmm4
ucomisd %xmm0, %xmm4
addsd %xmm2, %xmm3
jne 0x2716
jnp 0x271c
ucomisd %xmm3, %xmm4
jbe 0x2723
movsd %xmm3, 0x8(%rax,%r9,2)
addq $0x8, %r9
jmp 0x26e5
xorl %r8d, %r8d
jmp 0x2688
andq $0x0, 0x8(%rsi)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x3890(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
leaq 0x1c00(%rip), %rdi      # 0x4352
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x2310
pushq $0x1
popq %rdi
callq 0x2240
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x22f0