// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/hyper.cpp
// Function: Hyper::SolveGraph::solveFracGraph(Graph const&, long double, long double, long double, std::vector<int, std::allocator<int>> const&)
pair<ld, vector<pair<int, int> > > solveFracGraph(const Graph& G, ld lowerBound, ld okWidth, ld upperBound, const vector<int>& vertMap) {
	assert(lowerBound > -eps);
	assert(okWidth < upperBound + eps);
	if (lowerBound > upperBound) return {-1, FAILSOLUTION};
	okWidth = max(okWidth, lowerBound);
	
	auto fill = MCS::MCS_MP(G);
	
	Graph gFill = G;
	gFill.addEdges(fill.F);
	
	ld fillWidth = MCS::getFracHyperTreeWidth(gFill, vertMap);
	assert(fillWidth > lowerBound - eps);
	
	if (fillWidth < okWidth + eps) return {fillWidth, fill.F};
	
	vector<Graph> atoms = MCS::getAtoms(G, gFill, fill).S;
	
	auto cmp = [](const Graph& a, const Graph& b) {
		return a.n > b.n;
	};
	sort(atoms.begin(), atoms.end(), cmp);
	pair<ld, vector<pair<int, int> > > sol = {lowerBound, {}};
	for (int i = 0; i < (int)atoms.size(); i++) {
		pair<ld, vector<pair<int, int> > > tSol;
		if (i+1 < (int)atoms.size()) {
			tSol = SolveAtom::solveFracAtom(atoms[i], 1, sol.F, min(upperBound, fillWidth), atoms[i].mapTableInto(vertMap));
		}
		else {
			tSol = SolveAtom::solveFracAtom(atoms[i], 1, sol.F, min(upperBound, fillWidth), atoms[i].mapTableInto(vertMap));
		}
		if (tSol.S == FAILSOLUTION) {
			if (fillWidth < upperBound + eps) {
				return {fillWidth, fill.F};
			}
			else {
				return {-1, FAILSOLUTION};
			}
		}
		sol.F = max(sol.F, tSol.F);
		tSol.S = atoms[i].mapBack(tSol.S);
		sol.S.insert(sol.S.end(), tSol.S.begin(), tSol.S.end());
	}
	assert(sol.F < upperBound + eps);
	return sol;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
fldt 0x250(%rsp)
fldt 0x240(%rsp)
fldt 0x230(%rsp)
fldl 0x15713(%rip)           # 0x207c8
fld %st(1)
fstpt 0x3c(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0xb5b5
fld %st(1)
faddl 0x15701(%rip)           # 0x207d0
fld %st(0)
fstpt 0xf4(%rsp)
fld %st(1)
fxch %st(1)
fucompi %st(2), %st
fstp %st(1)
jbe 0xb5d8
movq %rdi, %r13
fldt 0x3c(%rsp)
fucomi %st(2), %st
jbe 0xb116
fstp %st(0)
fstp %st(1)
fstp %st(0)
leaq 0x1a0(%rsp), %rsi
orl $-0x1, (%rsi)
leaq 0x2510f(%rip), %rdx     # 0x30218
movq %r13, %rdi
callq 0xc93e
jmp 0xb5a0
movq %rdx, %r15
movq %rsi, %rbx
fxch %st(2)
fstpt 0x54(%rsp)
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x48(%rsp)
leaq 0x120(%rsp), %rdi
callq 0xe30c
leaq 0x1a0(%rsp), %rdi
movq %rbx, %rsi
callq 0x5152
leaq 0x1a0(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x7cf8
leaq 0x1a0(%rsp), %rdi
movq %r15, %rsi
callq 0xf7f9
fldt 0x3c(%rsp)
faddl 0x1564c(%rip)           # 0x207c8
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0xb5fb
fldt 0x48(%rsp)
faddl 0x1563e(%rip)           # 0x207d0
fucompi %st(1), %st
jbe 0xb1b2
fstpt (%r13)
leaq 0x10(%r13), %rdi
leaq 0x120(%rsp), %rsi
callq 0x35f2
fldz
jmp 0xb584
fstpt 0xe8(%rsp)
movq %r15, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
leaq 0x120(%rsp), %rcx
movq %rbx, %rsi
callq 0xe775
leaq 0x88(%rsp), %rdi
movups (%rdi), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x52ce
movq 0x60(%rsp), %r15
movq 0x68(%rsp), %rbx
cmpq %rbx, %r15
je 0xb278
movq %rbx, %r14
subq %r15, %r14
movq %r14, %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc45e
cmpq $0x581, %r14            # imm = 0x581
jl 0xb26d
leaq 0x580(%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xc858
cmpq %rbx, %r12
je 0xb278
movq %r12, %rdi
callq 0xc8ee
addq $0x58, %r12
jmp 0xb25a
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc858
leaq 0xb0(%rsp), %rsi
andq $0x0, 0x10(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
fldt 0x3c(%rsp)
fstpt 0x80(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x35f2
leaq 0xb0(%rsp), %rdi
callq 0x3bfe
fldt 0x54(%rsp)
fldt 0xe8(%rsp)
fxch %st(1)
fucomi %st(1), %st
fcmovnbe %st(1), %st
fstp %st(1)
movq %r13, 0x48(%rsp)
leaq 0x10(%r13), %rax
movq %rax, 0x100(%rsp)
xorl %r13d, %r13d
leaq 0x108(%rsp), %rbp
xorl %r15d, %r15d
movq 0x78(%rsp), %r12
fstpt 0x54(%rsp)
movq 0x60(%rsp), %rbx
movq 0x68(%rsp), %rax
subq %rbx, %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0xb51e
fldz
fstpt 0xb0(%rsp)
leaq 0xc0(%rsp), %rcx
andq $0x0, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
leal 0x1(%r15), %ecx
addq %r13, %rbx
cmpl %eax, %ecx
jge 0xb379
fldt 0x80(%rsp)
fstpt 0x3c(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xc956
fldt 0x54(%rsp)
fstpt 0x20(%rsp)
fldt 0x3c(%rsp)
fstpt 0x10(%rsp)
fld1
fstpt (%rsp)
leaq 0x150(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0xa74f
jmp 0xb3bd
fldt 0x80(%rsp)
fstpt 0x3c(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xc956
fldt 0x54(%rsp)
fstpt 0x20(%rsp)
fldt 0x3c(%rsp)
fstpt 0x10(%rsp)
fld1
fstpt (%rsp)
leaq 0x150(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0xa74f
leaq 0xb0(%rsp), %rdi
movq %r14, %rsi
callq 0xca00
leaq 0x160(%rsp), %rdi
callq 0x3bfe
movq %rbp, %rdi
callq 0x38e4
leaq 0xc0(%rsp), %rdi
leaq 0x24e27(%rip), %rsi     # 0x30218
callq 0x35c8
movl %eax, %ebx
testb %al, %al
leaq 0x150(%rsp), %rbp
je 0xb43d
fldt 0xf4(%rsp)
fldt 0xe8(%rsp)
fxch %st(1)
fucompi %st(1), %st
jbe 0xb4d4
movq 0x48(%rsp), %rax
fstpt (%rax)
movq 0x100(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x35f2
jmp 0xb4f2
fldt 0x80(%rsp)
fldt 0xb0(%rsp)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x80(%rsp)
movq 0x60(%rsp), %r14
leaq 0x188(%rsp), %r12
movq %r12, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x35f2
addq %r13, %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x82b2
leaq 0xc0(%rsp), %rdi
movq %rbp, %rsi
callq 0x3d74
movq %rbp, %rdi
callq 0x3bfe
movq %r12, %rdi
callq 0x3bfe
movq 0x98(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movq 0xc8(%rsp), %rcx
leaq 0x90(%rsp), %rdi
callq 0x52ae
movq 0x78(%rsp), %r12
jmp 0xb4f2
fstp %st(0)
orl $-0x1, 0x150(%rsp)
movq 0x48(%rsp), %rdi
movq %rbp, %rsi
leaq 0x24d2b(%rip), %rdx     # 0x30218
callq 0xc93e
leaq 0xc0(%rsp), %rdi
callq 0x3bfe
addq $0x58, %r13
incq %r15
testb %bl, %bl
fldt 0x54(%rsp)
fstp %st(0)
leaq 0x108(%rsp), %rbp
je 0xb2eb
jmp 0xb566
fldt 0x80(%rsp)
fldt 0xf4(%rsp)
fucompi %st(1), %st
jbe 0xb61c
movq 0x48(%rsp), %rcx
fstpt (%rcx)
movaps 0x90(%rsp), %xmm0
movaps %xmm0, 0x10(%rcx)
movq 0xa0(%rsp), %rax
movq %rax, 0x20(%rcx)
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x90(%rsp), %rdi
callq 0x3bfe
leaq 0x60(%rsp), %rdi
callq 0x52ce
movq 0x48(%rsp), %r13
fldz
fstp %st(0)
leaq 0x1a0(%rsp), %rdi
callq 0x36d2
leaq 0x120(%rsp), %rdi
callq 0x3642
movq %r13, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
fstp %st(1)
fstp %st(0)
leaq 0x152b1(%rip), %rdi     # 0x20871
leaq 0x15219(%rip), %rsi     # 0x207e0
leaq 0x15403(%rip), %rcx     # 0x209d1
movl $0x93, %edx
callq 0x2150
fstp %st(1)
fstp %st(0)
leaq 0x15311(%rip), %rdi     # 0x208f4
leaq 0x151f6(%rip), %rsi     # 0x207e0
leaq 0x153e0(%rip), %rcx     # 0x209d1
movl $0x94, %edx
callq 0x2150
fstp %st(0)
leaq 0x1530b(%rip), %rdi     # 0x2090f
leaq 0x151d5(%rip), %rsi     # 0x207e0
leaq 0x153bf(%rip), %rcx     # 0x209d1
movl $0x9e, %edx
callq 0x2150
fstp %st(0)
leaq 0x1541f(%rip), %rdi     # 0x20a44
leaq 0x151b4(%rip), %rsi     # 0x207e0
leaq 0x1539e(%rip), %rcx     # 0x209d1
movl $0xbd, %edx
callq 0x2150
movq %rax, %rbx
jmp 0xb6ac
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0xb6a7
jmp 0xb65a
jmp 0xb65a
movq %rax, %rbx
jmp 0xb6c3
fstp %st(0)
movq %rax, %rbx
jmp 0xb6b6
jmp 0xb68f
jmp 0xb68f
jmp 0xb68f
jmp 0xb68f
jmp 0xb68f
jmp 0xb66b
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x38e4
jmp 0xb692
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x3bfe
jmp 0xb692
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x3bfe
leaq 0x90(%rsp), %rdi
callq 0x3bfe
leaq 0x60(%rsp), %rdi
callq 0x52ce
leaq 0x1a0(%rsp), %rdi
callq 0x36d2
leaq 0x120(%rsp), %rdi
callq 0x3642
movq %rbx, %rdi
callq 0x2340