// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]Triangulator/src/hyper.cpp
// Function: Hyper::SolveAtom::solveAtom(Graph const&, int, int, int, std::vector<int, std::allocator<int>> const&)
pair<int, vector<pair<int, int> > > solveAtom(const Graph& G, int lowerBound, int okWidth, int upperBound, const vector<int>& vertMap) {
	assert(lowerBound >= 0);
	assert(okWidth <= upperBound);
	
	if (lowerBound > upperBound) return {-1, FAILSOLUTION};
	okWidth = max(okWidth, lowerBound);
	
	auto fill = MCS::MCS_MP(G);
	
	Graph gFill = G;
	gFill.addEdges(fill.F);
	
	int fillWidth = MCS::getHyperTreeWidth(gFill, vertMap);
	assert(fillWidth >= lowerBound);
	
	if (fillWidth <= okWidth) return {fillWidth, fill.F};
	
	if (fill.F.size() == 0) {
		if (fillWidth <= upperBound) return {fillWidth, fill.F};
		else return {-1, FAILSOLUTION};
	}
	
	PMC::initVertMap(vertMap);
	auto fillO = PMC::solve(G, (int64_t)lowerBound, (int64_t)upperBound, PROBLEM_HYPER);
	if (fillO == FAILSOLUTION) return {-1, FAILSOLUTION};
	Graph gFillO = G;
	gFillO.addEdges(fillO);
	int width = MCS::getHyperTreeWidth(gFillO, vertMap);
	assert(width >= lowerBound);
	assert(width <= upperBound);
	return {width, fillO};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
testl %edx, %edx
js 0xc770
movl %r8d, %ebp
movl %ecx, %r15d
cmpl %r8d, %ecx
jg 0xc78f
movl %edx, %r12d
movq %rdi, %rbx
cmpl %ebp, %edx
jle 0xc3f0
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x28e22(%rip), %rsi     # 0x35208
callq 0x3f7c
jmp 0xc754
movq %r9, %r13
movq %rsi, %r14
cmpl %r12d, %r15d
cmovlel %r12d, %r15d
leaq 0xa0(%rsp), %rdi
callq 0x12cbc
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x42ce
leaq 0xe8(%rsp), %rdi
leaq 0x18(%r14), %rsi
movq %rsi, 0x80(%rsp)
callq 0x815a
movb 0x30(%r14), %al
leaq 0x108(%rsp), %rdi
movb %al, -0x8(%rdi)
leaq 0x38(%r14), %rsi
movq %rsi, 0x78(%rsp)
callq 0x4110
movq 0x50(%r14), %rax
leaq 0xd0(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0xa0(%rsp), %rsi
callq 0x9bd8
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0x142b3
cmpl %r12d, %eax
jl 0xc7ae
cmpl %r15d, %eax
jbe 0xc5b4
movq 0xa8(%rsp), %rcx
cmpq 0xa0(%rsp), %rcx
je 0xc693
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x42ce
leaq 0x88(%rsp), %rdi
callq 0x1b3d0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xc4df
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movl %r12d, %esi
leaq 0x1b0(%rsp), %rdi
callq 0x1b3f6
movl %ebp, %esi
leaq 0x180(%rsp), %rdi
callq 0x1b3f6
movaps 0x180(%rsp), %xmm0
movaps 0x190(%rsp), %xmm1
movaps 0x1a0(%rsp), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movapd 0x1b0(%rsp), %xmm0
movdqa 0x1c0(%rsp), %xmm1
movaps 0x1d0(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movdqa %xmm1, 0x10(%rsp)
movapd %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x20611
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
movq %rcx, %rsi
subq %rax, %rsi
movq 0x28c98(%rip), %rdi     # 0x35210
movq 0x28c89(%rip), %rdx     # 0x35208
subq %rdx, %rdi
cmpq %rdi, %rsi
jne 0xc5cf
cmpq %rcx, %rax
je 0xc6b3
movq (%rax), %xmm0
movq (%rdx), %xmm1
pcmpeqd %xmm0, %xmm1
pshufd $0x50, %xmm1, %xmm0     # xmm0 = xmm1[0,0,1,1]
movmskpd %xmm0, %esi
cmpl $0x3, %esi
jne 0xc5cf
addq $0x8, %rax
addq $0x8, %rdx
jmp 0xc587
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x3f7c
jmp 0xc6e3
leaq 0x128(%rsp), %rdi
movq %r14, %rsi
callq 0x42ce
leaq 0x140(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x815a
movb 0x30(%r14), %al
leaq 0x160(%rsp), %r15
movb %al, -0x8(%r15)
movq %r15, %rdi
movq 0x78(%rsp), %rsi
callq 0x4110
movq 0x50(%r14), %rax
leaq 0x128(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0x60(%rsp), %rsi
callq 0x9bd8
leaq 0x128(%rsp), %rdi
movq %r13, %rsi
callq 0x142b3
cmpl %r12d, %eax
jl 0xc7cd
cmpl %ebp, %eax
jg 0xc7ec
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x60(%rsp), %rsi
callq 0x3f7c
movq %r15, %rdi
callq 0x41aa
leaq 0x140(%rsp), %rdi
callq 0x436a
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xc6cc
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc6cc
leaq 0x8(%rbx), %rdi
cmpl %ebp, %eax
jbe 0xc769
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
leaq 0x28b5c(%rip), %rsi     # 0x35208
callq 0x3f7c
jmp 0xc6e3
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x28b41(%rip), %rsi     # 0x35208
callq 0x3f7c
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xc6e3
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x108(%rsp), %rdi
callq 0x41aa
leaq 0xe8(%rsp), %rdi
callq 0x436a
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xc71a
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xc737
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xc754
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, (%rbx)
jmp 0xc5bd
leaq 0x1cbd7(%rip), %rdi     # 0x2934e
leaq 0x1d062(%rip), %rsi     # 0x297e0
leaq 0x1d065(%rip), %rcx     # 0x297ea
movl $0x1e, %edx
callq 0x2140
leaq 0x1d0c5(%rip), %rdi     # 0x2985b
leaq 0x1d043(%rip), %rsi     # 0x297e0
leaq 0x1d046(%rip), %rcx     # 0x297ea
movl $0x1f, %edx
callq 0x2140
leaq 0x1cadb(%rip), %rdi     # 0x29290
leaq 0x1d024(%rip), %rsi     # 0x297e0
leaq 0x1d027(%rip), %rcx     # 0x297ea
movl $0x2a, %edx
callq 0x2140
leaq 0x1cb52(%rip), %rdi     # 0x29326
leaq 0x1d005(%rip), %rsi     # 0x297e0
leaq 0x1d008(%rip), %rcx     # 0x297ea
movl $0x39, %edx
callq 0x2140
leaq 0x1cb47(%rip), %rdi     # 0x2933a
leaq 0x1cfe6(%rip), %rsi     # 0x297e0
leaq 0x1cfe9(%rip), %rcx     # 0x297ea
movl $0x3a, %edx
callq 0x2140
jmp 0xc8cd
jmp 0xc848
jmp 0xc867
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x436a
jmp 0xc829
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xc877
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc877
movq %rax, %rbx
jmp 0xc877
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xc8d0
movq 0x98(%rsp), %rsi
jmp 0xc886
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x40d8
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xc8d0
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc8d0
jmp 0xc8cd
jmp 0xc8cd
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x436a
jmp 0xc8a9
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xc8dd
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xc8dd
movq %rax, %rbx
jmp 0xc8dd
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x40d8
leaq 0xa0(%rsp), %rdi
callq 0x3ff2
movq %rbx, %rdi
callq 0x2310