// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]Triangulator/src/MCS.cpp
// Function: MCS::getHyperTreeWidth(Graph const&, std::vector<int, std::allocator<int>> const&)
int getHyperTreeWidth(const Graph& G, const vector<int>& vertMap) {
	if (G.n <= 1) return 0;
	vector<int> u(G.n);
	vector<int> order;
	for (int i = 0; i < G.n; i++) {
		if (G.g[i].size() == 0) {
			order.push_back(i);
			u[i] = 1;
		}
		else if (u[i] == 0) {
			auto ord = MCS_L(G, i, u);
			for (int x : ord) {
				assert(u[x] == 0);
				u[x] = 1;
			}
			order.insert(order.end(), ord.begin(), ord.end());
		}
	}
	assert((int)order.size() == G.n);
	for (int i = 0; i < (int)order.size(); i++) {
		invOrd[order[i]] = i;
	}
	int treeWidth = 0;
	for (int i = 0; i < G.n; i++) {
		int x = order[i];
		assert(0<=x&&x<G.n);
		vector<int> nb = {vertMap[x]};
		for (int nx : G.g[x]) {
			if (invOrd[nx] > i) {
				nb.push_back(vertMap[nx]);
			}
		}
		auto setCoverSol = SetCover::solve(nb, treeWidth, G.n);
		assert(setCoverSol.size() > 0);
		assert(setCoverSol[0] != -1);
		treeWidth = max(treeWidth, (int)setCoverSol.size());
	}
	return treeWidth;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x50(%rsp)
movslq 0x50(%rdi), %rsi
xorl %ebx, %ebx
cmpq $0x2, %rsi
jl 0x145be
movq %rdi, %r14
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0xaa18
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x0, 0x38(%rsp)
movl 0x50(%r14), %eax
xorl %edx, %edx
testl %eax, %eax
jle 0x1440b
leaq 0x20(%rsp), %r15
leaq 0x38(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x58(%rsp), %rbp
movslq %edx, %rax
movq 0x38(%r14), %rcx
leaq (%rax,%rax,2), %rsi
movq 0x8(%rcx,%rsi,8), %rdi
cmpq (%rcx,%rsi,8), %rdi
je 0x143b4
movq 0x58(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x143e9
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x137a2
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
cmpq %rcx, %rdx
je 0x1438e
movq 0x58(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x145d2
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x14371
movq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x15f3c
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x143e9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x143e9
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x143cd
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x143d8
movq %r15, %rdi
movq %r12, %rdx
callq 0x92c4
movslq 0x38(%rsp), %rax
movq 0x58(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
movl 0x38(%rsp), %edx
incl %edx
movl %edx, 0x38(%rsp)
movl 0x50(%r14), %eax
cmpl %eax, %edx
jl 0x14327
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
jmp 0x1440d
xorl %ecx, %ecx
subq %rdx, %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jne 0x1464e
testl %eax, %eax
jle 0x1458c
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x4531a1(%rip), %r12    # 0x4675d0
movslq (%rdx,%rcx,4), %rsi
movl %ecx, (%r12,%rsi,4)
incq %rcx
cmpq %rcx, %rax
jne 0x1442f
movl 0x50(%r14), %eax
testl %eax, %eax
jle 0x14595
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x20(%rsp), %rcx
movslq (%rcx,%r13,4), %r15
testq %r15, %r15
js 0x1462f
cmpl %eax, %r15d
jge 0x1462f
movq 0x50(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
movl %eax, 0x38(%rsp)
movl $0x1, %edx
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x7(%rsp), %rcx
callq 0x12450
movq 0x38(%r14), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %r15
movq 0x8(%rax,%rcx,8), %rbp
cmpq %rbp, %r15
je 0x144ed
movslq (%r15), %rdx
movslq (%r12,%rdx,4), %rax
cmpq %rax, %r13
jge 0x144e7
shlq $0x2, %rdx
movq 0x50(%rsp), %rax
addq (%rax), %rdx
movq 0x10(%rsp), %rsi
cmpq 0x18(%rsp), %rsi
je 0x144dd
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x10(%rsp)
jmp 0x144e7
leaq 0x8(%rsp), %rdi
callq 0x92c4
addq $0x4, %r15
jmp 0x144a5
leaq 0x70(%rsp), %r15
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x42ce
movl 0x50(%r14), %ecx
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x22e22
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1452c
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
subq %rdi, %rax
je 0x145f1
cmpl $-0x1, (%rdi)
je 0x14610
shrq $0x2, %rax
cmpl %eax, %ebx
cmovlel %eax, %ebx
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14575
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
incq %r13
movslq 0x50(%r14), %rax
cmpq %rax, %r13
jl 0x14450
movq 0x20(%rsp), %rdx
jmp 0x1458e
xorl %ebx, %ebx
testq %rdx, %rdx
jne 0x14597
jmp 0x145a7
xorl %ebx, %ebx
movq 0x30(%rsp), %rsi
subq %rdx, %rsi
movq %rdx, %rdi
callq 0x2210
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x145be
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15845(%rip), %rdi     # 0x29e1e
leaq 0x156ff(%rip), %rsi     # 0x29cdf
leaq 0x158f0(%rip), %rcx     # 0x29ed7
movl $0x13b, %edx            # imm = 0x13B
callq 0x2140
leaq 0x1591e(%rip), %rdi     # 0x29f16
leaq 0x156e0(%rip), %rsi     # 0x29cdf
leaq 0x158d1(%rip), %rcx     # 0x29ed7
movl $0x150, %edx            # imm = 0x150
callq 0x2140
leaq 0x15916(%rip), %rdi     # 0x29f2d
leaq 0x156c1(%rip), %rsi     # 0x29cdf
leaq 0x158b2(%rip), %rcx     # 0x29ed7
movl $0x151, %edx            # imm = 0x151
callq 0x2140
leaq 0x15830(%rip), %rdi     # 0x29e66
leaq 0x156a2(%rip), %rsi     # 0x29cdf
leaq 0x15893(%rip), %rcx     # 0x29ed7
movl $0x148, %edx            # imm = 0x148
callq 0x2140
leaq 0x157f8(%rip), %rdi     # 0x29e4d
leaq 0x15683(%rip), %rsi     # 0x29cdf
leaq 0x15874(%rip), %rcx     # 0x29ed7
movl $0x141, %edx            # imm = 0x141
callq 0x2140
jmp 0x14673
jmp 0x14699
jmp 0x14673
movq %rax, %rbx
jmp 0x146b3
jmp 0x14699
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1469c
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x1469c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x146b3
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x146ca
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x146e1
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310