// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]Triangulator/src/MCS.cpp
// Function: MCS::getTreeDecomposition(Graph const&)
pair<vector<vector<int> >, vector<pair<int, int> > > getTreeDecomposition(const Graph& G) {
	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;
	}
	vector<vector<int> > bags(G.n);
	vector<pair<int, int> > edges;
	for (int i = 0; i < G.n; i++) {
		int x = order[i];
		assert(0<=x&&x<G.n);
		bags[i].push_back(x);
		int neB = -1;
		for (int nx : G.g[x]) {
			if (invOrd[nx] > i) {
				bags[i].push_back(nx);
				if (neB == -1 || invOrd[nx] < neB) {
					neB = invOrd[nx];
				}
			}
		}
		if (i < G.n-1) {
			if (neB != -1) {
				edges.push_back({i, neB});
			}
			else {
				edges.push_back({i, i+1});
			}
		}
	}
	assert((int)bags.size() == G.n);
	if (G.n > 0) assert((int)edges.size() == G.n-1);
	return {bags, edges};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x50(%rsi), %rsi
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %r15
movq %r15, %rdx
callq 0xa6ba
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x0, 0x10(%rsp)
movl 0x50(%r14), %esi
testl %esi, %esi
jle 0x149b5
xorl %edx, %edx
leaq 0x40(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x60(%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 0x1496a
movq 0x60(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x1499f
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x134fd
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
cmpq %rcx, %rdx
je 0x14944
movq 0x60(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x14c12
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x14927
movq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x15cde
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1499f
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x1499f
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x14983
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
jmp 0x1498e
movq %r15, %rdi
movq %r12, %rdx
callq 0x8fde
movslq 0x10(%rsp), %rax
movq 0x60(%rsp), %rcx
movl $0x1, (%rcx,%rax,4)
movl 0x10(%rsp), %edx
incl %edx
movl %edx, 0x10(%rsp)
movl 0x50(%r14), %esi
cmpl %esi, %edx
jl 0x148dd
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
cmpl %ecx, %esi
jne 0x14c50
testl %ecx, %ecx
jle 0x149f0
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
leaq 0x453bef(%rip), %rsi    # 0x4685d0
movslq (%rax,%rdx,4), %rdi
movl %edx, (%rsi,%rdi,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x149e1
movslq 0x50(%r14), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x15846
movq %rbx, 0x78(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x50(%r14), %eax
testl %eax, %eax
jle 0x14b5f
xorl %ebp, %ebp
leaq 0x453ba2(%rip), %rbx    # 0x4685d0
movq %r14, 0x80(%rsp)
movq 0x40(%rsp), %rcx
movl (%rcx,%rbp,4), %ecx
movl %ecx, 0xc(%rsp)
testl %ecx, %ecx
js 0x14c31
cmpl %eax, %ecx
jge 0x14c31
movq 0x28(%rsp), %rax
leaq (,%rbp,2), %r15
addq %rbp, %r15
leaq (%rax,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14a7c
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14a86
leaq 0xc(%rsp), %rdx
callq 0x8fde
movslq 0xc(%rsp), %rax
movq 0x38(%r14), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r13
movq 0x8(%rcx,%rax,8), %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpq %r14, %r13
je 0x14b01
movslq (%r13), %rax
movl %eax, 0x4(%rsp)
movslq (%rbx,%rax,4), %rcx
cmpq %rcx, %rbp
jge 0x14afb
movq 0x28(%rsp), %rcx
leaq (%rcx,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14ad7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14ae1
leaq 0x4(%rsp), %rdx
callq 0x8fde
cmpl $-0x1, %r12d
je 0x14af2
movslq 0x4(%rsp), %rax
cmpl %r12d, (%rbx,%rax,4)
jge 0x14afb
movslq 0x4(%rsp), %rax
movl (%rbx,%rax,4), %r12d
addq $0x4, %r13
jmp 0x14aa2
movq 0x80(%rsp), %r14
movslq 0x50(%r14), %rax
decq %rax
cmpq %rax, %rbp
jge 0x14b4f
cmpl $-0x1, %r12d
je 0x14b35
movl %ebp, 0x4(%rsp)
movl %r12d, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xafe4
jmp 0x14b4f
movl %ebp, 0x4(%rsp)
leal 0x1(%rbp), %eax
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xafe4
incq %rbp
movslq 0x50(%r14), %rax
cmpq %rax, %rbp
jl 0x14a36
movq 0x30(%rsp), %rcx
subq 0x28(%rsp), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cmpl %ecx, %eax
jne 0x14c6f
testl %eax, %eax
movq 0x78(%rsp), %rbx
jle 0x14b9c
movq 0x18(%rsp), %rcx
subq 0x10(%rsp), %rcx
shrq $0x3, %rcx
decl %eax
cmpl %ecx, %eax
jne 0x14c8e
leaq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x158ce
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14bc5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x28(%rsp), %rdi
callq 0x41fe
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14be6
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x14bfd
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x161f5(%rip), %rdi     # 0x2ae0e
leaq 0x160af(%rip), %rsi     # 0x2accf
leaq 0x1635d(%rip), %rcx     # 0x2af84
movl $0x189, %edx            # imm = 0x189
callq 0x2140
leaq 0x1621e(%rip), %rdi     # 0x2ae56
leaq 0x16090(%rip), %rsi     # 0x2accf
leaq 0x1633e(%rip), %rcx     # 0x2af84
movl $0x197, %edx            # imm = 0x197
callq 0x2140
leaq 0x161e6(%rip), %rdi     # 0x2ae3d
leaq 0x16071(%rip), %rsi     # 0x2accf
leaq 0x1631f(%rip), %rcx     # 0x2af84
movl $0x18f, %edx            # imm = 0x18F
callq 0x2140
leaq 0x16369(%rip), %rdi     # 0x2afdf
leaq 0x16052(%rip), %rsi     # 0x2accf
leaq 0x16300(%rip), %rcx     # 0x2af84
movl $0x1ab, %edx            # imm = 0x1AB
callq 0x2140
leaq 0x16362(%rip), %rdi     # 0x2aff7
leaq 0x16033(%rip), %rsi     # 0x2accf
leaq 0x162e1(%rip), %rcx     # 0x2af84
movl $0x1ac, %edx            # imm = 0x1AC
callq 0x2140
jmp 0x14cda
jmp 0x14cd1
jmp 0x14cd1
jmp 0x14cda
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14cfe
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x14cfe
movq %rax, %rbx
jmp 0x14cfe
jmp 0x14cda
jmp 0x14cda
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14cf4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x28(%rsp), %rdi
callq 0x41fe
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14d15
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x14d2c
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310