// File: 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
subq $0x3c0, %rsp            # imm = 0x3C0
movq %rdi, -0x318(%rbp)
movq %rdi, -0x8(%rbp)
leaq -0x210(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x22f0
movq -0x318(%rbp), %rdi
callq 0x2140
movq -0x310(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x2160
jmp 0x367b
leaq -0x210(%rbp), %rdi
callq 0x23c0
movb %al, -0x319(%rbp)
jmp 0x368f
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x369b
jmp 0x369d
jmp 0x36d3
leaq 0x2cbc(%rip), %rdi      # 0x6360
leaq 0x2cc6(%rip), %rsi      # 0x6371
movl $0xcc, %edx
leaq 0x2cc8(%rip), %rcx      # 0x637f
callq 0x2170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x3e03
leaq -0x240(%rbp), %rdi
callq 0x2350
movl $0x0, -0x244(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3f30
leaq -0x210(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2090
movq %rax, -0x328(%rbp)
jmp 0x3711
movq -0x328(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2330
movb %al, -0x329(%rbp)
jmp 0x372f
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x373e
jmp 0x39d3
leaq -0x240(%rbp), %rdi
callq 0x2380
movq %rax, %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x258(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x338(%rbp)
movq %rcx, %rsp
movq %rax, -0x260(%rbp)
movl $0x0, -0x264(%rbp)
movslq -0x264(%rbp), %rax
movq %rax, -0x340(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x2380
movq %rax, %rcx
movq -0x340(%rbp), %rax
cmpq %rcx, %rax
jae 0x3819
movslq -0x264(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x2450
movq %rax, -0x348(%rbp)
jmp 0x37cb
movq -0x338(%rbp), %rax
movq -0x348(%rbp), %rcx
movb (%rcx), %dl
movslq -0x264(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x3786
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x2150
jmp 0x3e03
leaq -0x240(%rbp), %rdi
callq 0x2380
movq -0x338(%rbp), %rdi
movb $0x0, (%rdi,%rax)
leaq 0x2a50(%rip), %rsi      # 0x6287
callq 0x23b0
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rdi
callq 0x23a0
movl %eax, -0x274(%rbp)
leaq 0x59fc(%rip), %rdi      # 0x9258
leaq -0x274(%rbp), %rsi
callq 0x3f50
movq %rax, -0x350(%rbp)
jmp 0x3871
movq -0x350(%rbp), %rax
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq 0x59c4(%rip), %rdi      # 0x9258
callq 0x3fb0
movq %rax, -0x288(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x4000
testb $0x1, %al
jne 0x38b9
jmp 0x38f8
movl -0x244(%rbp), %eax
movl %eax, -0x35c(%rbp)
incl %eax
movl %eax, -0x244(%rbp)
leaq 0x5984(%rip), %rdi      # 0x9258
leaq -0x274(%rbp), %rsi
callq 0x4030
movq %rax, -0x358(%rbp)
jmp 0x38e9
movq -0x358(%rbp), %rax
movl -0x35c(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x2988(%rip), %rsi      # 0x6287
xorl %eax, %eax
movl %eax, %edi
callq 0x23b0
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rdi
callq 0x23a0
movl %eax, -0x28c(%rbp)
leaq 0x5930(%rip), %rdi      # 0x9258
leaq -0x28c(%rbp), %rsi
callq 0x3f50
movq %rax, -0x368(%rbp)
jmp 0x393d
movq -0x368(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x298(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq 0x58f8(%rip), %rdi      # 0x9258
callq 0x3fb0
movq %rax, -0x2a0(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x4000
testb $0x1, %al
jne 0x3985
jmp 0x39c4
movl -0x244(%rbp), %eax
movl %eax, -0x374(%rbp)
incl %eax
movl %eax, -0x244(%rbp)
leaq 0x58b8(%rip), %rdi      # 0x9258
leaq -0x28c(%rbp), %rsi
callq 0x4030
movq %rax, -0x370(%rbp)
jmp 0x39b5
movq -0x370(%rbp), %rax
movl -0x374(%rbp), %ecx
movl %ecx, (%rax)
movq -0x258(%rbp), %rax
movq %rax, %rsp
jmp 0x36f5
leaq -0x210(%rbp), %rdi
callq 0x20a0
jmp 0x39e1
leaq 0x5870(%rip), %rdi      # 0x9258
callq 0x3e60
movl %eax, -0x2a4(%rbp)
movslq -0x2a4(%rbp), %rdi
shlq $0x3, %rdi
movslq -0x2a4(%rbp), %rax
imulq %rax, %rdi
callq 0x2340
movq %rax, -0x2b0(%rbp)
movl $0x0, -0x2b4(%rbp)
movl -0x2b4(%rbp), %eax
cmpl -0x2a4(%rbp), %eax
jge 0x3a63
movslq -0x2a4(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2340
movq %rax, %rdx
movq -0x2b0(%rbp), %rax
movslq -0x2b4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x2b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b4(%rbp)
jmp 0x3a1f
movl $0x0, -0x2b8(%rbp)
movl -0x2b8(%rbp), %eax
cmpl -0x2a4(%rbp), %eax
jge 0x3ad8
movl $0x0, -0x2bc(%rbp)
movl -0x2bc(%rbp), %eax
cmpl -0x2a4(%rbp), %eax
jge 0x3ac5
movq -0x2b0(%rbp), %rax
movslq -0x2b8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2bc(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x2bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2bc(%rbp)
jmp 0x3a85
jmp 0x3ac7
movl -0x2b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b8(%rbp)
jmp 0x3a6d
movq -0x318(%rbp), %rdi
callq 0x2140
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
movl $0x8, %edx
callq 0x2160
jmp 0x3afa
leaq -0x210(%rbp), %rdi
callq 0x23c0
movb %al, -0x375(%rbp)
jmp 0x3b0e
movb -0x375(%rbp), %al
testb $0x1, %al
jne 0x3b1a
jmp 0x3b1c
jmp 0x3b3b
leaq 0x283d(%rip), %rdi      # 0x6360
leaq 0x2847(%rip), %rsi      # 0x6371
movl $0xf6, %edx
leaq 0x2849(%rip), %rcx      # 0x637f
callq 0x2170
jmp 0x3b3d
leaq -0x210(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2090
movq %rax, -0x380(%rbp)
jmp 0x3b59
movq -0x380(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2330
movb %al, -0x381(%rbp)
jmp 0x3b77
movb -0x381(%rbp), %al
testb $0x1, %al
jne 0x3b86
jmp 0x3dc3
leaq -0x240(%rbp), %rdi
callq 0x2380
movq %rax, %rdx
movq %rdx, %rax
incq %rax
movq %rsp, %rcx
movq %rcx, -0x2c8(%rbp)
addq $0x10, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x390(%rbp)
movq %rcx, %rsp
movq %rax, -0x2d0(%rbp)
movl $0x0, -0x2d4(%rbp)
movslq -0x2d4(%rbp), %rax
movq %rax, -0x398(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x2380
movq %rax, %rcx
movq -0x398(%rbp), %rax
cmpq %rcx, %rax
jae 0x3c3e
movslq -0x2d4(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x2450
movq %rax, -0x3a0(%rbp)
jmp 0x3c13
movq -0x390(%rbp), %rax
movq -0x3a0(%rbp), %rcx
movb (%rcx), %dl
movslq -0x2d4(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d4(%rbp)
jmp 0x3bce
leaq -0x240(%rbp), %rdi
callq 0x2380
movq -0x390(%rbp), %rdi
movb $0x0, (%rdi,%rax)
leaq 0x262b(%rip), %rsi      # 0x6287
callq 0x23b0
movq %rax, -0x2e0(%rbp)
movq -0x2e0(%rbp), %rdi
callq 0x23a0
movl %eax, -0x2ec(%rbp)
leaq 0x55d7(%rip), %rdi      # 0x9258
leaq -0x2ec(%rbp), %rsi
callq 0x3f50
movq %rax, -0x3a8(%rbp)
jmp 0x3c96
movq -0x3a8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3fe0
movl 0x4(%rax), %eax
movl %eax, -0x2f0(%rbp)
leaq 0x25b9(%rip), %rsi      # 0x6287
xorl %eax, %eax
movl %eax, %edi
callq 0x23b0
movq %rax, -0x2e0(%rbp)
movq -0x2e0(%rbp), %rdi
callq 0x23a0
movl %eax, -0x2fc(%rbp)
leaq 0x5561(%rip), %rdi      # 0x9258
leaq -0x2fc(%rbp), %rsi
callq 0x3f50
movq %rax, -0x3b0(%rbp)
jmp 0x3d0c
movq -0x3b0(%rbp), %rax
movq %rax, -0x2f8(%rbp)
movq -0x2f8(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3fe0
movl 0x4(%rax), %eax
movl %eax, -0x300(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x253f(%rip), %rsi      # 0x6287
callq 0x23b0
movq %rax, -0x2e0(%rbp)
movq -0x2e0(%rbp), %rdi
callq 0x2320
movsd %xmm0, -0x308(%rbp)
movsd -0x308(%rbp), %xmm0
movq -0x2b0(%rbp), %rax
movslq -0x2f0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x300(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x308(%rbp), %xmm0
movq -0x2b0(%rbp), %rax
movslq -0x300(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2f0(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x2c8(%rbp), %rax
movq %rax, %rsp
jmp 0x3b3d
leaq -0x210(%rbp), %rdi
callq 0x20a0
jmp 0x3dd1
movq -0x2b0(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x2150
leaq -0x210(%rbp), %rdi
callq 0x20c0
movq -0x3b8(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
leaq -0x210(%rbp), %rdi
callq 0x20c0
movq -0x218(%rbp), %rdi
callq 0x23f0
nopl (%rax,%rax)