// File: /workspace/github_cpp_makefile_star2_O3/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 0x13bf6
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0xaa18
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x0, 0xc(%rsp)
movl 0x50(%rbx), %eax
xorl %edx, %edx
testl %eax, %eax
jle 0x13b37
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 0x13ae1
movq 0x28(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x13b16
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rcx
callq 0x137a2
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
cmpq %rcx, %rdx
je 0x13abb
movq 0x28(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x13c07
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x13a9e
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x15f3c
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x13b16
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x13b16
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x13afa
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13b05
movq %r14, %rdi
movq %r15, %rdx
callq 0x92c4
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), %eax
cmpl %eax, %edx
jl 0x13a54
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
jmp 0x13b39
xorl %ecx, %ecx
subq %rdx, %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jne 0x13c45
testl %eax, %eax
jle 0x13bc4
movl %eax, %ecx
xorl %esi, %esi
leaq 0x453a79(%rip), %rax    # 0x4675d0
movslq (%rdx,%rsi,4), %rdi
movl %esi, (%rax,%rdi,4)
incq %rsi
cmpq %rsi, %rcx
jne 0x13b57
movslq 0x50(%rbx), %rcx
testq %rcx, %rcx
jle 0x13bcd
movq 0x38(%rbx), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%rdi,4), %r9d
cmpl %ecx, %r9d
jae 0x13c26
leaq (%r9,%r9,2), %r10
movq (%rsi,%r10,8), %r9
movq 0x8(%rsi,%r10,8), %r10
xorl %ebp, %ebp
cmpq %r10, %r9
je 0x13bb0
movslq (%r9), %r11
movslq (%rax,%r11,4), %r11
xorl %ebx, %ebx
cmpq %r11, %rdi
setl %bl
addl %ebx, %ebp
addq $0x4, %r9
jmp 0x13b94
cmpl %ebp, %r8d
cmovgl %r8d, %ebp
incq %rdi
movl %ebp, %r8d
cmpq %rcx, %rdi
jne 0x13b78
jmp 0x13bc6
xorl %ebp, %ebp
testq %rdx, %rdx
jne 0x13bcf
jmp 0x13bdf
xorl %ebp, %ebp
movq 0x20(%rsp), %rsi
subq %rdx, %rsi
movq %rdx, %rdi
callq 0x2210
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13bf6
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 0x16210(%rip), %rdi     # 0x29e1e
leaq 0x160ca(%rip), %rsi     # 0x29cdf
leaq 0x1620c(%rip), %rcx     # 0x29e28
movl $0xd2, %edx
callq 0x2140
leaq 0x16239(%rip), %rdi     # 0x29e66
leaq 0x160ab(%rip), %rsi     # 0x29cdf
leaq 0x161ed(%rip), %rcx     # 0x29e28
movl $0xdf, %edx
callq 0x2140
leaq 0x16201(%rip), %rdi     # 0x29e4d
leaq 0x1608c(%rip), %rsi     # 0x29cdf
leaq 0x161ce(%rip), %rcx     # 0x29e28
movl $0xd8, %edx
callq 0x2140
jmp 0x13c82
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x13c85
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x13c85
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13c9c
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13cb3
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310