// File: /workspace/github_cpp_makefile_star2_O3/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 $0x208, %rsp            # imm = 0x208
movq %rdx, 0x98(%rsp)
fldt 0x260(%rsp)
fldt 0x250(%rsp)
fldt 0x240(%rsp)
fldl 0x1c0c6(%rip)           # 0x297c8
fld %st(1)
fstpt 0x54(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0xde0d
fld %st(1)
faddl 0x1c0b4(%rip)           # 0x297d0
fld %st(0)
fstpt 0x14c(%rsp)
fld %st(1)
fxch %st(1)
fucompi %st(2), %st
fstp %st(1)
jbe 0xde30
movq %rdi, %r15
fldt 0x54(%rsp)
fucomi %st(2), %st
jbe 0xd763
fstp %st(0)
fstp %st(1)
fstp %st(0)
fld1
fchs
fstpt (%r15)
movq %r15, %rdi
addq $0x10, %rdi
leaq 0x27aaf(%rip), %rsi     # 0x35208
callq 0x3f7c
jmp 0xddf8
movq %rsi, %r14
fxch %st(2)
fstpt 0x3c(%rsp)
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x48(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x12cbc
leaq 0x1b0(%rsp), %rdi
movq %r14, %rsi
callq 0x42ce
leaq 0x1c8(%rsp), %r12
leaq 0x18(%r14), %rsi
movq %r12, %rdi
callq 0x815a
movb 0x30(%r14), %al
leaq 0x1e8(%rsp), %rbx
movb %al, -0x8(%rbx)
leaq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x4110
movq 0x50(%r14), %rax
leaq 0x1b0(%rsp), %rdi
movq %rax, 0x50(%rdi)
leaq 0x170(%rsp), %rsi
callq 0x9bd8
leaq 0x1b0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x146e9
fldt 0x54(%rsp)
faddl 0x1bfc6(%rip)           # 0x297c8
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0xde53
fldt 0x48(%rsp)
faddl 0x1bfb8(%rip)           # 0x297d0
fucompi %st(1), %st
jbe 0xd83a
fstpt (%r15)
movq %r15, %rdi
addq $0x10, %rdi
leaq 0x170(%rsp), %rsi
callq 0x3f7c
fldz
jmp 0xdd8f
fstpt 0x140(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
leaq 0x170(%rsp), %rcx
movq %r14, %rsi
callq 0x13217
leaq 0x118(%rsp), %rdi
movupd (%rdi), %xmm0
movapd %xmm0, 0xd0(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xe0(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x6b12
movq 0xd0(%rsp), %r12
movq 0xd8(%rsp), %r14
cmpq %r14, %r12
je 0xd919
movq %r14, %rbx
subq %r12, %rbx
movq %rbx, %rax
sarq $0x3, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
imulq %rcx, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0xfa3b
cmpq $0x581, %rbx            # imm = 0x581
jl 0xd90e
leaq 0x580(%r12), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x10449
cmpq %r14, %r13
je 0xd919
movq %r13, %rdi
callq 0x10610
addq $0x58, %r13
jmp 0xd8fb
movq %r12, %rdi
movq %r14, %rsi
callq 0x10449
leaq 0x60(%rsp), %rsi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
fldt 0x54(%rsp)
fstpt 0x110(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x3f7c
movq %r15, 0x48(%rsp)
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd962
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x70(%rsp), %rbp
fldt 0x3c(%rsp)
fldt 0x140(%rsp)
fxch %st(1)
fucomi %st(1), %st
fcmovnbe %st(1), %st
fstp %st(1)
movq 0x48(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xf0(%rsp)
xorl %r13d, %r13d
leaq 0xf8(%rsp), %r12
fld1
fchs
fstpt 0x1a4(%rsp)
fstpt 0x3c(%rsp)
movq 0xd0(%rsp), %r14
movq 0xd8(%rsp), %rax
subq %r14, %rax
sarq $0x3, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
imulq %rcx, %rax
movslq %eax, %rcx
cmpq %rcx, %r13
jge 0xdd39
fldz
fstpt 0x60(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
imulq $0x58, %r13, %r15
incq %r13
addq %r15, %r14
cmpl %eax, %r13d
jge 0xda44
fldt 0x110(%rsp)
fstpt 0x54(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq 0x98(%rsp), %rdx
callq 0x10850
fldt 0x3c(%rsp)
fstpt 0x20(%rsp)
fldt 0x54(%rsp)
fstpt 0x10(%rsp)
fld1
fstpt (%rsp)
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xc8f2
jmp 0xda8a
fldt 0x110(%rsp)
fstpt 0x54(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq 0x98(%rsp), %rdx
callq 0x10850
fldt 0x3c(%rsp)
fstpt 0x20(%rsp)
fldt 0x54(%rsp)
fstpt 0x10(%rsp)
fld1
fstpt (%rsp)
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xc8f2
fldt 0xa0(%rsp)
fstpt 0x60(%rsp)
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rsi
movapd 0xb0(%rsp), %xmm0
movapd %xmm0, 0x70(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x80(%rsp)
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %rax
movapd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
testq %rdi, %rdi
je 0xdb03
subq %rdi, %rsi
callq 0x2210
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xdb03
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0xdb20
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rcx, %rsi
subq %rax, %rsi
movq 0x276d9(%rip), %rdi     # 0x35210
movq 0x276ca(%rip), %rdx     # 0x35208
subq %rdx, %rdi
cmpq %rdi, %rsi
jne 0xdb73
cmpq %rcx, %rax
je 0xdc74
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 0xdb73
addq $0x8, %rax
addq $0x8, %rdx
jmp 0xdb46
fldt 0x110(%rsp)
fldt 0x60(%rsp)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x110(%rsp)
movq 0xd0(%rsp), %r14
leaq 0x158(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3f7c
addq %r15, %r14
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xa2d6
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rsi
movapd 0xa0(%rsp), %xmm0
movapd %xmm0, 0x70(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x80(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
testq %rdi, %rdi
je 0xdc2d
subq %rdi, %rsi
callq 0x2210
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xdc2d
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0xdc4a
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x128(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rcx
leaq 0x120(%rsp), %rdi
callq 0x8ecc
xorl %r14d, %r14d
fldt 0x3c(%rsp)
fstp %st(0)
jmp 0xdcdc
fldt 0x14c(%rsp)
fldt 0x140(%rsp)
fxch %st(1)
fucompi %st(1), %st
jbe 0xdcaf
movq 0x48(%rsp), %rax
fstpt (%rax)
movb $0x1, %r14b
movq 0xf0(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x3f7c
fldt 0x3c(%rsp)
fstp %st(0)
jmp 0xdcdc
fstp %st(0)
movq 0x48(%rsp), %rax
fldt 0x1a4(%rsp)
fstpt (%rax)
movb $0x1, %r14b
movq 0xf0(%rsp), %rdi
leaq 0x27537(%rip), %rsi     # 0x35208
callq 0x3f7c
fldt 0x3c(%rsp)
fstp %st(0)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xdcfc
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
fldt 0x3c(%rsp)
fstp %st(0)
testb %r14b, %r14b
je 0xd9a5
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
movq 0x48(%rsp), %r15
leaq 0x1c8(%rsp), %r12
leaq 0x1e8(%rsp), %rbx
je 0xdd80
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xdd80
fldt 0x110(%rsp)
fldt 0x14c(%rsp)
fucompi %st(1), %st
leaq 0x1c8(%rsp), %r12
leaq 0x1e8(%rsp), %rbx
jbe 0xde74
movq 0x48(%rsp), %r15
fstpt (%r15)
movaps 0x120(%rsp), %xmm0
movaps %xmm0, 0x10(%r15)
movq 0x130(%rsp), %rax
movq %rax, 0x20(%r15)
leaq 0xd0(%rsp), %rdi
callq 0x6b12
fldz
fstp %st(0)
movq %rbx, %rdi
callq 0x41aa
movq %r12, %rdi
callq 0x436a
movq 0x1b0(%rsp), %rdi
testq %rdi, %rdi
je 0xddbe
movq 0x1c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0xdddb
movq 0x198(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0xddf8
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %r15, %rax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
fstp %st(1)
fstp %st(0)
leaq 0x1ba59(%rip), %rdi     # 0x29871
leaq 0x1b9c1(%rip), %rsi     # 0x297e0
leaq 0x1bbab(%rip), %rcx     # 0x299d1
movl $0x93, %edx
callq 0x2140
fstp %st(1)
fstp %st(0)
leaq 0x1bab9(%rip), %rdi     # 0x298f4
leaq 0x1b99e(%rip), %rsi     # 0x297e0
leaq 0x1bb88(%rip), %rcx     # 0x299d1
movl $0x94, %edx
callq 0x2140
fstp %st(0)
leaq 0x1bab3(%rip), %rdi     # 0x2990f
leaq 0x1b97d(%rip), %rsi     # 0x297e0
leaq 0x1bb67(%rip), %rcx     # 0x299d1
movl $0x9e, %edx
callq 0x2140
fstp %st(0)
leaq 0x1bbc7(%rip), %rdi     # 0x29a44
leaq 0x1b95c(%rip), %rsi     # 0x297e0
leaq 0x1bb46(%rip), %rcx     # 0x299d1
movl $0xbd, %edx
callq 0x2140
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xdf7e
movq 0x70(%rsp), %rsi
jmp 0xdf76
jmp 0xdef8
jmp 0xdef8
movq %rax, %rbx
movq %r12, %rdi
callq 0x436a
jmp 0xdec4
movq %rax, %rbx
movq 0x1b0(%rsp), %rdi
testq %rdi, %rdi
je 0xdf98
movq 0x1c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xdf98
movq %rax, %rbx
jmp 0xdf98
jmp 0xdf44
jmp 0xdf44
fstp %st(0)
movq %rax, %rbx
jmp 0xdf8b
jmp 0xdf02
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0xdf47
movq 0x108(%rsp), %rsi
jmp 0xdf3a
jmp 0xdf44
jmp 0xdf44
jmp 0xdf44
movq %rax, %rbx
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0xdf47
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0xdf47
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xdf61
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xdf7e
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0xd0(%rsp), %rdi
callq 0x6b12
leaq 0x1b0(%rsp), %rdi
callq 0x40d8
leaq 0x170(%rsp), %rdi
callq 0x3ff2
movq %rbx, %rdi
callq 0x2310