// File: /workspace/github_cpp_makefile_star2_O2/gty980218[P]ee450/hospitalC.cpp
// Function: readTxt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
double** readTxt(string file)
{
    ifstream infile; 
    infile.open(file.data());   //将文件流对象与文件连接起来 
    assert(infile.is_open());   //若失败,则输出错误消息,并终止程序运行 

    string s;
    int count=0;
    map<int, int>::iterator iter;   //store the result of find()
    while(getline(infile,s))
    {
        char str[s.length()+1];
        for(int i=0;i<s.length();i++){
            str[i]=s[i];
        }
        str[s.length()]='\0';
        char *pch;
        pch=strtok(str," ");        //segementation 
        int row=atoi(pch);
        iter=indice_map.find(row);     //get the result mapping from location # to indice
        if(iter==indice_map.end()){     //if no mapping the iter is equal to end()
            indice_map[row]=count++;
        }
        pch=strtok(NULL," ");
        int col=atoi(pch);
        iter=indice_map.find(col);
        if(iter==indice_map.end()){
            indice_map[col]=count++;
        }
    }
    infile.close();             //关闭文件输入流 


    int size=indice_map.size();
    double** dist_map; 
    dist_map=(double **)malloc(sizeof(double)*size*size);     //allocate space
    for(int i=0;i<size;i++){
        dist_map[i]=(double *)malloc(sizeof(double)*size);
    }
    for(int i=0;i<size;i++){               //initialize the dist_map to 0s
        for(int j=0;j<size;j++){
            dist_map[i][j]=0;
        }
        
    }
    infile.open(file.data());   //将文件流对象与文件连接起来 
    assert(infile.is_open());   //若失败,则输出错误消息,并终止程序运行 
    while(getline(infile,s))
    {
        char str[s.length()+1];
        for(int i=0;i<s.length();i++){
            str[i]=s[i];
        }
        str[s.length()]='\0';
        char *pch;
        pch=strtok(str," ");
        iter=indice_map.find(atoi(pch));
        int row=iter->second;       //get the indice from iter by ->second.
        pch=strtok(NULL," ");
        iter=indice_map.find(atoi(pch));
        int col=iter->second;
        pch=strtok(NULL," ");
        double dist=atof(pch);
        dist_map[row][col]=dist;
        dist_map[col][row]=dist;
    }
    infile.close(); 
    return dist_map;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %r14
leaq -0x260(%rbp), %rbx
movq %rbx, %rdi
callq 0x2230
movq (%r14), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x2130
movq %r14, -0x38(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x30b7
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r12d, %r12d
leaq 0x1470(%rip), %r13      # 0x428f
leaq 0x3392(%rip), %r14      # 0x61b8
leaq 0x3393(%rip), %rbx      # 0x61c0
leaq -0x260(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2efd
movq %rsp, %r15
movq -0x50(%rbp), %rax
movq %rsp, %rdi
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
xorl %edx, %edx
cmpq %rdx, %rax
je 0x2e83
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
jmp 0x2e71
movb $0x0, (%rdi,%rax)
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x32cc
cmpq %rbx, %rax
jne 0x2ebd
movq %r14, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3172
movl %r12d, (%rax)
incl %r12d
xorl %edi, %edi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x30(%rbp)
movq %r14, %rdi
leaq -0x30(%rbp), %rsi
callq 0x32cc
cmpq %rbx, %rax
jne 0x2ef5
movq %r14, %rdi
leaq -0x30(%rbp), %rsi
callq 0x3172
movl %r12d, (%rax)
incl %r12d
movq %r15, %rsp
jmp 0x2e2d
leaq -0x260(%rbp), %rdi
callq 0x2080
movq 0x32d0(%rip), %rax      # 0x61e0
movl %eax, %r14d
movslq %r14d, %rdi
movslq %eax, %r12
leaq (,%r12,8), %rbx
imulq %rbx, %rdi
callq 0x2260
movq %rax, %r15
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
cmpq %r13, %r12
je 0x2f4d
movq %rbx, %rdi
callq 0x2260
movq %rax, (%r15,%r13,8)
incq %r13
jmp 0x2f37
xorl %eax, %eax
cmpq %r12, %rax
je 0x2f6e
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x2f69
movq (%r15,%rax,8), %rdx
andq $0x0, (%rdx,%rcx,8)
incq %rcx
jmp 0x2f56
incq %rax
jmp 0x2f4f
movq -0x38(%rbp), %rax
movq (%rax), %rsi
leaq -0x260(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2130
leaq -0x1e8(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x30d6
leaq -0x2c(%rbp), %r14
leaq -0x260(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
leaq 0x12d0(%rip), %rbx      # 0x428f
jne 0x3084
movq %rsp, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq %rsp, %rdi
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
xorl %edx, %edx
cmpq %rdx, %rax
je 0x2ffa
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
jmp 0x2fe8
movb $0x0, (%rdi,%rax)
movq %rbx, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x2c(%rbp)
leaq 0x31a0(%rip), %rdi      # 0x61b8
movq %r14, %rsi
callq 0x32cc
movslq 0x24(%rax), %r13
xorl %edi, %edi
movq %rbx, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x2c(%rbp)
leaq 0x3178(%rip), %rdi      # 0x61b8
movq %r14, %r12
movq %r14, %rsi
callq 0x32cc
movslq 0x24(%rax), %rbx
xorl %edi, %edi
leaq 0x1237(%rip), %rsi      # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2250
movq (%r15,%r13,8), %rax
movsd %xmm0, (%rax,%rbx,8)
movq (%r15,%rbx,8), %rax
movsd %xmm0, (%rax,%r13,8)
movq -0x38(%rbp), %rsp
movq %r12, %r14
jmp 0x2f9c
leaq -0x260(%rbp), %rdi
callq 0x2080
leaq -0x58(%rbp), %rdi
callq 0x2110
leaq -0x260(%rbp), %rdi
callq 0x20b0
movq %r15, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12aa(%rip), %rdi      # 0x4368
leaq 0x12b4(%rip), %rsi      # 0x4379
leaq 0x12bb(%rip), %rcx      # 0x4387
movl $0xcc, %edx
callq 0x2140
leaq 0x128b(%rip), %rdi      # 0x4368
leaq 0x1295(%rip), %rsi      # 0x4379
leaq 0x129c(%rip), %rcx      # 0x4387
movl $0xf6, %edx
callq 0x2140
jmp 0x310c
movq %rax, %rbx
jmp 0x3118
jmp 0x310c
jmp 0x310c
jmp 0x310c
jmp 0x310c
jmp 0x310c
jmp 0x310c
jmp 0x310c
jmp 0x310c
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x2110
leaq -0x260(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22f0