// File: /workspace/github_cpp_makefile_star2_O1/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, %r14d
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1d5a(%rip), %rsi      # 0x434a
leaq 0x1d5a(%rip), %rdx      # 0x4351
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x3726
movq %rbx, %rdi
callq 0x31cf
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x2623
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2200
movq 0x3ba6(%rip), %rdx      # 0x61d0
leaq 0x3b97(%rip), %rax      # 0x61c8
movq %rax, %rcx
testq %rdx, %rdx
je 0x2658
leaq 0x3b88(%rip), %rcx      # 0x61c8
xorl %esi, %esi
cmpl %r14d, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x2640
movq %rax, %rdx
cmpq %rax, %rcx
je 0x266f
cmpl %r14d, 0x20(%rcx)
leaq 0x3b5d(%rip), %rdx      # 0x61c8
cmovleq %rcx, %rdx
cmpq %rax, %rdx
je 0x27ee
movslq 0x24(%rdx), %r15
movq 0x3b65(%rip), %r14      # 0x61e8
movq %r14, %rax
shlq $0x20, %rax
movq %rax, %rcx
sarq $0x1c, %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x2030
testl %r14d, %r14d
jle 0x26fa
movq (%rbx,%r15,8), %rcx
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leaq 0x8(%rax), %rsi
xorl %edi, %edi
xorpd %xmm0, %xmm0
movsd 0x1940(%rip), %xmm1     # 0x4008
movsd (%rcx,%rdi,8), %xmm2
movapd %xmm2, %xmm3
cmpeqsd %xmm0, %xmm3
movapd %xmm3, %xmm4
andnpd %xmm2, %xmm4
andpd %xmm1, %xmm3
orpd %xmm4, %xmm3
movlpd %xmm3, (%rsi)
movb $0x0, -0x8(%rsi)
incq %rdi
addq $0x10, %rsi
cmpq %rdi, %rdx
jne 0x26c8
shlq $0x4, %r15
leaq (%rax,%r15), %rcx
movb $0x1, (%rax,%r15)
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rax, %rsi
addq $0x8, %rsi
movsd 0x18e9(%rip), %xmm0     # 0x4008
xorpd %xmm1, %xmm1
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
testl %r14d, %r14d
jle 0x276e
movq %rsi, %r8
xorl %r9d, %r9d
movapd %xmm0, %xmm2
cmpb $0x0, -0x8(%r8)
jne 0x2760
movsd (%r8), %xmm3
ucomisd %xmm0, %xmm3
jne 0x274b
jnp 0x2760
ucomisd %xmm0, %xmm2
jne 0x2753
jnp 0x2759
ucomisd %xmm3, %xmm2
jbe 0x2760
movapd %xmm3, %xmm2
movl %r9d, %edi
incq %r9
addq $0x10, %r8
cmpq %r9, %rdx
jne 0x2737
jmp 0x2772
movapd %xmm0, %xmm2
cmpl $-0x1, %edi
je 0x27db
movslq %edi, %r8
movq %r8, %r9
shlq $0x4, %r9
movb $0x1, (%rax,%r9)
testl %r14d, %r14d
jle 0x27d2
movq (%rbx,%r8,8), %r8
movq %rsi, %r9
xorl %r10d, %r10d
movsd (%r8,%r10,8), %xmm3
ucomisd %xmm1, %xmm3
jne 0x27a3
jnp 0x27c6
cmpb $0x0, -0x8(%r9)
jne 0x27c6
movsd (%r9), %xmm4
ucomisd %xmm0, %xmm4
addsd %xmm2, %xmm3
jne 0x27bb
jnp 0x27c1
ucomisd %xmm3, %xmm4
jbe 0x27c6
movsd %xmm3, (%r9)
incq %r10
addq $0x10, %r9
cmpq %r10, %rdx
jne 0x2795
cmpl $-0x1, %edi
jne 0x2723
movq $0x0, 0x8(%rcx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2340
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x280b
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x22f0