// File: /workspace/github_cpp_makefile_star2_O2/yogesh1q2w[P]Dynamic-Graph-Algorithms/connectivity.cpp
// Function: connectivity::delete_edge(int, int)
bool connectivity::delete_edge(int u, int v) {
	if(!vertices.count(u) || !vertices.count(v))
		return false;		//if u or v are absent in graph
	int lvl = level(u, v);
	if(lvl == -1)
		return false;
	if(!spf[0].cut(u, v)) {		//if not a tree edge
		remove_edge_level(u, v, lvl, false);
		return true;
	}
	//in case of tree edge, find a replacement edge in the tree
	remove_edge_level(u, v, lvl, true);

	for(int i = lvl; i >= 0; i--) {
		if(spf[i].size(u) > spf[i].size(v))
			swap(u, v);
		while(1) {
			int x = spf[i].get_adjacent(u, true);
			if(x == -1)
				break;
			while(!treeadj[i][x].empty()) {
				int y = *treeadj[i][x].begin();
				remove_edge_level(x, y, i, true);
				add_edge_level(x, y, i + 1, true);
				spf[i + 1].link(x, y);
			}
		}

		bool ff = false;

		while(!ff) {
			int x = spf[i].get_adjacent(u, false);
			if(x == -1) 
				break;
			while(!adj[i][x].empty()) {
				int y = *adj[i][x].begin();
				if(spf[i].is_connected(y, v)) {
					for(int j = 0; j <= i; j++)
						spf[j].link(x, y);
					ff = true;
					remove_edge_level(x, y, i, false);
					add_edge_level(x, y, i, true);
					break;
				}
				else {
					remove_edge_level(x, y, i, false);
					add_edge_level(x, y, i + 1, false);
				}
			}
		}
		if(ff)
			break;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq -0x34(%rbp), %rax
movl %esi, (%rax)
movl %edx, -0x30(%rbp)
movq %rax, %rsi
callq 0x4ba8
testq %rax, %rax
je 0x4a54
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x4ba8
testq %rax, %rax
je 0x4a54
movl -0x34(%rbp), %esi
movl -0x30(%rbp), %edx
movq %rbx, %rdi
callq 0x46f8
cmpl $-0x1, %eax
je 0x4a54
movl %eax, %r14d
movq 0x30(%rbx), %rdi
movl -0x34(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x2b82
movl -0x34(%rbp), %esi
movl -0x30(%rbp), %edx
testb %al, %al
je 0x4a58
pushq $0x1
popq %r8
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x456c
movslq %r14d, %r13
leaq -0x2c(%rbp), %r15
movb $0x1, %al
testq %r13, %r13
js 0x4a68
imulq $0x118, %r13, %r12      # imm = 0x118
movq 0x30(%rbx), %rdi
addq %r12, %rdi
movl -0x34(%rbp), %esi
callq 0x2c82
movl %eax, %r14d
movq 0x30(%rbx), %rdi
movq %r12, -0x48(%rbp)
addq %r12, %rdi
movl -0x30(%rbp), %esi
callq 0x2c82
cmpl %eax, %r14d
jle 0x489c
movl -0x34(%rbp), %eax
movl -0x30(%rbp), %ecx
movl %ecx, -0x34(%rbp)
movl %eax, -0x30(%rbp)
leaq 0x1(%r13), %rax
movq %r13, -0x40(%rbp)
imulq $0x38, %r13, %r13
movq %rax, -0x58(%rbp)
imulq $0x118, %rax, %r14      # imm = 0x118
movq 0x30(%rbx), %rdi
addq -0x48(%rbp), %rdi
movl -0x34(%rbp), %esi
pushq $0x1
popq %rdx
callq 0x2cb4
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x4941
movq 0x60(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x5d5c
cmpq $0x0, 0x18(%rax)
je 0x48b3
movq 0x60(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x5d5c
movq 0x10(%rax), %rax
movl 0x8(%rax), %r12d
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movq -0x40(%rbp), %rcx
pushq $0x1
popq %r15
movl %r15d, %r8d
callq 0x456c
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movq -0x58(%rbp), %rcx
movl %r15d, %r8d
leaq -0x2c(%rbp), %r15
callq 0x446e
movq 0x30(%rbx), %rdi
addq %r14, %rdi
movl -0x2c(%rbp), %esi
movl %r12d, %edx
callq 0x2a08
jmp 0x48ce
xorl %eax, %eax
movq -0x48(%rbp), %r14
testb $0x1, %al
jne 0x4a66
movl %eax, -0x4c(%rbp)
movq 0x30(%rbx), %rdi
addq %r14, %rdi
movl -0x34(%rbp), %esi
xorl %edx, %edx
callq 0x2cb4
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x4a48
movq 0x48(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x5d5c
cmpq $0x0, 0x18(%rax)
je 0x49de
movq 0x48(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x5d5c
movq 0x10(%rax), %rax
movl 0x8(%rax), %r12d
movq 0x30(%rbx), %rdi
addq %r14, %rdi
movl -0x30(%rbp), %edx
movl %r12d, %esi
callq 0x2b0a
testb %al, %al
jne 0x49e6
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movq -0x40(%rbp), %rcx
xorl %r8d, %r8d
callq 0x456c
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movq -0x58(%rbp), %rcx
xorl %r8d, %r8d
callq 0x446e
jmp 0x496f
movl -0x4c(%rbp), %eax
jmp 0x4947
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq -0x40(%rbp), %r15
jg 0x4a10
movq 0x30(%rbx), %rdi
addq %r14, %rdi
movl -0x2c(%rbp), %esi
movl %r12d, %edx
callq 0x2a08
incq %r15
addq $0x118, %r14            # imm = 0x118
jmp 0x49ec
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movq -0x40(%rbp), %r14
movl %r14d, %ecx
xorl %r8d, %r8d
callq 0x456c
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
movl %r12d, %edx
movl %r14d, %ecx
pushq $0x1
popq %r8
callq 0x446e
movb $0x1, %al
leaq -0x2c(%rbp), %r15
jmp 0x4943
movq -0x40(%rbp), %r13
decq %r13
jmp 0x4854
xorl %eax, %eax
jmp 0x4a68
movq %rbx, %rdi
movl %r14d, %ecx
xorl %r8d, %r8d
callq 0x456c
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop