// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]Triangulator/src/hyper.cpp
// Function: Hyper::SolveAtom::solveAtom(Graph const&, int, int, int, std::vector<int, std::allocator<int>> const&)
pair<int, vector<pair<int, int> > > solveAtom(const Graph& G, int lowerBound, int okWidth, int upperBound, const vector<int>& vertMap) {
	assert(lowerBound >= 0);
	assert(okWidth <= upperBound);
	
	if (lowerBound > upperBound) return {-1, FAILSOLUTION};
	okWidth = max(okWidth, lowerBound);
	
	auto fill = MCS::MCS_MP(G);
	
	Graph gFill = G;
	gFill.addEdges(fill.F);
	
	int fillWidth = MCS::getHyperTreeWidth(gFill, vertMap);
	assert(fillWidth >= lowerBound);
	
	if (fillWidth <= okWidth) return {fillWidth, fill.F};
	
	if (fill.F.size() == 0) {
		if (fillWidth <= upperBound) return {fillWidth, fill.F};
		else return {-1, FAILSOLUTION};
	}
	
	PMC::initVertMap(vertMap);
	auto fillO = PMC::solve(G, (int64_t)lowerBound, (int64_t)upperBound, PROBLEM_HYPER);
	if (fillO == FAILSOLUTION) return {-1, FAILSOLUTION};
	Graph gFillO = G;
	gFillO.addEdges(fillO);
	int width = MCS::getHyperTreeWidth(gFillO, vertMap);
	assert(width >= lowerBound);
	assert(width <= upperBound);
	return {width, fillO};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
testl %edx, %edx
js 0xc6d2
movl %r8d, %ebp
movl %ecx, %r15d
cmpl %r8d, %ecx
jg 0xc6f1
movl %edx, %r12d
movq %rdi, %rbx
cmpl %ebp, %edx
jle 0xc32c
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x29ee6(%rip), %rsi     # 0x36208
callq 0x402a
jmp 0xc6bd
movq %r9, %r13
movq %rsi, %r14
cmpl %r12d, %r15d
cmovlel %r12d, %r15d
leaq 0xa0(%rsp), %rdi
callq 0x12a60
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x431c
leaq 0xe8(%rsp), %rdi
leaq 0x18(%r14), %rsi
movq %rsi, 0x80(%rsp)
callq 0x7e36
movb 0x30(%r14), %al
leaq 0x108(%rsp), %rdi
movb %al, -0x8(%rdi)
leaq 0x38(%r14), %rsi
movq %rsi, 0x78(%rsp)
callq 0x4164
movq 0x50(%r14), %rax
leaq 0xd0(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0xa0(%rsp), %rsi
callq 0x9880
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0x14010
cmpl %r12d, %eax
jl 0xc710
cmpl %r15d, %eax
jle 0xc512
movq 0xa8(%rsp), %rcx
cmpq 0xa0(%rsp), %rcx
je 0xc52d
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x431c
leaq 0x88(%rsp), %rdi
callq 0x1b298
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xc41b
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movl %r12d, %esi
leaq 0x1b0(%rsp), %rdi
callq 0x1b2be
movl %ebp, %esi
leaq 0x180(%rsp), %rdi
callq 0x1b2be
movaps 0x180(%rsp), %xmm0
movaps 0x190(%rsp), %xmm1
movaps 0x1a0(%rsp), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps 0x1b0(%rsp), %xmm0
movaps 0x1c0(%rsp), %xmm1
movaps 0x1d0(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x202eb
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rax, %rsi
subq %rcx, %rsi
movq 0x29d60(%rip), %rdi     # 0x36210
movq 0x29d51(%rip), %rdx     # 0x36208
subq %rdx, %rdi
cmpq %rdi, %rsi
jne 0xc573
cmpq %rax, %rcx
sete %sil
je 0xc550
movl (%rcx), %esi
cmpl (%rdx), %esi
jne 0xc573
movl 0x4(%rdx), %esi
cmpl %esi, 0x4(%rcx)
jne 0xc573
addq $0x8, %rcx
addq $0xc, %rdx
cmpq %rax, %rcx
sete %sil
je 0xc550
movl (%rcx), %esi
cmpl -0x4(%rdx), %esi
jne 0xc573
leaq 0x8(%rcx), %rsi
movl (%rdx), %edi
addq $0x8, %rdx
cmpl %edi, 0x4(%rcx)
movq %rsi, %rcx
je 0xc4ee
jmp 0xc573
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x402a
jmp 0xc64c
leaq 0x8(%rbx), %rdi
cmpl %ebp, %eax
jle 0xc54c
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
leaq 0x29cc6(%rip), %rsi     # 0x36208
callq 0x402a
jmp 0xc64c
movl %eax, (%rbx)
jmp 0xc51b
testb %sil, %sil
je 0xc573
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x29c9f(%rip), %rsi     # 0x36208
callq 0x402a
jmp 0xc635
leaq 0x128(%rsp), %rdi
movq %r14, %rsi
callq 0x431c
leaq 0x140(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x7e36
movb 0x30(%r14), %al
leaq 0x160(%rsp), %r15
movb %al, -0x8(%r15)
movq %r15, %rdi
movq 0x78(%rsp), %rsi
callq 0x4164
movq 0x50(%r14), %rax
leaq 0x128(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0x60(%rsp), %rsi
callq 0x9880
leaq 0x128(%rsp), %rdi
movq %r13, %rsi
callq 0x14010
cmpl %r12d, %eax
jl 0xc72f
cmpl %ebp, %eax
jg 0xc74e
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x60(%rsp), %rsi
callq 0x402a
movq %r15, %rdi
callq 0x41fe
leaq 0x140(%rsp), %rdi
callq 0x43b8
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xc635
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xc64c
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x108(%rsp), %rdi
callq 0x41fe
leaq 0xe8(%rsp), %rdi
callq 0x43b8
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xc683
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xc6a0
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xc6bd
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1dc65(%rip), %rdi     # 0x2a33e
leaq 0x1e0f0(%rip), %rsi     # 0x2a7d0
leaq 0x1e0f3(%rip), %rcx     # 0x2a7da
movl $0x1e, %edx
callq 0x2140
leaq 0x1e153(%rip), %rdi     # 0x2a84b
leaq 0x1e0d1(%rip), %rsi     # 0x2a7d0
leaq 0x1e0d4(%rip), %rcx     # 0x2a7da
movl $0x1f, %edx
callq 0x2140
leaq 0x1db69(%rip), %rdi     # 0x2a280
leaq 0x1e0b2(%rip), %rsi     # 0x2a7d0
leaq 0x1e0b5(%rip), %rcx     # 0x2a7da
movl $0x2a, %edx
callq 0x2140
leaq 0x1dbe0(%rip), %rdi     # 0x2a316
leaq 0x1e093(%rip), %rsi     # 0x2a7d0
leaq 0x1e096(%rip), %rcx     # 0x2a7da
movl $0x39, %edx
callq 0x2140
leaq 0x1dbd5(%rip), %rdi     # 0x2a32a
leaq 0x1e074(%rip), %rsi     # 0x2a7d0
leaq 0x1e077(%rip), %rcx     # 0x2a7da
movl $0x3a, %edx
callq 0x2140
jmp 0xc7aa
jmp 0xc82f
jmp 0xc7c9
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x43b8
jmp 0xc78b
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xc7d9
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc7d9
movq %rax, %rbx
jmp 0xc7d9
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xc832
movq 0x98(%rsp), %rsi
jmp 0xc7e8
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x412c
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xc832
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc832
jmp 0xc82f
jmp 0xc82f
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x43b8
jmp 0xc80b
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xc83f
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc83f
movq %rax, %rbx
jmp 0xc83f
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x412c
leaq 0xa0(%rsp), %rdi
callq 0x40a0
movq %rbx, %rdi
callq 0x2310