// File: yogesh1q2w[P]Dynamic-Graph-Algorithms/SPT.cpp
// Function: SPT::change_weight(int, int, int)
bool SPT::change_weight(int u,int v, int newwt) {
    if(!vertices.count(u) || !vertices.count(v) || weight.find(make_pair(u,v)) == weight.end()) {
        return false;
    }
    
    int oldwt = weight[make_pair(u,v)];
    weight[make_pair(u,v)] = newwt;
    
    if(newwt > oldwt && spt[v].first == u) {
        int diff = newwt - oldwt;
        modify_inc(u,v,oldwt,diff);
        return true;
    }

    else if(newwt < oldwt && dist[u] + newwt < dist[v]) {
        int diff = dist[u] + newwt - dist[v];
        modify_dec(u,v,oldwt,diff);
        return true;
    }
    return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x60(%rbp)
addq $0x40, %rdi
leaq -0x14(%rbp), %rsi
callq 0xad30
movq %rax, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x55(%rbp)
je 0x1dd49
movq -0x60(%rbp), %rdi
addq $0x40, %rdi
leaq -0x18(%rbp), %rsi
callq 0xad30
movq %rax, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x55(%rbp)
je 0x1dd49
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3520
movq -0x68(%rbp), %rdi
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x20220
movq -0x60(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x8, %rdi
callq 0x20250
movq %rax, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x201f0
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x1dd52
jmp 0x1dd5b
movb $0x0, -0x1(%rbp)
jmp 0x1debc
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3520
movq -0x80(%rbp), %rdi
movq %rax, -0x44(%rbp)
leaq -0x44(%rbp), %rsi
callq 0x14aa0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x3c(%rbp)
movl -0x1c(%rbp), %ecx
movl %ecx, -0x6c(%rbp)
addq $0x8, %rax
movq %rax, -0x78(%rbp)
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3520
movq -0x78(%rbp), %rdi
movq %rax, -0x4c(%rbp)
leaq -0x4c(%rbp), %rsi
callq 0x14aa0
movl -0x6c(%rbp), %ecx
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jle 0x1de0d
movq -0x60(%rbp), %rdi
addq $0xe0, %rdi
movslq -0x18(%rbp), %rsi
callq 0x20150
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x1de0d
movq -0x60(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x3c(%rbp), %ecx
movl -0x50(%rbp), %r8d
callq 0x1ded0
movb $0x1, -0x1(%rbp)
jmp 0x1debc
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x1deb6
movq -0x60(%rbp), %rdi
addq $0xf8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x15120
movq -0x60(%rbp), %rdi
movl (%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x84(%rbp)
addq $0xf8, %rdi
movslq -0x18(%rbp), %rsi
callq 0x15120
movq %rax, %rcx
movl -0x84(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1deb6
movq -0x60(%rbp), %rdi
addq $0xf8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x15120
movq -0x60(%rbp), %rdi
movl (%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x88(%rbp)
addq $0xf8, %rdi
movslq -0x18(%rbp), %rsi
callq 0x15120
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl -0x88(%rbp), %eax
subl (%rcx), %eax
movl %eax, -0x54(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x3c(%rbp), %ecx
movl -0x54(%rbp), %r8d
callq 0x1f0c0
movb $0x1, -0x1(%rbp)
jmp 0x1debc
jmp 0x1deb8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)