// File: /workspace/github_cpp_makefile_star2_O1/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 0x35ca
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebx, %ebx
leaq 0x1056(%rip), %r13      # 0x428f
leaq 0x2f88(%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 0x3372
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 0x32b0
movq -0x50(%rbp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x32a0
movb $0x0, (%rdi,%rax)
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x58(%rbp)
movq 0x2f02(%rip), %rdx      # 0x61d0
movq %r12, %rcx
testq %rdx, %rdx
je 0x32f0
movq %r12, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x32d9
cmpq %r12, %rcx
je 0x32fa
cmpl 0x20(%rcx), %eax
jge 0x330e
leaq 0x2ebf(%rip), %rdi      # 0x61c0
leaq -0x58(%rbp), %rsi
callq 0x3652
movl %ebx, (%rax)
incl %ebx
xorl %edi, %edi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movl %eax, -0x54(%rbp)
movq 0x2ea6(%rip), %rdx      # 0x61d0
movq %r12, %rcx
testq %rdx, %rdx
je 0x334c
movq %r12, %rcx
xorl %esi, %esi
cmpl %eax, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x3335
cmpq %r12, %rcx
je 0x3356
cmpl 0x20(%rcx), %eax
jge 0x336a
leaq 0x2e63(%rip), %rdi      # 0x61c0
leaq -0x54(%rbp), %rsi
callq 0x3652
movl %ebx, (%rax)
incl %ebx
movq %r14, %rsp
jmp 0x3240
leaq -0x260(%rbp), %rdi
callq 0x2080
movq 0x2e63(%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 0x33c5
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 0x33b1
testl %r14d, %r14d
jle 0x33f2
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 0x33dc
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 0x35e9
leaq 0x2d9c(%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 0x3583
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 0x349c
movq -0x50(%rbp), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x348c
movb $0x0, (%rdi,%rax)
leaq 0xde8(%rip), %rsi       # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movq 0x2d15(%rip), %rdx      # 0x61d0
movq %r13, %rcx
testq %rdx, %rdx
je 0x34dd
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 0x34c6
movq %rbx, %r15
movq %r13, %rdx
cmpq %r13, %rcx
je 0x34f2
cmpl 0x20(%rcx), %eax
cmovlq %r13, %rcx
movq %rcx, %rdx
movslq 0x24(%rdx), %rbx
xorl %edi, %edi
leaq 0xd90(%rip), %rsi       # 0x428f
callq 0x22a0
movq %rax, %rdi
callq 0x2290
movq 0x2cbd(%rip), %rdx      # 0x61d0
movq %r13, %rcx
testq %rdx, %rdx
je 0x3535
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 0x351e
movq %r13, %rdx
cmpq %r13, %rcx
je 0x3547
cmpl 0x20(%rcx), %eax
cmovlq %r13, %rcx
movq %rcx, %rdx
movslq 0x24(%rdx), %r12
xorl %edi, %edi
leaq 0xd3b(%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 0x342c
leaq -0x260(%rbp), %rdi
callq 0x2080
movq -0x30(%rbp), %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x35ac
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 0xd97(%rip), %rdi       # 0x4368
leaq 0xda1(%rip), %rsi       # 0x4379
leaq 0xda8(%rip), %rcx       # 0x4387
movl $0xcc, %edx
callq 0x2130
leaq 0xd78(%rip), %rdi       # 0x4368
leaq 0xd82(%rip), %rsi       # 0x4379
leaq 0xd89(%rip), %rcx       # 0x4387
movl $0xf6, %edx
callq 0x2130
jmp 0x3617
movq %rax, %rbx
jmp 0x3633
jmp 0x3617
jmp 0x3617
jmp 0x3617
jmp 0x3617
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x50(%rbp), %rdi
cmpq %rax, %rdi
je 0x3633
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x260(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22f0
nop