// File: 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
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x1f8(%rbp)
movq %rdi, %rax
movq %rax, -0x1f0(%rbp)
leaq 0x40(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x1, %al
cmpl $0x1, -0x14(%rbp)
movb %al, -0x1d1(%rbp)
je 0x414c2
movb $0x1, %al
cmpl $0x2, -0x14(%rbp)
movb %al, -0x1d1(%rbp)
je 0x414c2
movb $0x1, %al
cmpl $0x3, -0x14(%rbp)
movb %al, -0x1d1(%rbp)
je 0x414c2
movb $0x1, %al
cmpl $0x4, -0x14(%rbp)
movb %al, -0x1d1(%rbp)
je 0x414c2
cmpl $0x6, -0x14(%rbp)
sete %al
movb %al, -0x1d1(%rbp)
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x414ce
jmp 0x414d0
jmp 0x414ef
leaq 0x19b62(%rip), %rdi     # 0x5b039
leaq 0x19198(%rip), %rsi     # 0x5a676
movl $0x32f, %edx            # imm = 0x32F
leaq 0x19be2(%rip), %rcx     # 0x5b0cc
callq 0x31a0
cmpl $0x4, -0x14(%rbp)
jne 0x4152d
leaq 0x653694(%rip), %rdi    # 0x694b90
callq 0x59a0
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x4150c
jmp 0x4152b
leaq 0x19bff(%rip), %rdi     # 0x5b112
leaq 0x1915c(%rip), %rsi     # 0x5a676
movl $0x331, %edx            # imm = 0x331
leaq 0x19ba6(%rip), %rcx     # 0x5b0cc
callq 0x31a0
jmp 0x4152d
movq -0x1e8(%rbp), %rsi
movq -0x1e0(%rbp), %rdi
callq 0x3a2c0
testb $0x1, %al
jne 0x41546
jmp 0x4155e
movq -0x1f8(%rbp), %rdi
leaq 0x5f1b7c(%rip), %rsi    # 0x6330d0
callq 0x56a0
jmp 0x41a75
movq -0x1e8(%rbp), %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x60(%rbp), %rdi
movl $0x30, %edx
callq 0x3250
movq -0x200(%rbp), %rsi
movl -0x14(%rbp), %edx
movaps -0x60(%rbp), %xmm0
movaps -0x50(%rbp), %xmm1
movaps -0x40(%rbp), %xmm2
movq %rsp, %rax
movaps %xmm2, 0x20(%rax)
movaps %xmm1, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0x30(%rbp), %rdi
callq 0x3d8c0
cmpl $0x1, -0x14(%rbp)
je 0x415c7
cmpl $0x2, -0x14(%rbp)
je 0x415c7
cmpl $0x3, -0x14(%rbp)
je 0x415c7
cmpl $0x6, -0x14(%rbp)
jne 0x416d8
movq -0x10(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5d30
jmp 0x415e1
movq -0x208(%rbp), %rsi
movq -0x1f8(%rbp), %rdi
movq -0x1e8(%rbp), %rax
movq -0x1e0(%rbp), %rcx
movaps (%rcx), %xmm0
movaps 0x10(%rcx), %xmm1
movaps 0x20(%rcx), %xmm2
movaps %xmm2, -0xa0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps (%rax), %xmm0
movaps 0x10(%rax), %xmm1
movaps 0x20(%rax), %xmm2
movaps %xmm2, -0xd0(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movl -0x14(%rbp), %ecx
movaps -0xf0(%rbp), %xmm0
movaps -0xe0(%rbp), %xmm1
movaps -0xd0(%rbp), %xmm2
movq %rsp, %rax
movaps %xmm2, 0x50(%rax)
movaps %xmm1, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps -0xc0(%rbp), %xmm0
movaps -0xb0(%rbp), %xmm1
movaps -0xa0(%rbp), %xmm2
movaps %xmm2, 0x20(%rax)
movaps %xmm1, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0x78(%rbp), %rdx
callq 0x3e720
jmp 0x4168f
leaq -0x78(%rbp), %rdi
callq 0x5e20
movl $0x1, -0xf4(%rbp)
jmp 0x41a5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x41a6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x5e20
jmp 0x41a6a
cmpl $0x4, -0x14(%rbp)
jne 0x41a40
movq -0x1e8(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x416f1
jmp 0x41710
leaq 0x19374(%rip), %rdi     # 0x5aa6c
leaq 0x18f77(%rip), %rsi     # 0x5a676
movl $0x33a, %edx            # imm = 0x33A
leaq 0x199c1(%rip), %rcx     # 0x5b0cc
callq 0x31a0
leaq -0x110(%rbp), %rdi
callq 0x17630
movq -0x1e0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x1e8(%rbp), %rcx
movq -0x118(%rbp), %rax
cmpq (%rcx), %rax
jg 0x41a05
movl $0x0, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movl %eax, -0x20c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5e80
movq %rax, %rcx
movl -0x20c(%rbp), %eax
cmpl %ecx, %eax
jge 0x4188e
movq -0x10(%rbp), %rax
movq %rax, -0x220(%rbp)
movslq -0x11c(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x178a0
movq %rax, -0x218(%rbp)
movq -0x118(%rbp), %rsi
leaq -0x150(%rbp), %rdi
callq 0x3a0f0
jmp 0x417ab
movq -0x218(%rbp), %rsi
movq -0x220(%rbp), %rdi
movaps -0x150(%rbp), %xmm0
movaps -0x140(%rbp), %xmm1
movaps -0x130(%rbp), %xmm2
movq %rsp, %rax
movaps %xmm2, 0x20(%rax)
movaps %xmm1, 0x10(%rax)
movaps %xmm0, (%rax)
movl $0x4, %edx
callq 0x3be20
movb %al, -0x221(%rbp)
jmp 0x417ee
movb -0x221(%rbp), %al
testb $0x1, %al
jne 0x417fa
jmp 0x41878
movslq -0x11c(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x178a0
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x17bb0
jmp 0x4181b
movslq -0x11c(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x178a0
movq %rax, -0x230(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x28760
movq -0x230(%rbp), %rdi
movq %rax, %rsi
callq 0x1dfb0
leaq -0x30(%rbp), %rdi
callq 0x434a0
movl -0x11c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x41878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x41a32
jmp 0x4187a
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x4174e
movb $0x0, -0x151(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x170(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x5d30
jmp 0x418b5
xorl %eax, %eax
movl %eax, %esi
leaq -0x1a0(%rbp), %rdi
callq 0x3a0f0
jmp 0x418c7
xorl %eax, %eax
movl %eax, %esi
leaq -0x1d0(%rbp), %rdi
callq 0x3a0f0
jmp 0x418d9
movq -0x238(%rbp), %rsi
movq -0x1f8(%rbp), %rdi
movaps -0x1d0(%rbp), %xmm0
movaps -0x1c0(%rbp), %xmm1
movaps -0x1b0(%rbp), %xmm2
movq %rsp, %rax
movaps %xmm2, 0x50(%rax)
movaps %xmm1, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps -0x1a0(%rbp), %xmm0
movaps -0x190(%rbp), %xmm1
movaps -0x180(%rbp), %xmm2
movaps %xmm2, 0x20(%rax)
movaps %xmm1, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0x170(%rbp), %rdx
movl $0x5, %ecx
callq 0x3e720
jmp 0x4193e
leaq -0x170(%rbp), %rdi
callq 0x5e20
movq -0x1f8(%rbp), %rdi
leaq 0x5f1778(%rip), %rsi    # 0x6330d0
callq 0xe160
movb %al, -0x239(%rbp)
jmp 0x41965
movb -0x239(%rbp), %al
testb $0x1, %al
jne 0x41971
jmp 0x419c1
movb $0x1, -0x151(%rbp)
movl $0x1, -0xf4(%rbp)
jmp 0x419cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x5e20
jmp 0x41a32
movq -0x1f8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
callq 0x5470
jmp 0x41a32
movl $0x0, -0xf4(%rbp)
testb $0x1, -0x151(%rbp)
jne 0x419e0
movq -0x1f8(%rbp), %rdi
callq 0x5470
movl -0xf4(%rbp), %eax
testl %eax, %eax
jne 0x41a24
jmp 0x419ec
jmp 0x419ee
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0x4172d
movq -0x1f8(%rbp), %rdi
leaq 0x5f16bd(%rip), %rsi    # 0x6330d0
callq 0x56a0
jmp 0x41a1a
movl $0x1, -0xf4(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x5e20
jmp 0x41a5f
leaq -0x110(%rbp), %rdi
callq 0x5e20
jmp 0x41a6a
leaq 0x17729(%rip), %rdi     # 0x59170
leaq 0x18c28(%rip), %rsi     # 0x5a676
movl $0x34d, %edx            # imm = 0x34D
leaq 0x19672(%rip), %rcx     # 0x5b0cc
callq 0x31a0
leaq -0x30(%rbp), %rdi
callq 0x5e20
jmp 0x41a75
leaq -0x30(%rbp), %rdi
callq 0x5e20
jmp 0x41a85
movq -0x1f0(%rbp), %rax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x3480
nop