// File: /workspace/github_cpp_makefile_star2_O3/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 0x1d58(%rip), %rsi      # 0x434a
leaq 0x1d58(%rip), %rdx      # 0x4351
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x36d2
movq %rbx, %rdi
callq 0x3181
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x2625
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2200
movq 0x3ba4(%rip), %rcx      # 0x61d0
testq %rcx, %rcx
je 0x27f1
leaq 0x3b8c(%rip), %rax      # 0x61c8
xorl %edx, %edx
cmpl %r14d, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x263c
leaq 0x3b6e(%rip), %rcx      # 0x61c8
cmpq %rcx, %rax
je 0x27f1
cmpl %r14d, 0x20(%rax)
jg 0x27f1
movslq 0x24(%rax), %r15
movq 0x3b70(%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 0x26ef
movq (%rbx,%r15,8), %rcx
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leaq 0x8(%rax), %rsi
xorl %edi, %edi
xorpd %xmm0, %xmm0
movsd 0x194b(%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 0x26bd
shlq $0x4, %r15
leaq (%rax,%r15), %rcx
movb $0x1, (%rax,%r15)
testl %r14d, %r14d
jle 0x27de
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leaq 0x8(%rax), %rsi
movsd 0x18ee(%rip), %xmm0     # 0x4008
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
movq %r8, %r9
shlq $0x4, %r9
cmpb $0x0, (%rax,%r9)
jne 0x275e
addq %rax, %r9
movsd 0x8(%r9), %xmm3
ucomisd %xmm0, %xmm3
jne 0x2749
jnp 0x275e
ucomisd %xmm0, %xmm2
jne 0x2751
jnp 0x2757
ucomisd %xmm3, %xmm2
jbe 0x275e
movapd %xmm3, %xmm2
movl %r8d, %edi
incq %r8
cmpq %rdx, %r8
jne 0x272a
cmpl $-0x1, %edi
je 0x27de
movslq %edi, %rdi
movq %rdi, %r8
shlq $0x4, %r8
movb $0x1, (%rax,%r8)
testl %r14d, %r14d
jle 0x27de
movq (%rbx,%rdi,8), %rdi
movq %rsi, %r8
xorl %r9d, %r9d
movsd (%rdi,%r9,8), %xmm3
ucomisd %xmm1, %xmm3
jne 0x2797
jnp 0x27ba
cmpb $0x0, -0x8(%r8)
jne 0x27ba
movsd (%r8), %xmm4
ucomisd %xmm0, %xmm4
addsd %xmm2, %xmm3
jne 0x27af
jnp 0x27b5
ucomisd %xmm3, %xmm4
jbe 0x27ba
movsd %xmm3, (%r8)
incq %r9
addq $0x10, %r8
cmpq %r9, %rdx
jne 0x2789
movl $0x0, %r8d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movapd %xmm0, %xmm2
testl %r14d, %r14d
jg 0x272a
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 0x280e
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x22f0