// File: /workspace/github_cpp_makefile_star2_O1/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 0x14bc
movl $0x4e208, %edx          # imm = 0x4E208
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a0
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $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
xorl %edx, %edx
movl %edx, (%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
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
movl 0x7530c(%rbx), %eax
movl %eax, 0x4(%rsi)
movl 0x75308(%rbx), %eax
movl %eax, 0x8(%rsi)
movl %edx, 0xc(%rsi)
leaq 0x30(%rsp), %rdi
callq 0x1946
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 0x18d2
movslq 0x8(%rax), %r12
movslq 0x4(%rax), %r14
movl (%rax), %r15d
leaq 0x30(%rsp), %rdi
callq 0x1982
incl %ebp
imulq $0x320, %r12, %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 0x18d2
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 %rbp, %r15
jne 0x17ef
incq %rbp
cmpq $0x4, %rbp
jne 0x17dc
jmp 0x188d
movl 0x7531c(%rbx,%rbp,4), %eax
addl %r12d, %eax
js 0x17e1
movl 0x7532c(%rbx,%rbp,4), %ecx
addl %r14d, %ecx
js 0x17e1
cmpl 0x4e200(%rbx), %eax
jge 0x17e1
cmpl 0x4e204(%rbx), %ecx
jge 0x17e1
movl %eax, %esi
movl %ecx, %edx
imulq $0x320, %rsi, %rdi      # imm = 0x320
leaq (%rbx,%rdi), %r8
cmpl $0x1, (%r8,%rdx,4)
je 0x17e1
movq (%rsp), %r8
leaq (%r8,%rdi), %r9
movl (%r13), %r8d
incl %r8d
cmpl %r8d, (%r9,%rdx,4)
jle 0x17e1
addq 0x10(%rsp), %rdi
cmpl $0x1, (%rdi,%rdx,4)
jg 0x17e1
leaq (%r9,%rdx,4), %rdi
movl %r8d, (%rdi)
imulq $0x320, %rsi, %rsi      # imm = 0x320
addq (%rsp), %rsi
xorl %edi, %edi
subl (%rsi,%rdx,4), %edi
movl %ebp, %edx
xorl $0x2, %edx
movl %edx, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movl %eax, 0x20(%rsp)
movl %edi, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1946
jmp 0x17e1
movq %rbx, %rdi
callq 0x32a8
movl 0xc(%rsp), %ebp
movq 0x28(%rsp), %rax
movl $0x2, (%rax)
movq 0x38(%rsp), %rdx
subq 0x30(%rsp), %rdx
shrq $0x4, %rdx
leaq 0x28f6(%rip), %rdi      # 0x41af
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl 0x75318(%rbx), %edi
callq 0x1160
jmp 0x1778
movl 0x75310(%rbx), %esi
movl 0x75314(%rbx), %edx
movq %rbx, %rdi
callq 0x15e2
movq %rbx, %rdi
callq 0x32a8
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 0x28c0(%rip), %rdi      # 0x41d4
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
jmp 0x1923
jmp 0x1923
jmp 0x1923
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x193d
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1190
nop