// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/PMC.cpp
// Function: PMC::solve(Graph const&, PMC::valueT, PMC::valueT, int)
vector<pair<int, int> > solve(const Graph& G, valueT lowerBound, valueT upperBound, int PROBLEM) {
	assert(PROBLEM == PROBLEM_MINFILL || PROBLEM == PROBLEM_TREEWIDTH || PROBLEM == PROBLEM_BAYES || PROBLEM == PROBLEM_HYPER || PROBLEM == PROBLEM_FRACHYPER);
	if (PROBLEM == PROBLEM_HYPER) {
		assert((int)vertMap.size() == G.n);
	}
	if (lowerBound > upperBound) return FAILSOLUTION;
	vector<vector<int> > PMCs = findPMCs(G, upperBound, PROBLEM);
	
	if (PROBLEM == PROBLEM_MINFILL || PROBLEM == PROBLEM_TREEWIDTH || PROBLEM == PROBLEM_BAYES || PROBLEM == PROBLEM_FRACHYPER) {
		return solvedp(G, PMCs, lowerBound, upperBound, PROBLEM);
	}
	else if (PROBLEM == PROBLEM_HYPER) {
		assert(upperBound.TYPE == valueT::TYPE_INT);
		vector<vector<int> > goodPMCs;
		for (int64_t k = lowerBound.valInt; k <= upperBound.valInt; k++) {
			for (int i = 0; i < (int)PMCs.size(); i++) {
				if (canFill(G, PMCs[i], k, PROBLEM_HYPER)) {
					goodPMCs.push_back(PMCs[i]);
					swap(PMCs[i], PMCs.back());
					PMCs.pop_back();
					i--;
				}
			}
			auto sol0 = solvedp(G, goodPMCs, (int64_t)0, (int64_t)0, PROBLEM_DECIDE);
			if (sol0 != FAILSOLUTION) {
				return sol0;
			}
		}
		return FAILSOLUTION;
	}
	else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
cmpl $0x6, %edx
ja 0x18dd4
movl %edx, %ebp
pushq $0x5e
popq %rax
btl %edx, %eax
jae 0x18dd4
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x4, %ebp
jne 0x18abe
movq 0x63201f(%rip), %rax    # 0x64aac8
subq 0x632010(%rip), %rax    # 0x64aac0
shrq $0x2, %rax
cmpl %eax, 0x50(%r14)
jne 0x18db5
leaq 0x1d0(%rsp), %r13
leaq 0x1a0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x14c62
testb %al, %al
je 0x18af1
leaq 0x5d051c(%rip), %rsi    # 0x5e9000
movq %r15, %rdi
callq 0x35f2
jmp 0x18bad
movaps (%r13), %xmm0
movaps 0x10(%r13), %xmm1
movaps 0x20(%r13), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x167dc
cmpl $0x6, %ebp
ja 0x18bc2
pushq $0x4e
popq %rax
btl %ebp, %eax
jae 0x18bc2
leaq 0xa8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3714
movaps (%r13), %xmm0
movaps 0x10(%r13), %xmm1
movaps 0x20(%r13), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps (%r12), %xmm0
movaps 0x10(%r12), %xmm1
movaps 0x20(%r12), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
leaq 0xa8(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0x16eda
leaq 0xa8(%rsp), %rdi
callq 0x376e
leaq 0x68(%rsp), %rdi
callq 0x376e
movq %r15, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x4, %ebp
jne 0x18df3
cmpl $0x1, 0x20(%r13)
jne 0x18e12
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq (%r12), %r12
movq (%r13), %rax
movq %rax, 0x88(%rsp)
pushq $0x18
popq %rbx
pushq $0x4
popq %rbp
movq %r15, 0x80(%rsp)
cmpq 0x88(%rsp), %r12
jg 0x18d99
xorl %r15d, %r15d
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rax
subq %rsi, %rax
cqto
idivq %rbx
cmpl %eax, %r15d
jge 0x18ccd
movslq %r15d, %rax
imulq $0x18, %rax, %r13
addq %r13, %rsi
movl $0x1, 0x140(%rsp)
movq %r12, 0x120(%rsp)
movaps 0x120(%rsp), %xmm0
movaps 0x130(%rsp), %xmm1
movaps 0x140(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r14, %rdi
movl %ebp, %edx
callq 0x15ac3
testb %al, %al
je 0x18cc5
movq 0x68(%rsp), %rsi
addq %r13, %rsi
leaq 0x90(%rsp), %rdi
callq 0x88a4
addq 0x68(%rsp), %r13
movq 0x70(%rsp), %rsi
addq $-0x18, %rsi
movq %r13, %rdi
callq 0x7034
movq 0x70(%rsp), %rdi
addq $-0x18, %rdi
movq %rdi, 0x70(%rsp)
callq 0x38e4
decl %r15d
incl %r15d
jmp 0x18c18
leaq 0x150(%rsp), %r13
movq %r13, %rdi
leaq 0x90(%rsp), %rsi
callq 0x3714
pushq $0x1
popq %rax
movl %eax, 0x110(%rsp)
andq $0x0, 0xf0(%rsp)
movl %eax, 0xe0(%rsp)
andq $0x0, 0xc0(%rsp)
movaps 0xc0(%rsp), %xmm0
movaps 0xd0(%rsp), %xmm1
movaps 0xe0(%rsp), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps 0xf0(%rsp), %xmm0
movaps 0x100(%rsp), %xmm1
movaps 0x110(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
pushq $0x5
popq %rcx
callq 0x16eda
movq %r13, %rdi
callq 0x376e
movq %r15, %rdi
leaq 0x5d0280(%rip), %rsi    # 0x5e9000
callq 0x6420
testb %al, %al
jne 0x18da8
movq %r15, %rdi
callq 0x3bfe
incq %r12
jmp 0x18c07
leaq 0x5d0260(%rip), %rsi    # 0x5e9000
movq %r15, %rdi
callq 0x35f2
leaq 0x90(%rsp), %rdi
jmp 0x18b9e
leaq 0x93a6(%rip), %rdi      # 0x22162
leaq 0x8903(%rip), %rsi      # 0x216c6
leaq 0x9352(%rip), %rcx      # 0x2211c
movl $0x331, %edx            # imm = 0x331
callq 0x2150
leaq 0x92ae(%rip), %rdi      # 0x22089
leaq 0x88e4(%rip), %rsi      # 0x216c6
leaq 0x9333(%rip), %rcx      # 0x2211c
movl $0x32f, %edx            # imm = 0x32F
callq 0x2150
leaq 0x7376(%rip), %rdi      # 0x20170
leaq 0x88c5(%rip), %rsi      # 0x216c6
leaq 0x9314(%rip), %rcx      # 0x2211c
movl $0x34d, %edx            # imm = 0x34D
callq 0x2150
leaq 0x8ca3(%rip), %rdi      # 0x21abc
leaq 0x88a6(%rip), %rsi      # 0x216c6
leaq 0x92f5(%rip), %rcx      # 0x2211c
movl $0x33a, %edx            # imm = 0x33A
callq 0x2150
jmp 0x18e66
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
jmp 0x18e71
movq %rax, %r14
jmp 0x18e76
movq %rax, %r14
leaq 0x150(%rsp), %rdi
callq 0x376e
jmp 0x18e69
jmp 0x18e66
movq %rax, %r14
movq %r15, %rdi
callq 0x3bfe
jmp 0x18e69
movq %rax, %r14
leaq 0x90(%rsp), %rdi
callq 0x376e
leaq 0x68(%rsp), %rdi
callq 0x376e
movq %r14, %rdi
callq 0x2340