// File: /workspace/github_cpp_makefile_star2_O1/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, 0x60(%rsp)
movslq 0x50(%rdi), %rsi
xorl %r12d, %r12d
cmpq $0x2, %rsi
jl 0x14338
movq %rdi, %r14
leaq 0x68(%rsp), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0xa6ba
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x0, 0x48(%rsp)
movl 0x50(%r14), %esi
testl %esi, %esi
jle 0x1415d
xorl %edx, %edx
leaq 0x20(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x68(%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 0x14112
movq 0x68(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x14147
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x134fd
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
cmpq %rcx, %rdx
je 0x140ec
movq 0x68(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x1434d
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x140cf
movq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x15cde
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14147
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x14147
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x1412b
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x14136
movq %r15, %rdi
movq %r12, %rdx
callq 0x8fde
movslq 0x48(%rsp), %rax
movq 0x68(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
movl 0x48(%rsp), %edx
incl %edx
movl %edx, 0x48(%rsp)
movl 0x50(%r14), %esi
cmpl %esi, %edx
jl 0x14085
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
cmpl %ecx, %esi
jne 0x143c9
testl %ecx, %ecx
jle 0x14198
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
leaq 0x454447(%rip), %rsi    # 0x4685d0
movslq (%rax,%rdx,4), %rdi
movl %edx, (%rsi,%rdi,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x14189
movl 0x50(%r14), %eax
testl %eax, %eax
jle 0x14307
movq %r14, 0x40(%rsp)
xorl %ebp, %ebp
leaq 0x80(%rsp), %rbx
leaq 0x454416(%rip), %r14    # 0x4685d0
xorl %r13d, %r13d
movq 0x20(%rsp), %rcx
movslq (%rcx,%rbp,4), %r15
testq %r15, %r15
js 0x143aa
cmpl %eax, %r15d
jge 0x143aa
movq 0x60(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
movl %eax, 0x48(%rsp)
movl $0x1, %edx
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x7(%rsp), %rcx
callq 0x121d8
movq 0x40(%rsp), %rax
movq 0x38(%rax), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %r12
movq 0x8(%rax,%rcx,8), %r15
cmpq %r15, %r12
je 0x14260
movslq (%r12), %rdx
movslq (%r14,%rdx,4), %rax
cmpq %rax, %rbp
jge 0x1425a
shlq $0x2, %rdx
movq 0x60(%rsp), %rax
addq (%rax), %rdx
movq 0x10(%rsp), %rsi
cmpq 0x18(%rsp), %rsi
je 0x14250
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x10(%rsp)
jmp 0x1425a
leaq 0x8(%rsp), %rdi
callq 0x8fde
addq $0x4, %r12
jmp 0x14217
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x431c
movq 0x40(%rsp), %rax
movl 0x50(%rax), %ecx
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x22f21
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x142a2
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %r12
subq %rdi, %r12
je 0x1436c
cmpl $-0x1, (%rdi)
je 0x1438b
shrq $0x2, %r12
cmpl %r12d, %r13d
cmovgl %r13d, %r12d
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x142ed
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
incq %rbp
movq 0x40(%rsp), %rax
movslq 0x50(%rax), %rax
movl %r12d, %r13d
cmpq %rax, %rbp
jl 0x141bd
jmp 0x1430a
xorl %r12d, %r12d
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14321
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x14338
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16aba(%rip), %rdi     # 0x2ae0e
leaq 0x16974(%rip), %rsi     # 0x2accf
leaq 0x16b65(%rip), %rcx     # 0x2aec7
movl $0x13b, %edx            # imm = 0x13B
callq 0x2140
leaq 0x16b93(%rip), %rdi     # 0x2af06
leaq 0x16955(%rip), %rsi     # 0x2accf
leaq 0x16b46(%rip), %rcx     # 0x2aec7
movl $0x150, %edx            # imm = 0x150
callq 0x2140
leaq 0x16b8b(%rip), %rdi     # 0x2af1d
leaq 0x16936(%rip), %rsi     # 0x2accf
leaq 0x16b27(%rip), %rcx     # 0x2aec7
movl $0x151, %edx            # imm = 0x151
callq 0x2140
leaq 0x16aa5(%rip), %rdi     # 0x2ae56
leaq 0x16917(%rip), %rsi     # 0x2accf
leaq 0x16b08(%rip), %rcx     # 0x2aec7
movl $0x148, %edx            # imm = 0x148
callq 0x2140
leaq 0x16a6d(%rip), %rdi     # 0x2ae3d
leaq 0x168f8(%rip), %rsi     # 0x2accf
leaq 0x16ae9(%rip), %rcx     # 0x2aec7
movl $0x141, %edx            # imm = 0x141
callq 0x2140
jmp 0x143ee
jmp 0x14417
jmp 0x143ee
movq %rax, %rbx
jmp 0x14431
jmp 0x14417
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1441a
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x1441a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14431
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14448
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x1445f
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310