// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movq %rsi, %rbx
movslq 0x50(%rdi), %rsi
xorl %ebp, %ebp
cmpq $0x2, %rsi
jl 0xf702
movq %rdi, %r14
leaq 0x68(%rsp), %r15
leaq 0x30(%rsp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x8852
xorps %xmm0, %xmm0
andq $0x0, 0x10(%r12)
movaps %xmm0, (%r12)
xorl %edx, %edx
leaq 0x18(%rsp), %r13
leaq 0x50(%rsp), %rbp
movl %edx, 0x18(%rsp)
movl 0x50(%r14), %eax
cmpl %eax, %edx
jge 0xf59f
movslq %edx, %rax
movq 0x38(%r14), %rcx
imulq $0x18, %rax, %rsi
movq 0x8(%rcx,%rsi), %rdi
cmpq (%rcx,%rsi), %rdi
je 0xf561
movq 0x68(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0xf594
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0xebd1
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rdx, %rsi
cmpq %rcx, %rsi
je 0xf57f
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0xf716
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
jmp 0xf542
movq %r12, %rdi
movq %r13, %rsi
callq 0x6402
movslq 0x18(%rsp), %rax
movq 0x68(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
jmp 0xf594
movq 0x38(%rsp), %rsi
movq %r12, %rdi
callq 0x107ac
movq %rbp, %rdi
callq 0x38e4
movl 0x18(%rsp), %edx
incl %edx
jmp 0xf4f1
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
cmpl %edx, %eax
jne 0xf792
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
leaq 0x45301a(%rip), %r12    # 0x4625e0
cmpq %rdx, %rax
je 0xf5d8
movslq (%rcx,%rdx,4), %rsi
movl %edx, (%r12,%rsi,4)
incq %rdx
jmp 0xf5c6
xorl %r13d, %r13d
leaq 0x50(%rsp), %r15
xorl %ebp, %ebp
movq %r14, 0x8(%rsp)
movslq 0x50(%r14), %rax
cmpq %rax, %r13
jge 0xf6ee
movq 0x30(%rsp), %rcx
movslq (%rcx,%r13,4), %r14
testq %r14, %r14
js 0xf735
cmpl %eax, %r14d
jge 0xf735
movl %ebp, 0x14(%rsp)
movq (%rbx), %rax
movl (%rax,%r14,4), %eax
movl %eax, 0x18(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x7(%rsp), %rcx
callq 0xdbe8
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
imulq $0x18, %r14, %rcx
movq (%rax,%rcx), %r14
movq 0x8(%rax,%rcx), %rbp
cmpq %rbp, %r14
je 0xf66f
movslq (%r14), %rsi
movslq (%r12,%rsi,4), %rax
cmpq %rax, %r13
jge 0xf669
shlq $0x2, %rsi
addq (%rbx), %rsi
movq %r15, %rdi
callq 0x6402
addq $0x4, %r14
jmp 0xf649
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3896
movq 0x8(%rsp), %rax
movl 0x50(%rax), %ecx
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
movl 0x14(%rsp), %ebp
movl %ebp, %edx
callq 0x1b195
movq %r14, %rdi
callq 0x38e4
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r14
subq %rax, %r14
je 0xf754
cmpl $-0x1, (%rax)
je 0xf773
shrq $0x2, %r14
cmpl %r14d, %ebp
cmovgl %ebp, %r14d
leaq 0x18(%rsp), %rdi
callq 0x38e4
movq %r15, %rdi
callq 0x38e4
incq %r13
movl %r14d, %ebp
movq 0x8(%rsp), %r14
jmp 0xf5e7
leaq 0x30(%rsp), %rdi
callq 0x38e4
leaq 0x68(%rsp), %rdi
callq 0x38e4
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11701(%rip), %rdi     # 0x20e1e
leaq 0x115bb(%rip), %rsi     # 0x20cdf
leaq 0x117ac(%rip), %rcx     # 0x20ed7
movl $0x13b, %edx            # imm = 0x13B
callq 0x2150
leaq 0x1172a(%rip), %rdi     # 0x20e66
leaq 0x1159c(%rip), %rsi     # 0x20cdf
leaq 0x1178d(%rip), %rcx     # 0x20ed7
movl $0x148, %edx            # imm = 0x148
callq 0x2150
leaq 0x117bb(%rip), %rdi     # 0x20f16
leaq 0x1157d(%rip), %rsi     # 0x20cdf
leaq 0x1176e(%rip), %rcx     # 0x20ed7
movl $0x150, %edx            # imm = 0x150
callq 0x2150
leaq 0x117b3(%rip), %rdi     # 0x20f2d
leaq 0x1155e(%rip), %rsi     # 0x20cdf
leaq 0x1174f(%rip), %rcx     # 0x20ed7
movl $0x151, %edx            # imm = 0x151
callq 0x2150
leaq 0x116b4(%rip), %rdi     # 0x20e4d
leaq 0x1153f(%rip), %rsi     # 0x20cdf
leaq 0x11730(%rip), %rcx     # 0x20ed7
movl $0x141, %edx            # imm = 0x141
callq 0x2150
jmp 0xf7d0
jmp 0xf7cb
jmp 0xf7cb
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x38e4
jmp 0xf7d3
jmp 0xf7d0
movq %rax, %rbx
jmp 0xf7dd
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x38e4
leaq 0x30(%rsp), %rdi
callq 0x38e4
leaq 0x68(%rsp), %rdi
callq 0x38e4
movq %rbx, %rdi
callq 0x2340