// File: 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
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %r8, -0x1e0(%rbp)
movq %rdi, -0x1d8(%rbp)
movq %rdi, %rax
movq %rax, -0x1d0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x28a90
leaq -0x58(%rbp), %rdi
callq 0x5680
cmpq $0x0, %rax
ja 0x90f0
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0xb8b0
jmp 0x8fd9
leaq -0xb0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x15db0
jmp 0x8feb
movq -0x1e0(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x2a2a0
movq %rax, -0x1e8(%rbp)
jmp 0x9007
movq -0x1e8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0x9024
jmp 0x907d
leaq 0x50239(%rip), %rdi     # 0x59264
leaq 0x5024a(%rip), %rsi     # 0x5927c
movl $0x1e, %edx
leaq 0x50248(%rip), %rcx     # 0x59286
callq 0x31a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x9375
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x59e0
jmp 0x9375
movq -0xc8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x90bc
movq -0x1d8(%rbp), %rdi
movl $0xffffffff, -0xcc(%rbp) # imm = 0xFFFFFFFF
leaq 0x71226(%rip), %rdx     # 0x7a2c8
leaq -0xcc(%rbp), %rsi
callq 0xb970
jmp 0x90b0
movl $0x1, -0xd0(%rbp)
jmp 0x90df
movq -0x1d8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0xb9b0
jmp 0x90d5
movl $0x1, -0xd0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x59e0
jmp 0x935c
movq -0x1e0(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0xb9f0
jmp 0x9105
leaq -0xe8(%rbp), %rdi
callq 0x3a0a0
jmp 0x9113
leaq -0xe8(%rbp), %rdi
callq 0xbae0
movq -0x10(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x130(%rbp), %rdi
callq 0x3a0f0
jmp 0x913c
movq -0x20(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x3a0f0
jmp 0x914e
movq -0x1f0(%rbp), %rsi
movaps -0x160(%rbp), %xmm0
movaps -0x150(%rbp), %xmm1
movaps -0x140(%rbp), %xmm2
movq %rsp, %rax
movaps %xmm2, 0x50(%rax)
movaps %xmm1, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps -0x130(%rbp), %xmm0
movaps -0x120(%rbp), %xmm1
movaps -0x110(%rbp), %xmm2
movaps %xmm2, 0x20(%rax)
movaps %xmm1, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0x100(%rbp), %rdi
movl $0x3, %edx
callq 0x41440
jmp 0x91ac
leaq 0x71115(%rip), %rsi     # 0x7a2c8
leaq -0x100(%rbp), %rdi
callq 0x5600
movb %al, -0x1f1(%rbp)
jmp 0x91c7
movb -0x1f1(%rbp), %al
testb $0x1, %al
jne 0x91d3
jmp 0x9242
movq -0x1d8(%rbp), %rdi
movl $0xffffffff, -0x164(%rbp) # imm = 0xFFFFFFFF
leaq 0x710dd(%rip), %rdx     # 0x7a2c8
leaq -0x164(%rbp), %rsi
callq 0xb970
jmp 0x91f9
movl $0x1, -0xd0(%rbp)
jmp 0x9340
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xbae0
jmp 0x9375
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x934e
movq -0x10(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0xb8b0
jmp 0x9254
leaq -0x1c0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x15db0
jmp 0x9269
movq -0x1e0(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x2a2a0
movq %rax, -0x200(%rbp)
jmp 0x9285
movq -0x200(%rbp), %rax
movl %eax, -0x1c4(%rbp)
movslq -0x1c4(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0x92a1
jmp 0x92e0
leaq 0x50052(%rip), %rdi     # 0x592fa
leaq 0x4ffcd(%rip), %rsi     # 0x5927c
movl $0x29, %edx
leaq 0x4ffcb(%rip), %rcx     # 0x59286
callq 0x31a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x59e0
jmp 0x934e
movslq -0x1c4(%rbp), %rax
cmpq -0x20(%rbp), %rax
jg 0x92ef
jmp 0x930e
leaq 0x50018(%rip), %rdi     # 0x5930e
leaq 0x4ff7f(%rip), %rsi     # 0x5927c
movl $0x2a, %edx
leaq 0x4ff7d(%rip), %rcx     # 0x59286
callq 0x31a0
movq -0x1d8(%rbp), %rdi
leaq -0x1c4(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0xbb40
jmp 0x932a
movl $0x1, -0xd0(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x59e0
leaq -0x100(%rbp), %rdi
callq 0x5470
jmp 0x935c
leaq -0x100(%rbp), %rdi
callq 0x5470
jmp 0x9375
leaq -0x58(%rbp), %rdi
callq 0x57e0
movq -0x1d0(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x57e0
movq -0xb8(%rbp), %rdi
callq 0x3480
nopw (%rax,%rax)