// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/treewidth.cpp
// Function: TreeWidth::SolveAtom::solveAtom0(Graph&, int, int, int)
pair<int, vector<pair<int, int> > > solveAtom0(Graph& G, int lowerBound, int okWidth, int upperBound) {
	assert(lowerBound >= 0);
	if (lowerBound > upperBound) return {-1, FAILSOLUTION};
	if ((int64_t)G.n*(int64_t)(G.n-1) == (int64_t)G.m*2) {
		if (G.n-1 <= upperBound) {
			return {G.n-1, {}};
		}
		else {
			return {-1, FAILSOLUTION};
		}
	}
	if (G.hasCycle()) {
		lowerBound = max(lowerBound, 2);
	}
	else {
		upperBound = min(upperBound, 1);
	}
	if (lowerBound > upperBound) return {-1, FAILSOLUTION};
	okWidth = max(okWidth, lowerBound);

	if (G.n == 3) {
		if (G.m == 3) {
			return {2, {}};
		}
		else {
			return {1, {}};
		}
	}
	bool hasd2 = false;
	for (int i = 0; i < G.n; i++) {
		assert(G.g[i].size() > 1);
		if (G.g[i].size() == 2) {
			hasd2 = true;
			break;
		}
	}
	if (hasd2) {
		auto sol0 = greedyDegree2(G);
		auto sol = SolveGraph::solveGraph(G, lowerBound, okWidth, upperBound);
		if (sol.S == FAILSOLUTION) return sol;
		sol.S.insert(sol.S.end(), sol0.begin(), sol0.end());
		assert(sol.F <= upperBound);
		return sol;
	}
	auto nbC = nbClique(G);
	if (nbC.F != -1) {
		auto sol0 = nbC;
		G.addEdge(sol0.F, sol0.S);
		auto sol = SolveGraph::solveGraph(G, lowerBound, okWidth, upperBound);
		if (sol.S == FAILSOLUTION) return sol;
		sol.S.push_back(sol0);
		assert(sol.F <= upperBound);
		return sol;
	}
	auto ret = solveAtom1(G, lowerBound, okWidth, upperBound);
	if (ret.S != FAILSOLUTION) assert(ret.F <= upperBound);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testl %edx, %edx
js 0x1ef7f
movl %r8d, %r13d
movl %edx, %ebp
movq %rdi, %rbx
cmpl %r8d, %edx
jle 0x1ed00
orl $-0x1, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0xc159d7(%rip), %rsi    # 0xc346d0
callq 0x35f2
jmp 0x1ed47
movl %ecx, %r14d
movq %rsi, %r15
movslq 0x50(%rsi), %rcx
leaq -0x1(%rcx), %rax
imulq %rax, %rcx
movslq 0x54(%rsi), %rdx
addq %rdx, %rdx
cmpq %rdx, %rcx
jne 0x1ed59
cmpl %r13d, %eax
jg 0x1ece8
xorps %xmm0, %xmm0
movq %rsp, %rsi
andq $0x0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x35f2
movq %rsp, %rdi
callq 0x3bfe
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x84e0
cmpl $0x3, %ebp
pushq $0x2
popq %r12
cmovael %ebp, %r12d
xorl %r8d, %r8d
testl %r13d, %r13d
setne %r8b
testb %al, %al
cmovnel %r13d, %r8d
cmovel %ebp, %r12d
cmpl %r8d, %r12d
ja 0x1ece8
cmpl %r14d, %r12d
cmovgl %r12d, %r14d
movl 0x50(%r15), %ecx
cmpl $0x3, %ecx
jne 0x1edc6
leaq 0x8(%rbx), %rdi
cmpl $0x3, 0x54(%r15)
jne 0x1ef0c
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movl $0x2, (%rbx)
callq 0x35f2
jmp 0x1ed3f
movq 0x38(%r15), %rax
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
imulq $0x18, %rcx, %rcx
addq $0x18, %rcx
leaq 0x18(%rdx), %rsi
cmpq %rsi, %rcx
je 0x1ee7f
movq 0x8(%rax,%rdx), %rdi
subq (%rax,%rdx), %rdi
cmpq $0x4, %rdi
jbe 0x1ef9c
movq %rsi, %rdx
cmpq $0x8, %rdi
jne 0x1edd9
movq %rsp, %rdi
movq %r15, %rsi
movl %r8d, %ebp
callq 0x1ea56
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl %ebp, %r15d
movl %ebp, %r8d
callq 0x1efed
leaq 0x8(%rbx), %r14
leaq 0xc1589e(%rip), %rsi    # 0xc346d0
movq %r14, %rdi
callq 0x35c8
testb %al, %al
jne 0x1ed3f
movq 0x10(%rbx), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %r14, %rdi
callq 0x52ae
cmpl %r15d, (%rbx)
jle 0x1ed3f
leaq 0x15a4(%rip), %rdi      # 0x2040b
leaq 0x34e2(%rip), %rsi      # 0x22350
leaq 0x35c5(%rip), %rcx      # 0x2243a
movl $0x8b, %edx
callq 0x2150
movl %r8d, %ebp
movq %r15, %rdi
callq 0x1eb95
cmpl $-0x1, %eax
je 0x1ef2a
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, (%rsp)
movl %edx, 0x4(%rsp)
movq %r15, %rdi
movl %eax, %esi
callq 0x7a8e
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x1efed
leaq 0x8(%rbx), %r14
leaq 0xc15806(%rip), %rsi    # 0xc346d0
movq %r14, %rdi
callq 0x35c8
testb %al, %al
jne 0x1ed47
movq %rsp, %rsi
movq %r14, %rdi
callq 0x141b4
cmpl %ebp, (%rbx)
jle 0x1ed47
leaq 0x1517(%rip), %rdi      # 0x2040b
leaq 0x3455(%rip), %rsi      # 0x22350
leaq 0x3538(%rip), %rcx      # 0x2243a
movl $0x95, %edx
callq 0x2150
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movl $0x1, (%rbx)
callq 0x35f2
jmp 0x1ed3f
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x1e744
leaq 0x8(%rbx), %r14
leaq 0xc15787(%rip), %rsi    # 0xc346d0
movq %r14, %rdi
callq 0x6420
cmpl %ebp, (%rbx)
setg %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x1ed47
leaq 0x352e(%rip), %rdi      # 0x22495
leaq 0x33e2(%rip), %rsi      # 0x22350
leaq 0x34c5(%rip), %rcx      # 0x2243a
movl $0x99, %edx
callq 0x2150
leaq 0x13c8(%rip), %rdi      # 0x2034e
leaq 0x33c3(%rip), %rsi      # 0x22350
leaq 0x34a6(%rip), %rcx      # 0x2243a
pushq $0x63
popq %rdx
callq 0x2150
leaq 0x24e0(%rip), %rdi      # 0x21483
leaq 0x33a6(%rip), %rsi      # 0x22350
leaq 0x3489(%rip), %rcx      # 0x2243a
movl $0x80, %edx
callq 0x2150
jmp 0x1efbf
jmp 0x1efc7
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1efe0
movq %rax, %rbx
movq %r14, %rdi
callq 0x3bfe
jmp 0x1efdd
jmp 0x1efda
jmp 0x1efda
jmp 0x1efda
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3bfe
movq %rbx, %rdi
callq 0x2340