// File: 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
movq %rsp, %rbp
subq $0x4e2e0, %rsp          # imm = 0x4E2E0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x4e2a0(%rbp)
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
leaq -0x4e21c(%rbp), %rdi
movq %rdi, -0x4e2a8(%rbp)
callq 0x2670
movq -0x4e2a8(%rbp), %rsi
movq -0x4e2a0(%rbp), %rdi
movl $0x4e208, %edx          # imm = 0x4E208
callq 0x2120
leaq -0x4e240(%rbp), %rdi
callq 0x2f20
movq -0x4e2a0(%rbp), %rsi
movslq 0x75308(%rsi), %rax
imulq $0x320, %rax, %rcx      # imm = 0x320
movq %rsi, %rax
addq %rcx, %rax
movq %rsi, %rdx
addq $0x75308, %rdx          # imm = 0x75308
movq %rsi, %rcx
addq $0x7530c, %rcx          # imm = 0x7530C
movslq 0x7530c(%rsi), %rdi
movl $0x0, 0x4e208(%rax,%rdi,4)
movslq 0x75308(%rsi), %rax
imulq $0x320, %rax, %rdi      # imm = 0x320
movq %rsi, %rax
addq %rdi, %rax
movslq 0x7530c(%rsi), %rsi
movl $0x2, 0x27100(%rax,%rsi,4)
movl $0x0, -0x4e254(%rbp)
movl $0xffffffff, -0x4e258(%rbp) # imm = 0xFFFFFFFF
leaq -0x4e250(%rbp), %rdi
leaq -0x4e254(%rbp), %rsi
leaq -0x4e258(%rbp), %r8
callq 0x2fa0
jmp 0x2a44
leaq -0x4e240(%rbp), %rdi
leaq -0x4e250(%rbp), %rsi
callq 0x2f50
jmp 0x2a59
movl $0x0, -0x4e27c(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x2ff0
movb %al, -0x4e2a9(%rbp)
jmp 0x2a77
movb -0x4e2a9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2a88
jmp 0x2e6d
leaq -0x4e240(%rbp), %rdi
callq 0x3030
movq %rax, -0x4e2b8(%rbp)
jmp 0x2a9d
movq -0x4e2b8(%rbp), %rdi
callq 0x3010
movl (%rax), %eax
movl %eax, -0x4e268(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x3030
movq %rax, -0x4e2c0(%rbp)
jmp 0x2ac6
movq -0x4e2c0(%rbp), %rdi
callq 0x3050
movl (%rax), %eax
movl %eax, -0x4e26c(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x3030
movq %rax, -0x4e2c8(%rbp)
jmp 0x2aef
movq -0x4e2c8(%rbp), %rdi
callq 0x3070
movl (%rax), %eax
movl %eax, -0x4e270(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x3090
jmp 0x2b11
movq -0x4e2a0(%rbp), %rax
movl -0x4e27c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x4e27c(%rbp)
movq %rax, %rcx
addq $0x27100, %rcx          # imm = 0x27100
movslq -0x4e268(%rbp), %rdx
imulq $0x320, %rdx, %rdx      # imm = 0x320
addq %rdx, %rcx
movslq -0x4e26c(%rbp), %rdx
movl $0x3, (%rcx,%rdx,4)
movslq -0x4e268(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x4e26c(%rbp), %rcx
cmpl $0x3, (%rax,%rcx,4)
jne 0x2b96
jmp 0x2e6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4e260(%rbp)
movl %eax, -0x4e264(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x3100
jmp 0x2f09
movl $0x0, -0x4e280(%rbp)
cmpl $0x4, -0x4e280(%rbp)
jge 0x2ddc
movl -0x4e280(%rbp), %eax
cmpl -0x4e270(%rbp), %eax
jne 0x2bc0
jmp 0x2dc8
movq -0x4e2a0(%rbp), %rcx
movl -0x4e268(%rbp), %eax
movslq -0x4e280(%rbp), %rdx
addl 0x7531c(%rcx,%rdx,4), %eax
movl %eax, -0x4e274(%rbp)
movl -0x4e26c(%rbp), %eax
movslq -0x4e280(%rbp), %rdx
addl 0x7532c(%rcx,%rdx,4), %eax
movl %eax, -0x4e278(%rbp)
cmpl $0x0, -0x4e274(%rbp)
jl 0x2c37
cmpl $0x0, -0x4e278(%rbp)
jl 0x2c37
movq -0x4e2a0(%rbp), %rcx
movl -0x4e274(%rbp), %eax
cmpl 0x4e200(%rcx), %eax
jge 0x2c37
movq -0x4e2a0(%rbp), %rcx
movl -0x4e278(%rbp), %eax
cmpl 0x4e204(%rcx), %eax
jl 0x2c3c
jmp 0x2dc8
movq -0x4e2a0(%rbp), %rax
movslq -0x4e274(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x4e278(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
je 0x2dc6
movq -0x4e2a0(%rbp), %rcx
movq %rcx, %rax
addq $0x4e208, %rax          # imm = 0x4E208
movslq -0x4e274(%rbp), %rdx
imulq $0x320, %rdx, %rdx      # imm = 0x320
addq %rdx, %rax
movslq -0x4e278(%rbp), %rdx
movl (%rax,%rdx,4), %eax
addq $0x4e208, %rcx          # imm = 0x4E208
movslq -0x4e268(%rbp), %rdx
imulq $0x320, %rdx, %rdx      # imm = 0x320
addq %rdx, %rcx
movslq -0x4e26c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x2dc6
movq -0x4e2a0(%rbp), %rax
addq $0x27100, %rax          # imm = 0x27100
movslq -0x4e274(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x4e278(%rbp), %rcx
cmpl $0x2, (%rax,%rcx,4)
jge 0x2dc6
movq -0x4e2a0(%rbp), %rax
movslq -0x4e268(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
leaq 0x4e208(%rax,%rcx), %rcx
movslq -0x4e26c(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
incl %esi
movslq -0x4e274(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
leaq 0x4e208(%rax,%rcx), %rcx
movslq -0x4e278(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movslq -0x4e274(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
leaq 0x4e208(%rax,%rcx), %rax
movslq -0x4e278(%rbp), %rcx
movl (%rax,%rcx,4), %eax
negl %eax
movl %eax, -0x4e294(%rbp)
movl -0x4e280(%rbp), %edx
movl %edx, %eax
addl $0x2, %eax
movl %edx, %ecx
addl $0x5, %ecx
testl %eax, %eax
cmovsl %ecx, %eax
andl $-0x4, %eax
negl %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x2(%rax,%rcx), %eax
movl %eax, -0x4e298(%rbp)
leaq -0x4e290(%rbp), %rdi
leaq -0x4e294(%rbp), %rsi
leaq -0x4e274(%rbp), %rdx
leaq -0x4e278(%rbp), %rcx
leaq -0x4e298(%rbp), %r8
callq 0x2fa0
jmp 0x2daf
leaq -0x4e240(%rbp), %rdi
leaq -0x4e290(%rbp), %rsi
callq 0x2f50
jmp 0x2dc4
jmp 0x2dc6
jmp 0x2dc8
movl -0x4e280(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e280(%rbp)
jmp 0x2ba0
movq -0x4e2a0(%rbp), %rdi
callq 0x89a0
jmp 0x2dea
movq -0x4e2a0(%rbp), %rax
movslq -0x4e268(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movslq -0x4e26c(%rbp), %rcx
movl $0x2, 0x27100(%rax,%rcx,4)
movl -0x4e27c(%rbp), %eax
movl %eax, -0x4e2d4(%rbp)
leaq -0x4e240(%rbp), %rdi
callq 0x30e0
movq %rax, -0x4e2d0(%rbp)
jmp 0x2e35
movl -0x4e2d4(%rbp), %esi
movq -0x4e2d0(%rbp), %rax
movl %eax, %edx
leaq 0x736c(%rip), %rdi      # 0xa1b7
xorl %eax, %eax
callq 0x2030
jmp 0x2e54
movq -0x4e2a0(%rbp), %rax
movl 0x75318(%rax), %edi
callq 0x2260
jmp 0x2e68
jmp 0x2a63
movq -0x4e2a0(%rbp), %rcx
movq %rcx, %rax
addq $0x4e208, %rax          # imm = 0x4E208
movslq 0x75310(%rcx), %rdx
imulq $0x320, %rdx, %rdx      # imm = 0x320
addq %rdx, %rax
movslq 0x75314(%rcx), %rcx
cmpl $0x3ade68b1, (%rax,%rcx,4) # imm = 0x3ADE68B1
je 0x2f07
movq -0x4e2a0(%rbp), %rdi
movl 0x75310(%rdi), %esi
movl 0x75314(%rdi), %edx
callq 0x2820
jmp 0x2eb8
movq -0x4e2a0(%rbp), %rdi
callq 0x89a0
jmp 0x2ec6
movq -0x4e2a0(%rbp), %rcx
movl -0x4e27c(%rbp), %esi
movslq 0x75310(%rcx), %rax
imulq $0x320, %rax, %rdx      # imm = 0x320
movq %rcx, %rax
addq %rdx, %rax
movslq 0x75314(%rcx), %rcx
movl 0x4e208(%rax,%rcx,4), %edx
leaq 0x72e0(%rip), %rdi      # 0xa1dc
xorl %eax, %eax
callq 0x2030
jmp 0x2f05
jmp 0x2f07
ud2
movq -0x4e260(%rbp), %rdi
callq 0x22a0
nopw %cs:(%rax,%rax)
nop