// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/minfill.cpp
// Function: MinFill::SolveAtom::solveAtom0(Graph&, int, int, int)
vector<pair<int, int> > solveAtom0(Graph& G, int lowerBound, int upperBound, int depth) {
	assert(lowerBound >= 0);
	if (lowerBound > upperBound) return FAILSOLUTION;
	if (G.n <= 3) return {};
	if ((int64_t)G.n*(int64_t)(G.n-1) == (int64_t)G.m*2) return {};
	if (upperBound <= 0) {
		auto cycle = MCS::getChordlessCycle(G);
		if (cycle.size() == 0) return {};
		else return FAILSOLUTION;
	}
	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, max(0, lowerBound - (int)sol0.size()), upperBound - (int)sol0.size(), depth);
		if (sol == FAILSOLUTION) return FAILSOLUTION;
		sol.insert(sol.end(), sol0.begin(), sol0.end());
		assert((int)sol.size() <= upperBound);
		return sol;
	}
	auto nbC = nbClique(G);
	if (nbC.S.F != -1) {
		auto sol0 = nbC.S;
		G.addEdge(sol0.F, sol0.S);
		auto sol = SolveGraph::solveGraph(G, max(0, lowerBound-1), upperBound-1, depth);
		if (sol == FAILSOLUTION) return FAILSOLUTION;
		sol.push_back(sol0);
		assert((int)sol.size() <= upperBound);
		return sol;
	}
	else {
		assert(nbC.F >= 2);
		lowerBound = max(lowerBound, nbC.F);
		if (lowerBound > upperBound) return FAILSOLUTION;
	}
	auto ret = solveAtom1(G, lowerBound, upperBound, depth);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testl %edx, %edx
js 0x13673
movl %ecx, %r14d
movl %edx, %r12d
movq %rdi, %rbx
cmpl %ecx, %edx
jle 0x133ba
leaq 0x4b0cb0(%rip), %rsi    # 0x4c4060
movq %rbx, %rdi
callq 0x35f2
jmp 0x133e5
movq %rsi, %r15
movslq 0x50(%rsi), %rcx
cmpq $0x3, %rcx
jle 0x133da
leal -0x1(%rcx), %eax
imulq %rcx, %rax
movslq 0x54(%r15), %rdx
addq %rdx, %rdx
cmpq %rdx, %rax
jne 0x133f7
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
je 0x134a2
movl %r8d, %ebp
movq 0x38(%r15), %rax
imulq $0x18, %rcx, %rcx
addq $0x18, %rcx
xorl %edx, %edx
leaq 0x18(%rdx), %rsi
cmpq %rsi, %rcx
je 0x134d3
movq 0x8(%rax,%rdx), %rdi
subq (%rax,%rdx), %rdi
cmpq $0x4, %rdi
jbe 0x13654
movq %rsi, %rdx
cmpq $0x8, %rdi
jne 0x13411
movq %rsp, %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x12e54
movq 0x8(%r13), %rax
subq (%r13), %rax
shrq $0x3, %rax
subl %eax, %r12d
xorl %edx, %edx
testl %r12d, %r12d
cmovgl %r12d, %edx
movl %r14d, %ecx
subl %eax, %ecx
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %r8d
callq 0x110b7
leaq 0x4b0be4(%rip), %rsi    # 0x4c4060
leaq 0x20(%rsp), %rdi
callq 0x35c8
testb %al, %al
je 0x1358b
leaq 0x4b0bcb(%rip), %rsi    # 0x4c4060
movq %rbx, %rdi
callq 0x35f2
jmp 0x135dd
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x103e6
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x135e9
leaq 0x4b0b9a(%rip), %rsi    # 0x4c4060
movq %rbx, %rdi
callq 0x35f2
jmp 0x135f4
movq %r15, %rdi
callq 0x131e3
movq %rax, 0x20(%rsp)
movl %edx, 0x28(%rsp)
movabsq $-0x100000001, %rcx     # imm = 0xFFFFFFFEFFFFFFFF
cmpq %rcx, %rax
jbe 0x13525
cmpl $0x1, %eax
jle 0x13692
cmpl %r12d, %eax
cmovgl %eax, %r12d
cmpl %r14d, %r12d
jg 0x133a9
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x1186a
jmp 0x133e5
movq 0x24(%rsp), %rsi
movq %rsi, 0x40(%rsp)
movq %rsi, %rdx
shrq $0x20, %rdx
movq %r15, %rdi
callq 0x7a8e
cmpl $0x2, %r12d
pushq $0x1
popq %rdx
cmovgel %r12d, %edx
decl %edx
leal -0x1(%r14), %ecx
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %r8d
callq 0x110b7
leaq 0x4b0af9(%rip), %rsi    # 0x4c4060
movq %r12, %rdi
callq 0x35c8
testb %al, %al
je 0x13601
leaq 0x4b0ae2(%rip), %rsi    # 0x4c4060
movq %rbx, %rdi
callq 0x35f2
jmp 0x13647
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0x52ae
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rax, %rdx
subq %rcx, %rdx
shrq $0x3, %rdx
cmpl %r14d, %edx
jg 0x136b1
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x3bfe
jmp 0x13647
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq %rsp, %rdi
callq 0x38e4
jmp 0x133e5
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x141b4
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rax, %rdx
subq %rcx, %rdx
shrq $0x3, %rdx
cmpl %r14d, %edx
jg 0x136d0
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq %rsp, %rdi
callq 0x3bfe
jmp 0x133e5
leaq 0xde28(%rip), %rdi      # 0x21483
leaq 0xdab6(%rip), %rsi      # 0x21118
leaq 0xdf07(%rip), %rcx      # 0x21570
movl $0x20c, %edx            # imm = 0x20C
callq 0x2150
leaq 0xccd4(%rip), %rdi      # 0x2034e
leaq 0xda97(%rip), %rsi      # 0x21118
leaq 0xdee8(%rip), %rcx      # 0x21570
movl $0x201, %edx            # imm = 0x201
callq 0x2150
leaq 0xdf43(%rip), %rdi      # 0x215dc
leaq 0xda78(%rip), %rsi      # 0x21118
leaq 0xdec9(%rip), %rcx      # 0x21570
movl $0x225, %edx            # imm = 0x225
callq 0x2150
leaq 0xdf06(%rip), %rdi      # 0x215be
leaq 0xda59(%rip), %rsi      # 0x21118
leaq 0xdeaa(%rip), %rcx      # 0x21570
movl $0x217, %edx            # imm = 0x217
callq 0x2150
leaq 0xdee7(%rip), %rdi      # 0x215be
leaq 0xda3a(%rip), %rsi      # 0x21118
leaq 0xde8b(%rip), %rcx      # 0x21570
movl $0x221, %edx            # imm = 0x221
callq 0x2150
jmp 0x13705
movq %rax, %rbx
movq %rsp, %rdi
callq 0x38e4
jmp 0x1371a
jmp 0x13700
movq %rax, %rbx
jmp 0x13712
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3bfe
movq %rsp, %rdi
callq 0x3bfe
movq %rbx, %rdi
callq 0x2340