// File: /workspace/github_cpp_makefile_star2_O2/yupyub[P]PathFinding_Visual/Dijkstra.cpp
// Function: Dijkstra::Dijkstra_Run(int, int)
int Dijkstra::Dijkstra_Run(int tset, int mnum){
    int g;
    vv = Init(tset,mnum);
    priority_queue<tuple<int,int,int,int> >pq;
    dist[sx][sy] = 0;
    vv.state[sx][sy] = 2;
    pq.push(make_tuple(0,sx,sy,-1));
    int x,y,dir,nx,ny,itr = 0;
    while(!pq.empty()){
        x = get<1>(pq.top());
        y = get<2>(pq.top());
        dir = get<3>(pq.top());
        pq.pop();
        itr++;
        vv.state[x][y] = 3;
        if(vv.map[x][y] == 3) break;
        for(int i = 0;i<4;i++){
            if(i == dir) continue;
            nx = x+dx[i];
            ny = y+dy[i];
            if(nx<0||ny<0||nx>=vv.N||ny>=vv.M) continue;
            if(vv.map[nx][ny] != 1 && dist[nx][ny] > dist[x][y] + 1 && vv.state[nx][ny] < 2){
                dist[nx][ny] = dist[x][y] + 1;
                pq.push(make_tuple(-dist[nx][ny],nx,ny,(i+2)%4));
            }
        }
        vv.draw();
        vv.state[x][y] = 2;
        printf("Total Iteration : %d / inqueue : %d\n",itr,(int)pq.size());
        usleep(timeSet);
    }
    if(dist[ex][ey] != INF){
        sol_path(ex,ey);
        vv.draw();
        printf("Total Iteration : %d / Path Distance : %d\n",itr,dist[ex][ey]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4e238, %rsp          # imm = 0x4E238
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24ac
movl $0x4e208, %edx          # imm = 0x4E208
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20c0
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movslq 0x75308(%rbx), %rax
movslq 0x7530c(%rbx), %rcx
imulq $0x320, %rax, %rax      # imm = 0x320
addq %rbx, %rax
addq $0x4e208, %rax          # imm = 0x4E208
andl $0x0, (%rax,%rcx,4)
movslq 0x75308(%rbx), %rax
movslq 0x7530c(%rbx), %rcx
imulq $0x320, %rax, %rax      # imm = 0x320
addq %rbx, %rax
addq $0x27100, %rax          # imm = 0x27100
movl $0x2, (%rax,%rcx,4)
leaq 0x18(%rsp), %rsi
orl $-0x1, (%rsi)
movq 0x75308(%rbx), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x4(%rsi)
andl $0x0, 0xc(%rsi)
leaq 0x30(%rsp), %rdi
callq 0x289c
leaq 0x4e208(%rbx), %rax
movq %rax, (%rsp)
leaq 0x27100(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
movq 0x30(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x2835
movslq 0x8(%rax), %r15
movslq 0x4(%rax), %r14
movl (%rax), %r12d
leaq 0x30(%rsp), %rdi
callq 0x28b2
incl %ebp
imulq $0x320, %r15, %rax      # imm = 0x320
movq 0x10(%rsp), %rcx
addq %rax, %rcx
movl $0x3, (%rcx,%r14,4)
leaq (%rbx,%rax), %rdx
cmpl $0x3, (%rdx,%r14,4)
je 0x2835
movl %ebp, 0xc(%rsp)
leaq (%rcx,%r14,4), %rcx
movq %rcx, 0x28(%rsp)
addq (%rsp), %rax
leaq (%rax,%r14,4), %r13
xorl %ebp, %ebp
cmpq $0x4, %rbp
je 0x27f0
cmpq %rbp, %r12
jne 0x2760
incq %rbp
jmp 0x274c
movl 0x7531c(%rbx,%rbp,4), %eax
addl %r15d, %eax
js 0x275b
movl 0x7532c(%rbx,%rbp,4), %ecx
addl %r14d, %ecx
js 0x275b
cmpl 0x4e200(%rbx), %eax
jge 0x275b
cmpl 0x4e204(%rbx), %ecx
jge 0x275b
movl %eax, %edx
movl %ecx, %esi
imulq $0x320, %rdx, %rdi      # imm = 0x320
leaq (%rbx,%rdi), %rdx
cmpl $0x1, (%rdx,%rsi,4)
je 0x275b
movq (%rsp), %rdx
leaq (%rdx,%rdi), %r8
movl (%r13), %edx
leal 0x1(%rdx), %r9d
cmpl %r9d, (%r8,%rsi,4)
jle 0x275b
addq 0x10(%rsp), %rdi
cmpl $0x1, (%rdi,%rsi,4)
jg 0x275b
leaq (%r8,%rsi,4), %rsi
movl %r9d, (%rsi)
notl %edx
movl %ebp, %esi
xorl $0x2, %esi
movl %esi, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movl %eax, 0x20(%rsp)
movl %edx, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x289c
jmp 0x275b
movq %rbx, %rdi
callq 0x3f8c
movl 0xc(%rsp), %ebp
movq 0x28(%rsp), %rax
movl $0x2, (%rax)
movq 0x38(%rsp), %rdx
subq 0x30(%rsp), %rdx
shrq $0x4, %rdx
leaq 0x29b4(%rip), %rdi      # 0x51d0
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
movl 0x75318(%rbx), %edi
callq 0x2180
jmp 0x26e8
movl 0x75310(%rbx), %esi
movl 0x75314(%rbx), %edx
movq %rbx, %rdi
callq 0x2574
movq %rbx, %rdi
callq 0x3f8c
movslq 0x75310(%rbx), %rax
movslq 0x75314(%rbx), %rcx
imulq $0x320, %rax, %rax      # imm = 0x320
movq (%rsp), %rdx
addq %rax, %rdx
movl (%rdx,%rcx,4), %edx
leaq 0x297e(%rip), %rdi      # 0x51f5
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x2886
jmp 0x2886
jmp 0x2886
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x28d4
movq %rbx, %rdi
callq 0x21b0
nop