// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/MCS.cpp
// Function: MCS::getTreeWidth(Graph const&)
int getTreeWidth(const Graph& G) {
	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);
		int nb = 0;
		for (int nx : G.g[x]) {
			if (invOrd[nx] > i) {
				nb++;
			}
		}
		treeWidth = max(treeWidth, nb);
	}
	return treeWidth;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movslq 0x50(%rdi), %rsi
xorl %ebp, %ebp
cmpq $0x2, %rsi
jl 0xef38
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x8852
xorps %xmm0, %xmm0
andq $0x0, 0x10(%r15)
movaps %xmm0, (%r15)
xorl %edx, %edx
leaq 0xc(%rsp), %r12
leaq 0x40(%rsp), %r13
movl %edx, 0xc(%rsp)
movl 0x50(%rbx), %esi
cmpl %esi, %edx
jge 0xee83
movslq %edx, %rax
movq 0x38(%rbx), %rcx
imulq $0x18, %rax, %rsi
movq 0x8(%rcx,%rsi), %rdi
cmpq (%rcx,%rsi), %rdi
je 0xee45
movq 0x28(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0xee78
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0xebd1
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rdx, %rsi
cmpq %rcx, %rsi
je 0xee63
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0xef49
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
jmp 0xee26
movq %r15, %rdi
movq %r12, %rsi
callq 0x6402
movslq 0xc(%rsp), %rax
movq 0x28(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
jmp 0xee78
movq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x107ac
movq %r13, %rdi
callq 0x38e4
movl 0xc(%rsp), %edx
incl %edx
jmp 0xedd6
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
cmpl %ecx, %esi
jne 0xef87
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
leaq 0x453736(%rip), %rcx    # 0x4625e0
cmpq %rdx, %rsi
je 0xeebb
movslq (%rax,%rdx,4), %rdi
movl %edx, (%rcx,%rdi,4)
incq %rdx
jmp 0xeeaa
movl 0x50(%rbx), %edx
movq 0x38(%rbx), %rsi
xorl %edi, %edi
testl %edx, %edx
movl $0x0, %r8d
cmovgl %edx, %r8d
xorl %ebp, %ebp
cmpq %r8, %rdi
je 0xef24
movslq (%rax,%rdi,4), %r9
testq %r9, %r9
js 0xef68
cmpl %edx, %r9d
jge 0xef68
imulq $0x18, %r9, %r9
movq (%rsi,%r9), %r10
movq 0x8(%rsi,%r9), %r11
xorl %r9d, %r9d
cmpq %r11, %r10
je 0xef18
movslq (%r10), %rbx
movslq (%rcx,%rbx,4), %rbx
xorl %r14d, %r14d
cmpq %rbx, %rdi
setl %r14b
addl %r14d, %r9d
addq $0x4, %r10
jmp 0xeef9
cmpl %r9d, %ebp
cmovlel %r9d, %ebp
incq %rdi
jmp 0xeed2
leaq 0x10(%rsp), %rdi
callq 0x38e4
leaq 0x28(%rsp), %rdi
callq 0x38e4
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11ece(%rip), %rdi     # 0x20e1e
leaq 0x11d88(%rip), %rsi     # 0x20cdf
leaq 0x11eca(%rip), %rcx     # 0x20e28
movl $0xd2, %edx
callq 0x2150
leaq 0x11ef7(%rip), %rdi     # 0x20e66
leaq 0x11d69(%rip), %rsi     # 0x20cdf
leaq 0x11eab(%rip), %rcx     # 0x20e28
movl $0xdf, %edx
callq 0x2150
leaq 0x11ebf(%rip), %rdi     # 0x20e4d
leaq 0x11d4a(%rip), %rsi     # 0x20cdf
leaq 0x11e8c(%rip), %rcx     # 0x20e28
movl $0xd8, %edx
callq 0x2150
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x38e4
jmp 0xefba
jmp 0xefb7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x38e4
leaq 0x28(%rsp), %rdi
callq 0x38e4
movq %rbx, %rdi
callq 0x2340