// File: /workspace/github_cpp_makefile_star2_O3/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 0xaa18
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x0, 0x10(%rsp)
movl 0x50(%r14), %eax
xorl %edx, %edx
testl %eax, %eax
jle 0x14c4d
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 0x14bf6
movq 0x60(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
jne 0x14c2b
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0x137a2
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
cmpq %rcx, %rdx
je 0x14bd0
movq 0x60(%rsp), %rax
movq %rdx, %rsi
movslq (%rsi), %rdi
cmpl $0x0, (%rax,%rdi,4)
jne 0x14eba
movl $0x1, (%rax,%rdi,4)
addq $0x4, %rsi
cmpq %rcx, %rsi
jne 0x14bb3
movq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x15f3c
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14c2b
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x14c2b
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0x14c0f
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
jmp 0x14c1a
movq %r15, %rdi
movq %r12, %rdx
callq 0x92c4
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), %eax
cmpl %eax, %edx
jl 0x14b69
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
jmp 0x14c4f
xorl %ecx, %ecx
subq %rdx, %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jne 0x14ef8
testl %eax, %eax
jle 0x14c80
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x452963(%rip), %rsi    # 0x4675d0
movslq (%rdx,%rcx,4), %rdi
movl %ecx, (%rsi,%rdi,4)
incq %rcx
cmpq %rcx, %rax
jne 0x14c6d
movl 0x50(%r14), %eax
movslq %eax, %rsi
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x15abe
movq %rbx, 0x78(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x50(%r14), %eax
testl %eax, %eax
jle 0x14e07
xorl %ebp, %ebp
leaq 0x452913(%rip), %rbx    # 0x4675d0
movq %r14, 0x80(%rsp)
movq 0x40(%rsp), %rcx
movl (%rcx,%rbp,4), %ecx
movl %ecx, 0xc(%rsp)
testl %ecx, %ecx
js 0x14ed9
cmpl %eax, %ecx
jge 0x14ed9
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 0x14d0b
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14d15
leaq 0xc(%rsp), %rdx
callq 0x92c4
movslq 0xc(%rsp), %rax
movq 0x38(%r14), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %r13
movq %r14, %rdx
movq 0x8(%rcx,%rax,8), %r14
cmpq %r14, %r13
je 0x14dce
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movslq (%r13), %rax
movl %eax, 0x4(%rsp)
movslq (%rbx,%rax,4), %rcx
cmpq %rcx, %rbp
jge 0x14d91
movq 0x28(%rsp), %rcx
leaq (%rcx,%r15,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x14d6d
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x14d77
leaq 0x4(%rsp), %rdx
callq 0x92c4
movslq 0x4(%rsp), %rax
movl (%rbx,%rax,4), %eax
cmpl $-0x1, %r12d
je 0x14d8e
cmpl %r12d, %eax
cmovll %eax, %r12d
jmp 0x14d91
movl %eax, %r12d
addq $0x4, %r13
cmpq %r14, %r13
jne 0x14d3d
movq 0x80(%rsp), %r14
movslq 0x50(%r14), %rax
decq %rax
cmpq %rax, %rbp
jge 0x14df7
cmpl $-0x1, %r12d
je 0x14ddd
movl %ebp, 0x4(%rsp)
movl %r12d, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xb2ae
jmp 0x14df7
movslq 0x50(%rdx), %rax
decq %rax
cmpq %rax, %rbp
movq %rdx, %r14
jge 0x14df7
movl %ebp, 0x4(%rsp)
leal 0x1(%rbp), %eax
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xb2ae
incq %rbp
movslq 0x50(%r14), %rax
cmpq %rax, %rbp
jl 0x14cc5
movq 0x30(%rsp), %rcx
subq 0x28(%rsp), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cmpl %ecx, %eax
jne 0x14f17
testl %eax, %eax
movq 0x78(%rsp), %rbx
jle 0x14e44
movq 0x18(%rsp), %rcx
subq 0x10(%rsp), %rcx
shrq $0x3, %rcx
decl %eax
cmpl %ecx, %eax
jne 0x14f36
leaq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x15b3c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14e6d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x28(%rsp), %rdi
callq 0x41aa
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14e8e
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x14ea5
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 0x14f5d(%rip), %rdi     # 0x29e1e
leaq 0x14e17(%rip), %rsi     # 0x29cdf
leaq 0x150c5(%rip), %rcx     # 0x29f94
movl $0x189, %edx            # imm = 0x189
callq 0x2140
leaq 0x14f86(%rip), %rdi     # 0x29e66
leaq 0x14df8(%rip), %rsi     # 0x29cdf
leaq 0x150a6(%rip), %rcx     # 0x29f94
movl $0x197, %edx            # imm = 0x197
callq 0x2140
leaq 0x14f4e(%rip), %rdi     # 0x29e4d
leaq 0x14dd9(%rip), %rsi     # 0x29cdf
leaq 0x15087(%rip), %rcx     # 0x29f94
movl $0x18f, %edx            # imm = 0x18F
callq 0x2140
leaq 0x150d1(%rip), %rdi     # 0x29fef
leaq 0x14dba(%rip), %rsi     # 0x29cdf
leaq 0x15068(%rip), %rcx     # 0x29f94
movl $0x1ab, %edx            # imm = 0x1AB
callq 0x2140
leaq 0x150ca(%rip), %rdi     # 0x2a007
leaq 0x14d9b(%rip), %rsi     # 0x29cdf
leaq 0x15049(%rip), %rcx     # 0x29f94
movl $0x1ac, %edx            # imm = 0x1AC
callq 0x2140
jmp 0x14f82
jmp 0x14f79
jmp 0x14f79
jmp 0x14f82
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14fa6
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
jmp 0x14fa6
movq %rax, %rbx
jmp 0x14fa6
jmp 0x14f82
jmp 0x14f82
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14f9c
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x28(%rsp), %rdi
callq 0x41aa
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14fbd
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x14fd4
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2310