// File: 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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x50(%rax)
jg 0x29dc5
movl $0x0, -0x4(%rbp)
jmp 0x2a28b
movq -0x10(%rbp), %rax
movslq 0x50(%rax), %rax
movq %rax, -0x108(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x111b0
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x17ab0
jmp 0x29dfd
leaq -0x29(%rbp), %rdi
callq 0x6620
leaq -0x58(%rbp), %rdi
callq 0xdf40
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x2a038
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x5c(%rbp), %rsi
callq 0xbba0
movq %rax, %rdi
callq 0x59a0
cmpq $0x0, %rax
jne 0x29e97
leaq -0x58(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0xdff0
jmp 0x29e54
movslq -0x5c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
movl $0x1, (%rax)
jmp 0x2a028
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x6620
jmp 0x2a297
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2a277
movslq -0x5c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
cmpl $0x0, (%rax)
jne 0x2a026
movq -0x10(%rbp), %rsi
movl -0x5c(%rbp), %edx
leaq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rcx
callq 0x29a80
jmp 0x29ec3
leaq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0xe060
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0xe090
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xe0c0
testb $0x1, %al
jne 0x29f04
jmp 0x29f75
leaq -0x88(%rbp), %rdi
callq 0xe100
movl (%rax), %eax
movl %eax, -0x94(%rbp)
movslq -0x94(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
cmpl $0x0, (%rax)
jne 0x29f2f
jmp 0x29f4e
leaq 0x2feb8(%rip), %rdi     # 0x59dee
leaq 0x2fd72(%rip), %rsi     # 0x59caf
movl $0xd2, %edx
leaq 0x2feaf(%rip), %rcx     # 0x59df8
callq 0x31a0
movslq -0x94(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
movl $0x1, (%rax)
leaq -0x88(%rbp), %rdi
callq 0xe120
jmp 0x29eeb
leaq -0x58(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xe090
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x177f0
leaq -0x78(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0xe060
movq -0x120(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0xe090
movq -0x118(%rbp), %rdi
movq %rax, -0xb8(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
callq 0x2de00
movq %rax, -0x110(%rbp)
jmp 0x29ff3
movq -0x110(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x6d30
jmp 0x2a026
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x6d30
jmp 0x2a277
jmp 0x2a028
jmp 0x2a02a
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x29e16
leaq -0x58(%rbp), %rdi
callq 0x59a0
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x2a04c
jmp 0x2a06b
leaq 0x2fdca(%rip), %rdi     # 0x59e1d
leaq 0x2fc55(%rip), %rsi     # 0x59caf
movl $0xd8, %edx
leaq 0x2fd92(%rip), %rcx     # 0x59df8
callq 0x31a0
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0x124(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movl -0x124(%rbp), %eax
cmpl %ecx, %eax
jge 0x2a0d7
movl -0xc4(%rbp), %eax
movl %eax, -0x128(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x178f0
movl -0x128(%rbp), %edx
movslq (%rax), %rcx
leaq 0x4825ed(%rip), %rax    # 0x4ac6b0
movl %edx, (%rax,%rcx,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x2a075
movl $0x0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x2a25a
movslq -0xcc(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x178f0
movl (%rax), %eax
movl %eax, -0xd0(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0xd0(%rbp), %ecx
movb %al, -0x129(%rbp)
jg 0x2a13e
movl -0xd0(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
setl %al
movb %al, -0x129(%rbp)
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x2a14a
jmp 0x2a14c
jmp 0x2a16b
leaq 0x2fce3(%rip), %rdi     # 0x59e36
leaq 0x2fb55(%rip), %rsi     # 0x59caf
movl $0xdf, %edx
leaq 0x2fc92(%rip), %rcx     # 0x59df8
callq 0x31a0
movl $0x0, -0xd4(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0xd0(%rbp), %rsi
callq 0xbba0
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
callq 0x6680
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rdi
callq 0x66b0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xbbc0
testb $0x1, %al
jne 0x2a1cf
jmp 0x2a21b
leaq -0xe8(%rbp), %rdi
callq 0xbc00
movl (%rax), %eax
movl %eax, -0xf4(%rbp)
movslq -0xf4(%rbp), %rcx
leaq 0x4824bf(%rip), %rax    # 0x4ac6b0
movl (%rax,%rcx,4), %eax
cmpl -0xcc(%rbp), %eax
jle 0x2a20b
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x2a20d
leaq -0xe8(%rbp), %rdi
callq 0xbc80
jmp 0x2a1b6
leaq -0xc8(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x23c80
movq %rax, -0x138(%rbp)
jmp 0x2a237
movq -0x138(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc8(%rbp)
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x2a0eb
movl -0xc8(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6d30
leaq -0x28(%rbp), %rdi
callq 0x6d30
jmp 0x2a28b
leaq -0x58(%rbp), %rdi
callq 0x6d30
leaq -0x28(%rbp), %rdi
callq 0x6d30
jmp 0x2a297
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3480