// File: /workspace/github_cpp_makefile_star2_O1/sharmaeklavya2[P]ddos-on-anycast/src/lib/attack.cpp
// Function: dijkstra(Network const&, std::priority_queue<std::tuple<int, int>, std::vector<std::tuple<int, int>, std::allocator<std::tuple<int, int>>>, std::greater<std::tuple<int, int>>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<bool, std::allocator<bool>>&, int, int)
void dijkstra(const Network& network, PQ& pq, ivec& target, ivec& target_dist, vector<bool>& visited, int in_weight, int side_weight) {

    while(!pq.empty()) {
        int u, du;
        std::tie(du, u) = pq.top();
        pq.pop();
        if(visited[u]) {
            continue;
        }
        visited[u] = true;
        if(du != target_dist[u]) {
            fprintf(stderr, "u=%d, du=%d, target_dist[%d]=%d\n", u, du, u, target_dist[u]);
        }
        ipvec l;
        l.reserve(network.in_nbrs[u].size() + network.side_nbrs[u].size());
        if(in_weight != -1) {
            for(int v: network.in_nbrs[u]) {
                l.emplace_back(v, in_weight);
            }
        }
        if(side_weight != -1) {
            for(int v: network.side_nbrs[u]) {
                l.emplace_back(v, side_weight);
            }
        }
        for(const iipair& p: l) {
            int v = p.first, w = p.second;
            int dv = target_dist[v];
            if(dv == -1 || iipair(du+w, target[u]) < iipair(dv, target[v])) {
                target_dist[v] = du+w;
                target[v] = target[u];
                pq.emplace(du+w, v);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %rdi, 0x10(%rsp)
movl %r9d, 0xc(%rsp)
movq (%rsi), %rax
cmpq 0x8(%rsi), %rax
je 0x7d51
movq %r8, %r14
movq %rsi, %r12
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
leaq 0x3f(%r15), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x8(%rsp), %r13
movq %r8, 0x48(%rsp)
movl 0x4(%rax), %ebx
movslq (%rax), %rbp
movq %r12, %rdi
callq 0x845e
leaq 0x3f(%rbp), %rax
testq %rbp, %rbp
cmovnsq %rbp, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq (%r14), %rax
movq %rbp, %rcx
andq 0x50(%rsp), %rcx
xorl %edx, %edx
cmpq %r15, %rcx
setbe %dl
movl $0x1, %esi
movl %ebp, %ecx
shlq %cl, %rsi
movq -0x8(%rax,%rdx,8), %rcx
btq %rbp, %rcx
jb 0x7d1c
leaq -0x8(,%rdx,8), %rdx
orq %rsi, %rcx
movq %rcx, (%rax,%rdx)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl (%rax,%rbp,4), %r9d
cmpl %r9d, %ebx
jne 0x7d2d
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %rax
movq 0x10(%rsp), %rdx
movq 0x48(%rdx), %rcx
movq 0x60(%rdx), %rdx
movq 0x8(%rcx,%rax), %rdi
subq (%rcx,%rax), %rdi
sarq $0x2, %rdi
movq 0x8(%rdx,%rax), %rsi
subq (%rdx,%rax), %rsi
sarq $0x2, %rsi
addq %rdi, %rsi
leaq 0x20(%rsp), %rdi
callq 0x6a60
cmpl $-0x1, 0xc(%rsp)
je 0x7c3b
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %r14
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %r14
je 0x7c3b
movl (%r14), %eax
movl %eax, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
leaq 0xc(%rsp), %rdx
callq 0x682a
addq $0x4, %r14
jmp 0x7c17
cmpl $-0x1, 0x90(%rsp)
je 0x7c89
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %r14
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %r14
je 0x7c89
movl (%r14), %eax
movl %eax, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
leaq 0x90(%rsp), %rdx
callq 0x682a
addq $0x4, %r14
jmp 0x7c62
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r15
cmpq %r15, %r14
je 0x7cfe
movslq (%r14), %rcx
movl %ecx, 0x8(%rsp)
movl 0x4(%r14), %eax
movq 0x38(%rsp), %rdx
movq (%rdx), %rdx
movl (%rdx,%rcx,4), %esi
cmpl $-0x1, %esi
je 0x7ccc
leal (%rax,%rbx), %edi
cmpl %esi, %edi
jl 0x7ccc
jg 0x7cf8
movq 0x40(%rsp), %rsi
movq (%rsi), %rsi
movl (%rsi,%rcx,4), %edi
cmpl %edi, (%rsi,%rbp,4)
jge 0x7cf8
addl %ebx, %eax
movl %eax, (%rdx,%rcx,4)
movq 0x40(%rsp), %rcx
movq (%rcx), %rcx
movl (%rcx,%rbp,4), %edx
movslq 0x8(%rsp), %rsi
movl %edx, (%rcx,%rsi,4)
movl %eax, 0x1c(%rsp)
movq %r12, %rdi
leaq 0x1c(%rsp), %rsi
movq %r13, %rdx
callq 0x84ae
addq $0x8, %r14
jmp 0x7c93
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x7d0d
callq 0x2150
movq 0x48(%rsp), %r14
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq (%r12), %rax
cmpq 0x8(%r12), %rax
jne 0x7b31
jmp 0x7d51
movq 0xa29c(%rip), %rax      # 0x11fd0
movq (%rax), %rdi
leaq 0x5924(%rip), %rsi      # 0xd662
movl %ebp, %edx
movl %ebx, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x21b0
jmp 0x7ba2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d66
jmp 0x7d66
jmp 0x7d66
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x7d78
callq 0x2150
movq %rbx, %rdi
callq 0x2220