// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
leaq -0x260(%rbp), %r15
movq %r15, %rdi
callq 0x2220
movq (%rbx), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x2120
movq %rbx, -0x30(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3576
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebx, %ebx
leaq 0x10a4(%rip), %r13      # 0x428f
leaq 0x2fd6(%rip), %r12      # 0x61c8
movq -0x260(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %edx
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x331e
movq %rsp, %r14
movq -0x48(%rbp), %rax
movq %rsp, %rdi
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x3262
movq -0x50(%rbp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x3252
movb $0x0, (%rdi,%rax)
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x58(%rbp)
movq 0x2f50(%rip), %rcx      # 0x61d0
testq %rcx, %rcx
je 0x32a9
movq %r12, %rdx
xorl %esi, %esi
cmpl %eax, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rdx
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x3288
cmpq %r12, %rdx
je 0x32a9
cmpl 0x20(%rdx), %eax
jge 0x32bd
leaq 0x2f10(%rip), %rdi      # 0x61c0
leaq -0x58(%rbp), %rsi
callq 0x35fe
movl %ebx, (%rax)
incl %ebx
xorl %edi, %edi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x54(%rbp)
movq 0x2ef7(%rip), %rcx      # 0x61d0
testq %rcx, %rcx
je 0x3302
movq %r12, %rdx
xorl %esi, %esi
cmpl %eax, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rdx
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x32e1
cmpq %r12, %rdx
je 0x3302
cmpl 0x20(%rdx), %eax
jge 0x3316
leaq 0x2eb7(%rip), %rdi      # 0x61c0
leaq -0x54(%rbp), %rsi
callq 0x35fe
movl %ebx, (%rax)
incl %ebx
movq %r14, %rsp
jmp 0x31f2
leaq -0x260(%rbp), %rdi
callq 0x2080
movq 0x2eb7(%rip), %r14      # 0x61e8
movslq %r14d, %r12
leaq (,%r12,8), %rbx
movq %rbx, %rdi
imulq %r12, %rdi
callq 0x2260
movq %rax, %r15
testl %r12d, %r12d
jle 0x339e
movl %r14d, %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x2260
movq %rax, (%r15,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0x335d
testl %r14d, %r14d
jle 0x339e
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (,%r14,8), %rbx
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2110
incq %r12
cmpq %r12, %r14
jne 0x3388
movq -0x30(%rbp), %rax
movq (%rax), %rsi
leaq -0x260(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x2120
movq %r15, -0x30(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3595
leaq 0x2df0(%rip), %r13      # 0x61c8
movq -0x260(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %edx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2310
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x352f
movq %rsp, %r14
movq -0x48(%rbp), %rax
movq %rsp, %rdi
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x3448
movq -0x50(%rbp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x3438
movb $0x0, (%rdi,%rax)
leaq 0xe3c(%rip), %rsi       # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movq 0x2d69(%rip), %rdx      # 0x61d0
movq %r13, %rsi
testq %rdx, %rdx
je 0x349b
movq %r13, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x3472
movq %r13, %rsi
cmpq %r13, %rcx
je 0x349b
cmpl 0x20(%rcx), %eax
cmovlq %r13, %rcx
movq %rcx, %rsi
movq %rbx, %r15
movslq 0x24(%rsi), %rbx
xorl %edi, %edi
leaq 0xde4(%rip), %rsi       # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movq 0x2d11(%rip), %rdx      # 0x61d0
movq %r13, %rsi
testq %rdx, %rdx
je 0x34f3
movq %r13, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x34ca
movq %r13, %rsi
cmpq %r13, %rcx
je 0x34f3
cmpl 0x20(%rcx), %eax
cmovlq %r13, %rcx
movq %rcx, %rsi
movslq 0x24(%rsi), %r12
xorl %edi, %edi
leaq 0xd8f(%rip), %rsi       # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2250
movq -0x30(%rbp), %rcx
movq (%rcx,%rbx,8), %rax
movsd %xmm0, (%rax,%r12,8)
movq (%rcx,%r12,8), %rax
movsd %xmm0, (%rax,%rbx,8)
movq %r14, %rsp
movq %r15, %rbx
jmp 0x33d8
leaq -0x260(%rbp), %rdi
callq 0x2080
movq -0x30(%rbp), %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3558
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x260(%rbp), %rdi
callq 0x20b0
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdeb(%rip), %rdi       # 0x4368
leaq 0xdf5(%rip), %rsi       # 0x4379
leaq 0xdfc(%rip), %rcx       # 0x4387
movl $0xcc, %edx
callq 0x2130
leaq 0xdcc(%rip), %rdi       # 0x4368
leaq 0xdd6(%rip), %rsi       # 0x4379
leaq 0xddd(%rip), %rcx       # 0x4387
movl $0xf6, %edx
callq 0x2130
jmp 0x35c3
movq %rax, %rbx
jmp 0x35df
jmp 0x35c3
jmp 0x35c3
jmp 0x35c3
jmp 0x35c3
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x50(%rbp), %rdi
cmpq %rax, %rdi
je 0x35df
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x260(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22f0
nop