// File: /workspace/github_cpp_makefile_star2_O1/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 0x13956
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0xa6ba
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x0, 0xc(%rsp)
movl 0x50(%rbx), %ecx
testl %ecx, %ecx
jle 0x1388c
xorl %edx, %edx
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
leaq 0x40(%rsp), %r12
leaq 0x28(%rsp), %r13
movslq %edx, %rax
movq 0x38(%rbx), %rcx
leaq (%rax,%rax,2), %rsi
movq 0x8(%rcx,%rsi,8), %rdi
cmpq (%rcx,%rsi,8), %rdi
je 0x13842
movq 0x28(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x13877
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rcx
callq 0x134fd
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
cmpq %rcx, %rdx
je 0x1381c
movq 0x28(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x13967
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x137ff
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x15cde
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x13877
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x13877
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x1385b
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13866
movq %r14, %rdi
movq %r15, %rdx
callq 0x8fde
movslq 0xc(%rsp), %rax
movq 0x28(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
movl 0xc(%rsp), %edx
incl %edx
movl %edx, 0xc(%rsp)
movl 0x50(%rbx), %ecx
cmpl %ecx, %edx
jl 0x137b5
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rax
subq %rdi, %rax
shrq $0x2, %rax
cmpl %eax, %ecx
jne 0x139a5
testl %eax, %eax
jle 0x138c6
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
leaq 0x454d19(%rip), %rdx    # 0x4685d0
movslq (%rdi,%rcx,4), %rsi
movl %ecx, (%rdx,%rsi,4)
incq %rcx
cmpq %rcx, %rax
jne 0x138b7
movslq 0x50(%rbx), %rax
testq %rax, %rax
jle 0x1392b
movq 0x38(%rbx), %rcx
xorl %edx, %edx
leaq 0x454cf4(%rip), %rsi    # 0x4685d0
xorl %r8d, %r8d
movl (%rdi,%rdx,4), %r9d
cmpl %eax, %r9d
jae 0x13986
leaq (%r9,%r9,2), %r10
movq (%rcx,%r10,8), %r9
movq 0x8(%rcx,%r10,8), %r10
xorl %ebp, %ebp
cmpq %r10, %r9
je 0x13917
movslq (%r9), %r11
movslq (%rsi,%r11,4), %r11
xorl %ebx, %ebx
cmpq %r11, %rdx
setl %bl
addl %ebx, %ebp
addq $0x4, %r9
jmp 0x138fb
cmpl %ebp, %r8d
cmovgl %r8d, %ebp
incq %rdx
movl %ebp, %r8d
cmpq %rax, %rdx
jne 0x138df
jmp 0x1392d
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x1393f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13956
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x174a0(%rip), %rdi     # 0x2ae0e
leaq 0x1735a(%rip), %rsi     # 0x2accf
leaq 0x1749c(%rip), %rcx     # 0x2ae18
movl $0xd2, %edx
callq 0x2140
leaq 0x174c9(%rip), %rdi     # 0x2ae56
leaq 0x1733b(%rip), %rsi     # 0x2accf
leaq 0x1747d(%rip), %rcx     # 0x2ae18
movl $0xdf, %edx
callq 0x2140
leaq 0x17491(%rip), %rdi     # 0x2ae3d
leaq 0x1731c(%rip), %rsi     # 0x2accf
leaq 0x1745e(%rip), %rcx     # 0x2ae18
movl $0xd8, %edx
callq 0x2140
jmp 0x139e2
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x139e5
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x139e5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x139fc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13a13
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310