// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/bayes.cpp
// Function: Bayes::SolveAtom::solveAtom(Graph const&, long, long, std::vector<long, std::allocator<long>>)
pair<int64_t, vector<pair<int, int> > > solveAtom(const Graph& G, int64_t lowerBound, int64_t upperBound, vector<int64_t> tableSizes) {
	auto fill = MCS::MCS_MP(G);
	
	if (fill.F.size() <= 0) {
		Graph gFill = G;
		gFill.addEdges(fill.F);
		int64_t fillWidth = MCS::getBayesWidth(gFill, tableSizes);
		assert(fillWidth >= lowerBound);
		if (fillWidth > upperBound) return {-1, FAILSOLUTION};
		return {fillWidth, fill.F};
	}
	
	PMC::initTableSz(tableSizes);
	auto fillO = PMC::solve(G, lowerBound, upperBound, PROBLEM_BAYES);
	if (fillO == FAILSOLUTION) return {-1, FAILSOLUTION};
	Graph gFillO = G;
	gFillO.addEdges(fillO);
	int width = MCS::getBayesWidth(gFillO, tableSizes);
	assert(width >= lowerBound);
	assert(width <= upperBound);
	return {width, fillO};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %rbx
leaq 0xf0(%rsp), %rbp
movq %rbp, %rdi
callq 0xe30c
movq 0x8(%rbp), %rax
cmpq (%rbp), %rax
je 0x3f2b
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x51b4
leaq 0x80(%rsp), %rdi
callq 0x14b67
leaq 0x80(%rsp), %rdi
callq 0x6ebc
leaq 0x150(%rsp), %rdi
movq %r15, %rsi
callq 0x14b7c
leaq 0x120(%rsp), %rdi
movq %r14, %rsi
callq 0x14b7c
movaps 0x120(%rsp), %xmm0
movaps 0x130(%rsp), %xmm1
movaps 0x140(%rsp), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps 0x150(%rsp), %xmm0
movaps 0x160(%rsp), %xmm1
movaps 0x170(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
leaq 0x68(%rsp), %rdi
pushq $0x3
popq %rdx
movq %r13, %rsi
callq 0x18a6f
leaq 0x2c2f4(%rip), %rsi     # 0x301f8
leaq 0x68(%rsp), %rdi
callq 0x35c8
testb %al, %al
je 0x3f8b
orq $-0x1, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x2c2d7(%rip), %rsi     # 0x301f8
callq 0x35f2
jmp 0x3fef
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x5152
leaq 0x98(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x7cf8
leaq 0x98(%rsp), %rdi
movq %r12, %rsi
callq 0xefd6
cmpq %r15, %rax
jl 0x403a
leaq 0x8(%rbx), %rdi
cmpq %r14, %rax
jle 0x3ffb
orq $-0x1, (%rbx)
leaq 0x2c277(%rip), %rsi     # 0x301f8
callq 0x35f2
jmp 0x400b
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x5152
leaq 0x98(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x7cf8
leaq 0x98(%rsp), %rdi
movq %r12, %rsi
callq 0xefd6
cltq
cmpq %r15, %rax
jl 0x4053
cmpq %r14, %rax
jg 0x406c
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x68(%rsp), %rsi
callq 0x35f2
leaq 0x98(%rsp), %rdi
callq 0x36d2
leaq 0x68(%rsp), %rdi
callq 0x3bfe
jmp 0x4018
movq %rax, (%rbx)
leaq 0xf0(%rsp), %rsi
callq 0x35f2
leaq 0x98(%rsp), %rdi
callq 0x36d2
leaq 0xf0(%rsp), %rdi
callq 0x3642
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c24f(%rip), %rdi     # 0x20290
leaq 0x1c260(%rip), %rsi     # 0x202a8
leaq 0x1c263(%rip), %rcx     # 0x202b2
pushq $0x1e
jmp 0x4083
leaq 0x1c2cc(%rip), %rdi     # 0x20326
leaq 0x1c247(%rip), %rsi     # 0x202a8
leaq 0x1c24a(%rip), %rcx     # 0x202b2
pushq $0x29
jmp 0x4083
leaq 0x1c2c7(%rip), %rdi     # 0x2033a
leaq 0x1c22e(%rip), %rsi     # 0x202a8
leaq 0x1c231(%rip), %rcx     # 0x202b2
pushq $0x2a
popq %rdx
callq 0x2150
jmp 0x4095
jmp 0x40a7
jmp 0x40b9
jmp 0x40b9
jmp 0x4095
jmp 0x40dc
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x36d2
jmp 0x40df
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x36d2
jmp 0x40bc
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3bfe
jmp 0x40df
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x6ebc
jmp 0x40df
jmp 0x40dc
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x3642
movq %rbx, %rdi
callq 0x2340