// File: /workspace/github_cpp_makefile_star2_O3/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, -0x88(%rbp)
movl %esi, -0x84(%rbp)
movq %rdi, %r15
leaq -0x2c(%rbp), %rsi
movl %edx, (%rsi)
leaq -0x188(%rbp), %rbx
movl $0x0, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %rax, 0x20(%rbx)
leaq -0x130(%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 -0x190(%rbp), %rdi
callq 0x4e12
leaq -0x160(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x38b8
movl -0x88(%rbp), %esi
movl %esi, (%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
movq %rax, %rcx
shlq $0x20, %rcx
movl -0x84(%rbp), %edx
orq %rcx, %rdx
movl %esi, -0xb0(%rbp)
movq %rdx, -0xac(%rbp)
movq -0xb0(%rbp), %rcx
leaq -0x60(%rbp), %rsi
movq %rcx, (%rsi)
movl %eax, 0x8(%rsi)
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
callq 0xa3b2
leaq -0xb0(%rbp), %r8
movq %r14, (%r8)
leaq -0x60(%rbp), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq 0xa40c
movq %rsp, -0x100(%rbp)
movq 0xe0(%r15), %rdx
movq 0xe8(%r15), %rsi
movq %rsi, %rax
subq %rdx, %rax
sarq $0x3, %rax
movq %rsp, %r14
movq %rax, -0xb8(%rbp)
leaq (%rax,%rax,2), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
subq %rcx, %r14
movq %r14, %rsp
movq %rdx, -0xc8(%rbp)
movq %rsi, -0xc0(%rbp)
cmpq %rdx, %rsi
je 0x8e3d
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 %r14, %rdi
xorl %esi, %esi
callq 0x20d0
movq %r14, -0x68(%rbp)
movq 0xe0(%r15), %rax
movq %r15, -0x40(%rbp)
movq 0xe8(%r15), %rcx
cmpq %rax, %rcx
je 0x8ecb
xorl %r15d, %r15d
leaq -0xb0(%rbp), %r14
movslq (%rax,%r15,8), %rdx
cmpq $-0x1, %rdx
je 0x8eb9
movl 0x4(%rax,%r15,8), %eax
shlq $0x20, %rax
addq %r15, %rax
leaq (%rdx,%rdx,2), %rcx
movq -0x68(%rbp), %rdx
leaq (%rdx,%rcx,8), %rdi
movq %rax, -0xb0(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x8e9f
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x8ea7
movq %r14, %rdx
callq 0x8236
movq -0x40(%rbp), %rcx
movq 0xe0(%rcx), %rax
movq 0xe8(%rcx), %rcx
incq %r15
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
ja 0x8e62
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movl -0x2c(%rbp), %esi
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rcx
callq 0x9b7e
movq -0xb0(%rbp), %r15
movq -0xa8(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq %rax, %r15
je 0x90dc
movq -0x40(%rbp), %rax
leaq 0xa8(%rax), %rcx
movq %rcx, -0x108(%rbp)
addq $0x8, %rax
movq %rax, -0x118(%rbp)
leaq -0x38(%rbp), %r12
movl -0x2c(%rbp), %eax
movq %rax, -0x48(%rbp)
movq -0x108(%rbp), %rdi
movq %r15, %rsi
callq 0x9d62
movq (%rax), %r14
movq 0x8(%rax), %rax
movl -0x84(%rbp), %ecx
movl %ecx, -0x90(%rbp)
movl -0x88(%rbp), %r13d
movq %rax, -0x70(%rbp)
cmpq %rax, %r14
je 0x9000
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq %r14, %rdx
callq 0xa4b0
cmpq -0xa8(%rbp), %rax
jne 0x8ff2
movl %r13d, -0x48(%rbp)
movl (%r14), %eax
movslq %eax, %rcx
movq -0x40(%rbp), %r13
movq 0xf8(%r13), %rdx
movl (%rdx,%rcx,4), %r12d
movl (%r15), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq -0x118(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x7ac2
addl (%rax), %r12d
movslq (%r15), %rax
movq 0xf8(%r13), %rcx
subl (%rcx,%rax,4), %r12d
movl -0x48(%rbp), %r13d
cmpl %r12d, %r13d
cmovgel %r12d, %r13d
movl (%r15), %eax
movl %eax, -0x90(%rbp)
movl (%r14), %eax
movq %rax, -0x48(%rbp)
leaq -0x38(%rbp), %r12
addq $0x4, %r14
cmpq -0x70(%rbp), %r14
jne 0x8f6c
leaq -0x160(%rbp), %rdi
movq %r15, %rsi
callq 0x38b8
cmpl (%rax), %r13d
jge 0x9075
movl %r13d, -0x60(%rbp)
movq -0x48(%rbp), %rdx
movq %rdx, %rax
shlq $0x20, %rax
movl -0x90(%rbp), %ecx
orq %rax, %rcx
movq %rcx, -0x5c(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movl %edx, -0x30(%rbp)
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0xa3b2
movq %r14, -0x60(%rbp)
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rcx
leaq -0x60(%rbp), %r8
callq 0xa40c
leaq -0x160(%rbp), %rdi
movq %r15, %rsi
callq 0x38b8
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), %r12
cmpq %r12, %r14
je 0x90c7
leaq -0x190(%rbp), %rdi
movq %r14, %rsi
callq 0x4e12
leaq -0x160(%rbp), %rdi
movq %r15, %rsi
callq 0x38b8
movl (%rax), %r13d
leaq -0x160(%rbp), %rdi
movq %r14, %rsi
callq 0x38b8
movl %r13d, (%rax)
addq $0x8, %r14
jmp 0x9089
addq $0x4, %r15
cmpq -0x110(%rbp), %r15
leaq -0x38(%rbp), %r12
jne 0x8f2f
cmpq $0x0, -0xd0(%rbp)
movq -0x40(%rbp), %r14
leaq -0xf8(%rbp), %r15
je 0x9415
leaq 0x8(%r14), %rax
movq %rax, -0x48(%rbp)
movq -0xe0(%rbp), %rsi
movq 0x20(%rsi), %rax
movq %rax, -0x80(%rbp)
movl 0x28(%rsi), %eax
movl %eax, -0x78(%rbp)
movq %r15, %rdi
callq 0xa55e
movq -0x48(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xa5a0
leaq -0x60(%rbp), %r15
movslq -0x7c(%rbp), %rcx
movl (%rax), %eax
movslq -0x78(%rbp), %rdx
movq 0xe0(%r14), %rsi
movl %ecx, (%rsi,%rdx,8)
movl %eax, 0x4(%rsi,%rdx,8)
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, -0x60(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x9174
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x917c
movq %r15, %rdx
callq 0x8236
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movl -0x78(%rbp), %esi
movq %r14, %rdi
movq %r15, %rdx
movq -0x68(%rbp), %rcx
callq 0x9b7e
movq -0x60(%rbp), %r14
movq -0x58(%rbp), %r15
cmpq %r15, %r14
je 0x91e1
movslq (%r14), %rax
movq -0x40(%rbp), %rcx
movq 0xf8(%rcx), %rcx
movl -0x80(%rbp), %edx
addl %edx, (%rcx,%rax,4)
leaq -0x190(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xa648
movq %r12, %rdi
movq %rax, %rsi
callq 0xa6ca
addq $0x4, %r14
jmp 0x91a5
movq -0xe0(%rbp), %r14
leaq -0xf0(%rbp), %rax
cmpq %rax, %r14
leaq -0xf8(%rbp), %r15
je 0x9240
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq 0x28(%r14), %rdx
callq 0xa4b0
cmpq -0x58(%rbp), %rax
je 0x9229
leaq 0x20(%r14), %rsi
movq %r15, %rdi
callq 0xa784
movq %r15, %rdi
movq %rax, %rsi
callq 0xa842
movq %r14, %rdi
callq 0x21e0
movq %rax, %r14
leaq -0xf0(%rbp), %rax
cmpq %rax, %r14
jne 0x91fb
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq %rax, %rdi
je 0x93f9
movq %rdi, -0x70(%rbp)
movq -0x178(%rbp), %r14
cmpq %rbx, %r14
je 0x93e0
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0x92b3
movq -0x70(%rbp), %rax
movl (%rax), %eax
movq %rbx, %r8
movq %r8, %rcx
movq %rdi, %rdx
movl 0x20(%rdi), %esi
xorl %edi, %edi
cmpl %eax, %esi
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x9281
cmpq %rbx, %r8
je 0x92b3
cmpl %eax, %esi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jge 0x92cd
leaq 0x20(%r14), %r12
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %r12, %rdx
callq 0xa4b0
cmpq -0x58(%rbp), %rax
je 0x92e2
movq %r14, %rdi
callq 0x21e0
movq %rax, %r14
cmpq %rbx, %rax
jne 0x926c
jmp 0x93e0
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl (%r12), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa372
testq %rax, %rax
je 0x92cd
movq %rbx, %r15
movq -0x70(%rbp), %rax
movl (%rax), %eax
movslq %eax, %rcx
movq -0x40(%rbp), %rbx
movq 0xf8(%rbx), %rdx
movl (%rdx,%rcx,4), %r13d
movl (%r12), %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x7ac2
addl (%rax), %r13d
movslq (%r12), %rax
movq 0xf8(%rbx), %rcx
subl (%rcx,%rax,4), %r13d
leaq -0x160(%rbp), %rdi
movq %r12, %rsi
callq 0x38b8
movq %r15, %rbx
leaq -0xf8(%rbp), %r15
cmpl (%rax), %r13d
jge 0x92cd
leaq -0x160(%rbp), %rdi
movq %r12, %rsi
callq 0x38b8
movl %r13d, (%rax)
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl (%r12), %ecx
movq %rcx, %rdx
shlq $0x20, %rdx
orq %rax, %rdx
movl %r13d, -0x38(%rbp)
movq %rdx, -0x34(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x128(%rbp)
movl %ecx, -0x120(%rbp)
movq %r15, %rdi
leaq -0x128(%rbp), %r12
movq %r12, %rsi
callq 0xa3b2
movq %r15, -0x38(%rbp)
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rcx
leaq -0x38(%rbp), %r8
callq 0xa40c
jmp 0x92cd
movq -0x70(%rbp), %rdi
addq $0x4, %rdi
cmpq -0x90(%rbp), %rdi
jne 0x9258
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x9403
callq 0x2170
cmpq $0x0, -0xd0(%rbp)
movq -0x40(%rbp), %r14
jne 0x90fd
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x9426
callq 0x2170
movq -0xc0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x945e
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 0x9458
callq 0x2170
addq $-0x18, %rbx
jne 0x9445
movq -0x100(%rbp), %rsp
leaq -0xf8(%rbp), %rdi
callq 0x9d0a
leaq -0x160(%rbp), %rdi
callq 0x4b0e
leaq -0x190(%rbp), %rdi
callq 0x594a
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x94c7
movq %rax, %r14
jmp 0x952e
movq %rax, %r14
jmp 0x953a
movq %rax, %r14
jmp 0x94f6
jmp 0x94c7
jmp 0x94d4
jmp 0x94c7
jmp 0x94c7
jmp 0x94c7
jmp 0x94c7
jmp 0x94c7
jmp 0x94c7
jmp 0x94d4
jmp 0x94d4
jmp 0x94c7
jmp 0x94d4
movq %rax, %r14
jmp 0x94e5
jmp 0x94d4
jmp 0x94d4
jmp 0x94d4
jmp 0x94d4
movq %rax, %r14
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x94e5
callq 0x2170
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x94f6
callq 0x2170
movq -0xc0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x952e
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 0x9528
callq 0x2170
addq $-0x18, %rbx
jne 0x9515
leaq -0xf8(%rbp), %rdi
callq 0x9d0a
leaq -0x160(%rbp), %rdi
callq 0x4b0e
leaq -0x190(%rbp), %rdi
callq 0x594a
movq %r14, %rdi
callq 0x2280