// File: 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
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x118(%rbp)
movq %rdi, %rax
movq %rax, -0x110(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x34286
jmp 0x342a5
leaq 0x25095(%rip), %rdi     # 0x59322
leaq 0x25e54(%rip), %rsi     # 0x5a0e8
movl $0x201, %edx            # imm = 0x201
leaq 0x262a0(%rip), %rcx     # 0x5a540
callq 0x31a0
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x342c5
movq -0x118(%rbp), %rdi
leaq 0x4d9e75(%rip), %rsi    # 0x50e130
callq 0x56a0
jmp 0x348c5
movq -0x10(%rbp), %rax
cmpl $0x3, 0x50(%rax)
jg 0x342f3
movq -0x118(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3130
movq -0x118(%rbp), %rdi
callq 0xbd50
jmp 0x348c5
movq -0x10(%rbp), %rax
movslq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x50(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movq -0x10(%rbp), %rcx
movslq 0x54(%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jne 0x34340
movq -0x118(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3130
movq -0x118(%rbp), %rdi
callq 0xbd50
jmp 0x348c5
cmpl $0x0, -0x18(%rbp)
jg 0x343d6
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %edx, %edx
callq 0x2cb80
leaq -0x38(%rbp), %rdi
callq 0x59a0
cmpq $0x0, %rax
jne 0x34390
movq -0x118(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3130
movq -0x118(%rbp), %rdi
callq 0xbd50
movl $0x1, -0x3c(%rbp)
jmp 0x343c8
movq -0x118(%rbp), %rdi
leaq 0x4d9d92(%rip), %rsi    # 0x50e130
callq 0x56a0
jmp 0x343a5
movl $0x1, -0x3c(%rbp)
jmp 0x343c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6d30
jmp 0x348d5
leaq -0x38(%rbp), %rdi
callq 0x6d30
jmp 0x348c5
movb $0x0, -0x4d(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x3445f
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x54(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
callq 0x59a0
cmpq $0x1, %rax
jbe 0x3440e
jmp 0x3442d
leaq 0x2603e(%rip), %rdi     # 0x5a453
leaq 0x25ccc(%rip), %rsi     # 0x5a0e8
movl $0x20c, %edx            # imm = 0x20C
leaq 0x26118(%rip), %rcx     # 0x5a540
callq 0x31a0
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x54(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
callq 0x59a0
cmpq $0x2, %rax
jne 0x34452
movb $0x1, -0x4d(%rbp)
jmp 0x3445f
jmp 0x34454
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x343e1
testb $0x1, -0x4d(%rbp)
je 0x34695
movq -0x10(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x33930
movq -0x138(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x130(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x124(%rbp)
callq 0x5680
movq %rax, %rcx
movl -0x124(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x90(%rbp)
leaq -0x8c(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x23c80
movq %rax, -0x120(%rbp)
jmp 0x344d4
movq -0x120(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x13c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x140(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5680
movl -0x140(%rbp), %ecx
movq -0x130(%rbp), %rsi
movl -0x13c(%rbp), %edx
subl %eax, %ecx
movl -0x1c(%rbp), %r8d
leaq -0x88(%rbp), %rdi
callq 0x30370
jmp 0x3451c
leaq 0x4d9c0d(%rip), %rsi    # 0x50e130
leaq -0x88(%rbp), %rdi
callq 0x5600
movb %al, -0x141(%rbp)
jmp 0x34537
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0x34543
jmp 0x34592
movq -0x118(%rbp), %rdi
leaq 0x4d9bdf(%rip), %rsi    # 0x50e130
callq 0x56a0
jmp 0x34558
movl $0x1, -0x3c(%rbp)
jmp 0x3466d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x34687
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5470
jmp 0x34687
leaq -0x88(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0xc040
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xc070
leaq -0x70(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0xc0b0
movq -0x160(%rbp), %rdi
movq %rax, -0xa8(%rbp)
callq 0xc040
movq -0x158(%rbp), %rdi
movq %rax, -0xb0(%rbp)
movq -0x98(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
callq 0xbf90
movq %rax, -0x150(%rbp)
jmp 0x34613
movq -0x150(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5680
cmpl -0x18(%rbp), %eax
jg 0x34634
jmp 0x34653
leaq 0x25f53(%rip), %rdi     # 0x5a58e
leaq 0x25aa6(%rip), %rsi     # 0x5a0e8
movl $0x217, %edx            # imm = 0x217
leaq 0x25ef2(%rip), %rcx     # 0x5a540
callq 0x31a0
movq -0x118(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xf320
movl $0x1, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5470
leaq -0x70(%rbp), %rdi
callq 0x5470
jmp 0x348c5
leaq -0x70(%rbp), %rdi
callq 0x5470
jmp 0x348d5
movq -0x10(%rbp), %rdi
callq 0x33f80
movl %edx, -0xd0(%rbp)
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0xc4(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpl $-0x1, -0xc0(%rbp)
je 0x34821
movq -0xc0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
movl -0xe0(%rbp), %esi
movl -0xdc(%rbp), %edx
callq 0x15830
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
movl $0x0, -0xfc(%rbp)
movl -0x14(%rbp), %eax
decl %eax
movl %eax, -0x100(%rbp)
leaq -0xfc(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x23c80
movq -0x178(%rbp), %rsi
movl (%rax), %edx
movl -0x18(%rbp), %ecx
decl %ecx
movl -0x1c(%rbp), %r8d
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x30370
movq -0x170(%rbp), %rdi
leaq 0x4d99d5(%rip), %rsi    # 0x50e130
callq 0x5600
movb %al, -0x161(%rbp)
jmp 0x34768
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x34774
jmp 0x347af
movq -0x118(%rbp), %rdi
leaq 0x4d99ae(%rip), %rsi    # 0x50e130
callq 0x56a0
jmp 0x34789
movl $0x1, -0x3c(%rbp)
jmp 0x34810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5470
jmp 0x348d5
leaq -0xf8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x37250
jmp 0x347c4
leaq -0xf8(%rbp), %rdi
callq 0x5680
cmpl -0x18(%rbp), %eax
jg 0x347d7
jmp 0x347f6
leaq 0x25db0(%rip), %rdi     # 0x5a58e
leaq 0x25903(%rip), %rsi     # 0x5a0e8
movl $0x221, %edx            # imm = 0x221
leaq 0x25d4f(%rip), %rcx     # 0x5a540
callq 0x31a0
movq -0x118(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xf320
movl $0x1, -0x3c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5470
jmp 0x348c5
cmpl $0x2, -0xc4(%rbp)
jl 0x3482c
jmp 0x3484b
leaq 0x25d79(%rip), %rdi     # 0x5a5ac
leaq 0x258ae(%rip), %rsi     # 0x5a0e8
movl $0x225, %edx            # imm = 0x225
leaq 0x25cfa(%rip), %rcx     # 0x5a540
callq 0x31a0
leaq -0xc4(%rbp), %rsi
leaq -0x14(%rbp), %rdi
callq 0x23c80
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x3487d
movq -0x118(%rbp), %rdi
leaq 0x4d98ba(%rip), %rsi    # 0x50e130
callq 0x56a0
jmp 0x348c5
jmp 0x3487f
movq -0x118(%rbp), %rdi
movb $0x0, -0x101(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x310e0
movb $0x1, -0x101(%rbp)
movl $0x1, -0x3c(%rbp)
testb $0x1, -0x101(%rbp)
jne 0x348c3
movq -0x118(%rbp), %rdi
callq 0x5470
jmp 0x348c5
movq -0x110(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3480
nop