// File: /workspace/github_cpp_makefile_star2_O1/yogesh1q2w[P]Dynamic-Graph-Algorithms/SPT.cpp
// Function: SPT::modify_inc(int, int, int, int)
void SPT::modify_inc(int u, int v, int oldwt, int diff) {
    set<int> M;
    unordered_map<int,int> M_inc;
    M.insert(v);
    M_inc[v] = diff;
    multiset<pair<int,pair<int,int>>> Q;
    Q.insert(make_pair(diff,make_pair(u,v)));
    
    vector<pair<int,int>> treeadj[spt.size()];
    int root;// get adjacency list representation of tree
    for (int i = 0; i < spt.size(); i++) { 
        if (spt[i].first == -1) 
            root = i; 
        else
            treeadj[spt[i].first].push_back(make_pair(i,spt[i].second));
    }

    vector<int> desc_v;
    descendants(v,desc_v,treeadj);
    for(auto &d: desc_v) {
        int min_inc = diff;
        pair<int,int> e_min_inc = make_pair(u,v);
        for(auto &sd: revadj[d]) {
            if(find(desc_v.begin(),desc_v.end(),sd) == desc_v.end()) {
                min_inc = min(dist[sd] + weight[make_pair(sd,d)] - dist[d], min_inc);
                e_min_inc = make_pair(d,sd);
            }
        }
        if(min_inc < M_inc[d]) {
            Q.insert(make_pair(min_inc,e_min_inc));
            M_inc[d] = min_inc;
        }
        for(auto &k:treeadj[d]) {
            M.insert(k.first);
            M_inc[k.first] = M_inc[d];
        }
    }

    while(!Q.empty()) {
        pair<int,pair<int,int>> e1 = *(Q.begin());
        Q.erase(Q.begin());
        spt[e1.second.second] = make_pair(e1.second.first,weight[e1.second]);
        treeadj[e1.second.first].push_back(make_pair(e1.second.second,e1.first));
        vector<int> desc_end_e1;
        descendants(e1.second.second,desc_end_e1,treeadj);
        for(auto &i:desc_end_e1) {
            dist[i] = dist[i] + e1.first;
            M.erase(i);
        }
        for(auto &i:Q) {
            if(find(desc_end_e1.begin(), desc_end_e1.end(), i.second.second) != desc_end_e1.end())
                Q.erase(i);
        }

        for(auto &i:desc_end_e1) {
            for(auto &j: M) {
                if(M.find(i) == M.end() && find(desc_end_e1.begin(),desc_end_e1.end(),j) == desc_end_e1.end() && weight.find(make_pair(i,j)) != weight.end()) {
                    int min_inc = dist[i] + weight[make_pair(i,j)] - dist[j];
                    if(min_inc < M_inc[j]) {
                        M_inc[j] = min_inc;
                        Q.insert(make_pair(min_inc,make_pair(i,j)));
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl %r8d, -0x98(%rbp)
movl %esi, -0x94(%rbp)
movq %rdi, %r15
leaq -0x2c(%rbp), %rsi
movl %edx, (%rsi)
leaq -0x150(%rbp), %r12
movl $0x0, (%r12)
xorl %eax, %eax
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
leaq -0x160(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x158(%rbp), %rdi
callq 0x50c6
leaq -0x190(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x38fc
movl -0x98(%rbp), %edx
movl %edx, (%rax)
leaq -0xf0(%rbp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movl -0x2c(%rbp), %eax
shlq $0x20, %rax
movl -0x94(%rbp), %ecx
orq %rax, %rcx
movl %edx, -0xb0(%rbp)
movq %rcx, -0xac(%rbp)
movq -0xb0(%rbp), %rax
movl -0xa8(%rbp), %ecx
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movl %ecx, 0x8(%rsi)
leaq -0xf8(%rbp), %rbx
movq %rbx, %rdi
callq 0xa824
leaq -0xb0(%rbp), %r8
movq %rbx, (%r8)
leaq -0x50(%rbp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xa87c
movq %rsp, -0x100(%rbp)
movq 0xe0(%r15), %rdx
movq 0xe8(%r15), %rsi
movq %rsi, %rax
subq %rdx, %rax
sarq $0x3, %rax
movq %rsp, %rbx
movq %rax, -0xb8(%rbp)
leaq (%rax,%rax,2), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
subq %rcx, %rbx
movq %rbx, %rsp
movq %rdx, -0xc8(%rbp)
movq %rsi, -0xc0(%rbp)
cmpq %rdx, %rsi
je 0x92b8
leaq -0x18(,%rax,8), %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20d0
movq %rbx, -0x68(%rbp)
movq 0xe0(%r15), %rax
cmpq %rax, 0xe8(%r15)
je 0x9336
xorl %ebx, %ebx
leaq -0xb0(%rbp), %r14
movslq (%rax,%rbx,8), %rcx
cmpq $-0x1, %rcx
je 0x9319
movl 0x4(%rax,%rbx,8), %eax
shlq $0x20, %rax
addq %rbx, %rax
leaq (%rcx,%rcx,2), %rcx
movq -0x68(%rbp), %rdx
leaq (%rdx,%rcx,8), %rdi
movq %rax, -0xb0(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x9311
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x9319
movq %r14, %rdx
callq 0x8676
incq %rbx
movq 0xe0(%r15), %rax
movq 0xe8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x92d5
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movl -0x2c(%rbp), %esi
movq %r15, -0x88(%rbp)
movq %r15, %rdi
movq -0x68(%rbp), %rcx
callq 0x9fba
movq -0xb0(%rbp), %r15
movq -0xa8(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq %rax, %r15
je 0x9539
movq -0x88(%rbp), %rax
leaq 0xa8(%rax), %rcx
movq %rcx, -0x108(%rbp)
addq $0x8, %rax
movq %rax, -0x118(%rbp)
movl -0x2c(%rbp), %ebx
movq -0x108(%rbp), %rdi
movq %r15, %rsi
callq 0xa19e
movq (%rax), %r14
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, -0x70(%rbp)
movl -0x98(%rbp), %r13d
movq %rax, -0x90(%rbp)
cmpq %rax, %r14
je 0x9464
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq %r14, %rdx
callq 0xa920
cmpq -0xa8(%rbp), %rax
jne 0x9453
movl %r13d, -0x70(%rbp)
movslq (%r14), %rax
movq -0x88(%rbp), %r13
movq 0xf8(%r13), %rcx
movl (%rcx,%rax,4), %ebx
movl (%r14), %eax
movl (%r15), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x50(%rbp)
movq -0x118(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7f1c
addl (%rax), %ebx
movslq (%r15), %rax
movq 0xf8(%r13), %rcx
subl (%rcx,%rax,4), %ebx
movl -0x70(%rbp), %r13d
cmpl %ebx, %r13d
cmovgel %ebx, %r13d
movl (%r15), %eax
movl %eax, -0x70(%rbp)
movl (%r14), %ebx
addq $0x4, %r14
cmpq -0x90(%rbp), %r14
jne 0x93d8
leaq -0x190(%rbp), %rdi
movq %r15, %rsi
callq 0x38fc
leaq -0x60(%rbp), %r14
cmpl (%rax), %r13d
jge 0x94d6
movl %r13d, -0x50(%rbp)
shlq $0x20, %rbx
movl -0x70(%rbp), %eax
orq %rbx, %rax
movq %rax, -0x4c(%rbp)
movq -0x50(%rbp), %rax
movl -0x48(%rbp), %ecx
movq %rax, -0x60(%rbp)
movl %ecx, -0x58(%rbp)
leaq -0xf8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa824
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rcx
leaq -0x50(%rbp), %r8
callq 0xa87c
leaq -0x190(%rbp), %rdi
movq %r15, %rsi
callq 0x38fc
movl %r13d, (%rax)
movslq (%r15), %rax
leaq (%rax,%rax,2), %rax
movq -0x68(%rbp), %rcx
movq (%rcx,%rax,8), %r14
movq 0x8(%rcx,%rax,8), %rbx
cmpq %rbx, %r14
je 0x9528
leaq -0x158(%rbp), %rdi
movq %r14, %rsi
callq 0x50c6
leaq -0x190(%rbp), %rdi
movq %r15, %rsi
callq 0x38fc
movl (%rax), %r13d
leaq -0x190(%rbp), %rdi
movq %r14, %rsi
callq 0x38fc
movl %r13d, (%rax)
addq $0x8, %r14
jmp 0x94ea
addq $0x4, %r15
cmpq -0x110(%rbp), %r15
jne 0x939f
cmpq $0x0, -0xd0(%rbp)
movq -0x88(%rbp), %r15
je 0x986e
leaq 0x8(%r15), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rbx
leaq -0x158(%rbp), %r13
movq -0xe0(%rbp), %rsi
movq 0x20(%rsi), %rax
movq %rax, -0x80(%rbp)
movl 0x28(%rsi), %eax
movl %eax, -0x78(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xa9c2
movq -0x90(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xaa04
movl -0x7c(%rbp), %ecx
movl (%rax), %eax
movslq -0x78(%rbp), %rdx
movq 0xe0(%r15), %rsi
movl %ecx, (%rsi,%rdx,8)
movl %eax, 0x4(%rsi,%rdx,8)
movslq -0x7c(%rbp), %rcx
movl -0x80(%rbp), %eax
movl -0x78(%rbp), %edx
shlq $0x20, %rax
orq %rdx, %rax
leaq (%rcx,%rcx,2), %rcx
movq -0x68(%rbp), %rdx
leaq (%rdx,%rcx,8), %rdi
movq %rax, -0x50(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x95e1
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x95e9
movq %rbx, %rdx
callq 0x8676
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl -0x78(%rbp), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq -0x68(%rbp), %rcx
callq 0x9fba
movq -0x50(%rbp), %r14
movq -0x48(%rbp), %rbx
cmpq %rbx, %r14
je 0x9643
movslq (%r14), %rax
movq 0xf8(%r15), %rcx
movl -0x80(%rbp), %edx
addl %edx, (%rcx,%rax,4)
movq %r13, %rdi
movq %r14, %rsi
callq 0xaab6
movq %r13, %rdi
movq %rax, %rsi
callq 0xab32
addq $0x4, %r14
jmp 0x9612
movq -0xe0(%rbp), %r14
leaq -0xf0(%rbp), %rbx
cmpq %rbx, %r14
leaq -0xf8(%rbp), %r15
je 0x969b
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
leaq 0x28(%r14), %rdx
callq 0xa920
cmpq -0x48(%rbp), %rax
je 0x968b
leaq 0x20(%r14), %rsi
movq %r15, %rdi
callq 0xabec
movq %r15, %rdi
movq %rax, %rsi
callq 0xacbe
movq %r14, %rdi
callq 0x21e0
movq %rax, %r14
cmpq %rbx, %rax
jne 0x965d
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq %rax, %r13
je 0x9840
movq -0x140(%rbp), %r15
cmpq %r12, %r15
je 0x9832
movq -0x148(%rbp), %rcx
movq %r12, %rax
testq %rcx, %rcx
je 0x96ed
movl (%r13), %edx
movq %r12, %rax
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x96d6
movq %r12, %rcx
cmpq %r12, %rax
je 0x9703
movl (%r13), %ecx
cmpl 0x20(%rax), %ecx
cmovlq %r12, %rax
movq %rax, %rcx
cmpq %r12, %rcx
jne 0x9722
leaq 0x20(%r15), %r14
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0xa920
cmpq -0x48(%rbp), %rax
je 0x9737
movq %r15, %rdi
callq 0x21e0
movq %rax, %r15
cmpq %r12, %rax
jne 0x96c0
jmp 0x9832
movl (%r13), %eax
movl (%r14), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq -0x90(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xa7e4
testq %rax, %rax
je 0x9722
movslq (%r13), %rax
movq -0x88(%rbp), %r12
movq 0xf8(%r12), %rcx
movl (%rcx,%rax,4), %ebx
movl (%r13), %eax
movl (%r14), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq -0x90(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x7f1c
addl (%rax), %ebx
movslq (%r14), %rax
movq 0xf8(%r12), %rcx
subl (%rcx,%rax,4), %ebx
leaq -0x190(%rbp), %rdi
movq %r14, %rsi
callq 0x38fc
leaq -0x150(%rbp), %r12
cmpl (%rax), %ebx
jge 0x9722
leaq -0x190(%rbp), %rdi
movq %r14, %rsi
callq 0x38fc
movl %ebx, (%rax)
movl (%r13), %eax
movl (%r14), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movl %ebx, -0x60(%rbp)
movq %rcx, -0x5c(%rbp)
movq -0x60(%rbp), %rax
movl -0x58(%rbp), %ecx
movq %rax, -0x128(%rbp)
movl %ecx, -0x120(%rbp)
leaq -0xf8(%rbp), %rbx
movq %rbx, %rdi
leaq -0x128(%rbp), %r14
movq %r14, %rsi
callq 0xa824
movq %rbx, -0x60(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rcx
leaq -0x60(%rbp), %r8
callq 0xa87c
jmp 0x9722
addq $0x4, %r13
cmpq -0x70(%rbp), %r13
jne 0x96b0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
leaq -0x158(%rbp), %r13
je 0x9855
callq 0x2170
cmpq $0x0, -0xd0(%rbp)
movq -0x88(%rbp), %r15
leaq -0x50(%rbp), %rbx
jne 0x9564
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x987f
callq 0x2170
movq -0xc0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x98b7
movq -0xb8(%rbp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
movq -0x68(%rbp), %rax
movq -0x18(%rax,%rbx), %rdi
testq %rdi, %rdi
je 0x98b1
callq 0x2170
addq $-0x18, %rbx
jne 0x989e
movq -0x100(%rbp), %rsp
leaq -0xf8(%rbp), %rdi
callq 0xa146
leaq -0x190(%rbp), %rdi
callq 0x4dc2
leaq -0x158(%rbp), %rdi
callq 0x5c1c
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9928
movq %rax, %r14
jmp 0x9987
movq %rax, %r14
jmp 0x9993
movq %rax, %r14
jmp 0x994f
jmp 0x9928
jmp 0x992d
jmp 0x9928
jmp 0x9928
jmp 0x9928
jmp 0x9928
jmp 0x9928
jmp 0x9928
jmp 0x992d
jmp 0x992d
jmp 0x9928
jmp 0x992d
jmp 0x992d
jmp 0x992d
jmp 0x992d
jmp 0x992d
movq %rax, %r14
jmp 0x993e
movq %rax, %r14
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x993e
callq 0x2170
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x994f
callq 0x2170
movq -0xc0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x9987
movq -0xb8(%rbp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
movq -0x68(%rbp), %rax
movq -0x18(%rax,%rbx), %rdi
testq %rdi, %rdi
je 0x9981
callq 0x2170
addq $-0x18, %rbx
jne 0x996e
leaq -0xf8(%rbp), %rdi
callq 0xa146
leaq -0x190(%rbp), %rdi
callq 0x4dc2
leaq -0x158(%rbp), %rdi
callq 0x5c1c
movq %r14, %rdi
callq 0x2280
nop