// File: 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:
subq $0x158, %rsp            # imm = 0x158
movl 0x160(%rsp), %eax
movq %rdi, 0x150(%rsp)
movq %rsi, 0x148(%rsp)
movq %rdx, 0x140(%rsp)
movq %rcx, 0x138(%rsp)
movq %r8, 0x130(%rsp)
movl %r9d, 0x12c(%rsp)
movq 0x148(%rsp), %rdi
callq 0x135a0
xorb $-0x1, %al
testb $0x1, %al
jne 0x122c6
jmp 0x127f4
movq 0x148(%rsp), %rdi
callq 0x135c0
movq %rax, 0x38(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x124(%rsp), %rsi
leaq 0x128(%rsp), %rdx
callq 0x135d0
movq 0x38(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x13610
movq 0x148(%rsp), %rdi
callq 0x13650
movq 0x130(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x136a0
movq %rax, 0x100(%rsp)
movq %rdx, 0x108(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x13700
testb $0x1, %al
jne 0x1234c
jmp 0x12351
jmp 0x122ae
movq 0x130(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x136a0
movq %rax, 0xf0(%rsp)
movq %rdx, 0xf8(%rsp)
leaq 0xf0(%rsp), %rdi
movl $0x1, %esi
callq 0x13730
movl 0x124(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x138(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x4860
movq %rax, %rcx
movl 0x34(%rsp), %eax
cmpl (%rcx), %eax
je 0x1241b
movq 0x1ac0e(%rip), %rax     # 0x2cfc8
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movl 0x128(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x124(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x128(%rsp), %eax
movl %eax, 0x30(%rsp)
movq 0x138(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x4860
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %edx
movl 0x2c(%rsp), %ecx
movl 0x30(%rsp), %r8d
movl (%rax), %r9d
leaq 0xf1f6(%rip), %rsi      # 0x2160a
movb $0x0, %al
callq 0x2180
leaq 0xd8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x4a50
movq 0x150(%rsp), %rdi
addq $0x48, %rdi
movslq 0x128(%rsp), %rsi
callq 0x4a60
movq %rax, %rdi
callq 0x4f00
movq %rax, 0x10(%rsp)
movq 0x150(%rsp), %rdi
addq $0x60, %rdi
movslq 0x128(%rsp), %rsi
callq 0x4a60
movq %rax, %rdi
callq 0x4f00
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
addq %rax, %rsi
callq 0xd2d0
jmp 0x12488
cmpl $-0x1, 0x12c(%rsp)
je 0x1256a
movq 0x150(%rsp), %rdi
addq $0x48, %rdi
movslq 0x128(%rsp), %rsi
callq 0x4a60
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x4880
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x48b0
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x124fc
jmp 0x12568
leaq 0xb8(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0xac(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xac(%rsp), %rsi
leaq 0x12c(%rsp), %rdx
callq 0xce90
jmp 0x12531
jmp 0x12533
leaq 0xb8(%rsp), %rdi
callq 0x4930
jmp 0x124e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x4ae0
jmp 0x127fc
jmp 0x1256a
cmpl $-0x1, 0x160(%rsp)
je 0x12626
movq 0x150(%rsp), %rdi
addq $0x60, %rdi
movslq 0x128(%rsp), %rsi
callq 0x4a60
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x4880
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x48b0
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x125de
jmp 0x12624
leaq 0x98(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0x8c(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0x8c(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0xce90
jmp 0x12613
jmp 0x12615
leaq 0x98(%rsp), %rdi
callq 0x4930
jmp 0x125c3
jmp 0x12626
leaq 0xd8(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x7280
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rdi
callq 0x7100
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x9f70
testb $0x1, %al
jne 0x12672
jmp 0x127e2
leaq 0x78(%rsp), %rdi
callq 0x9fb0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x64(%rsp)
movq 0x68(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x60(%rsp)
movq 0x138(%rsp), %rdi
movslq 0x64(%rsp), %rsi
callq 0x4860
movl (%rax), %eax
movl %eax, 0x5c(%rsp)
movb $0x1, %al
cmpl $-0x1, 0x5c(%rsp)
movb %al, 0xf(%rsp)
je 0x1273c
movl 0x124(%rsp), %eax
movl 0x60(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x50(%rsp)
movq 0x140(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x4860
movq %rax, %rdx
leaq 0x54(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xe870
jmp 0x126f7
movq 0x140(%rsp), %rdi
movslq 0x64(%rsp), %rsi
callq 0x4860
movq %rax, %rdx
leaq 0x48(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
callq 0x4ab0
jmp 0x1271d
leaq 0x54(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x13780
movb %al, 0xe(%rsp)
jmp 0x12732
movb 0xe(%rsp), %al
movb %al, 0xf(%rsp)
jmp 0x1273c
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x12749
jmp 0x127d1
movl 0x124(%rsp), %eax
movl 0x60(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x4(%rsp)
movq 0x138(%rsp), %rdi
movslq 0x64(%rsp), %rsi
callq 0x4860
movl 0x4(%rsp), %ecx
movl %ecx, (%rax)
movq 0x140(%rsp), %rdi
movslq 0x128(%rsp), %rsi
callq 0x4860
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x140(%rsp), %rdi
movslq 0x64(%rsp), %rsi
callq 0x4860
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
movq 0x148(%rsp), %rdi
movl 0x124(%rsp), %eax
movl 0x60(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x44(%rsp)
leaq 0x44(%rsp), %rsi
leaq 0x64(%rsp), %rdx
callq 0x137e0
jmp 0x127cf
jmp 0x127d1
jmp 0x127d3
leaq 0x78(%rsp), %rdi
callq 0x9fc0
jmp 0x1265a
leaq 0xd8(%rsp), %rdi
callq 0x4ae0
jmp 0x122ae
addq $0x158, %rsp            # imm = 0x158
retq
movq 0xd0(%rsp), %rdi
callq 0x21f0
nopl (%rax)