// File: /workspace/github_cpp_makefile_star2_O1/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 0x12a60
movq 0x8(%rbp), %rax
cmpq (%rbp), %rax
je 0x47c7
leaq 0xd8(%rsp), %rdi
movq %r12, %rsi
callq 0x6862
leaq 0xd8(%rsp), %rdi
callq 0x1b2a7
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x46c4
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x150(%rsp), %rdi
movq %r15, %rsi
callq 0x1b2be
leaq 0x120(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2be
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
movq %r13, %rsi
movl $0x3, %edx
callq 0x202eb
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rax, %rsi
subq %rcx, %rsi
movq 0x31a96(%rip), %rdi     # 0x361f0
movq 0x31a87(%rip), %rdx     # 0x361e8
subq %rdx, %rdi
cmpq %rdi, %rsi
jne 0x48bb
cmpq %rax, %rcx
sete %sil
je 0x489a
movl (%rcx), %esi
cmpl (%rdx), %esi
jne 0x48bb
movl 0x4(%rdx), %esi
cmpl %esi, 0x4(%rcx)
jne 0x48bb
addq $0x8, %rcx
addq $0xc, %rdx
cmpq %rax, %rcx
sete %sil
je 0x489a
movl (%rcx), %esi
cmpl -0x4(%rdx), %esi
jne 0x48bb
leaq 0x8(%rcx), %rsi
movl (%rdx), %edi
addq $0x8, %rdx
cmpl %edi, 0x4(%rcx)
movq %rsi, %rcx
je 0x4798
jmp 0x48bb
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x431c
leaq 0x98(%rsp), %rdi
leaq 0x18(%r13), %rsi
callq 0x7e36
movb 0x30(%r13), %al
leaq 0xb8(%rsp), %rbp
movb %al, -0x8(%rbp)
leaq 0x38(%r13), %rsi
movq %rbp, %rdi
callq 0x4164
movq 0x50(%r13), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0xf0(%rsp), %rsi
callq 0x9880
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x13a1b
cmpq %r15, %rax
jl 0x4a1f
leaq 0x8(%rbx), %rdi
cmpq %r14, %rax
jle 0x4857
movq $-0x1, (%rbx)
leaq 0x31998(%rip), %rsi     # 0x361e8
callq 0x402a
jmp 0x4867
movq %rax, (%rbx)
leaq 0xf0(%rsp), %rsi
callq 0x402a
movq %rbp, %rdi
callq 0x41fe
leaq 0x98(%rsp), %rdi
callq 0x43b8
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4992
movq 0x90(%rsp), %rsi
jmp 0x498a
testb %sil, %sil
je 0x48bb
movq $-0x1, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x31937(%rip), %rsi     # 0x361e8
callq 0x402a
jmp 0x497b
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x431c
leaq 0x98(%rsp), %rdi
leaq 0x18(%r13), %rsi
callq 0x7e36
movb 0x30(%r13), %al
leaq 0xb8(%rsp), %rbp
movb %al, -0x8(%rbp)
leaq 0x38(%r13), %rsi
movq %rbp, %rdi
callq 0x4164
movq 0x50(%r13), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0x68(%rsp), %rsi
callq 0x9880
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x13a1b
movslq %eax, %rcx
cmpq %r15, %rcx
jl 0x49e1
cmpq %r14, %rcx
jg 0x4a00
cltq
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x68(%rsp), %rsi
callq 0x402a
movq %rbp, %rdi
callq 0x41fe
leaq 0x98(%rsp), %rdi
callq 0x43b8
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x497b
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4992
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x49af
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x49cc
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2592e(%rip), %rdi     # 0x2a316
leaq 0x258a9(%rip), %rsi     # 0x2a298
leaq 0x258ac(%rip), %rcx     # 0x2a2a2
movl $0x29, %edx
callq 0x2140
leaq 0x25923(%rip), %rdi     # 0x2a32a
leaq 0x2588a(%rip), %rsi     # 0x2a298
leaq 0x2588d(%rip), %rcx     # 0x2a2a2
movl $0x2a, %edx
callq 0x2140
leaq 0x2585a(%rip), %rdi     # 0x2a280
leaq 0x2586b(%rip), %rsi     # 0x2a298
leaq 0x2586e(%rip), %rcx     # 0x2a2a2
movl $0x1e, %edx
callq 0x2140
jmp 0x4ab2
jmp 0x4ab7
jmp 0x4ab7
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x43b8
jmp 0x4a59
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4b11
movq 0x90(%rsp), %rsi
jmp 0x4b04
jmp 0x4b0e
jmp 0x4ae5
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x43b8
jmp 0x4a93
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4af5
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x4af5
movq %rax, %rbx
jmp 0x4af5
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x412c
jmp 0x4b11
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x4b11
movq 0xe8(%rsp), %rsi
jmp 0x4b04
jmp 0x4b0e
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x412c
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4b11
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x4b11
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x40a0
movq %rbx, %rdi
callq 0x2310