// File: 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
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x160(%rbp)
movq %rdi, %rax
movq %rax, -0x158(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movslq 0x50(%rax), %rax
movq %rax, -0x150(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x111b0
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x17ab0
jmp 0x2ba9c
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 0x2bcd7
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x5c(%rbp), %rsi
callq 0xbba0
movq %rax, %rdi
callq 0x59a0
cmpq $0x0, %rax
jne 0x2bb36
leaq -0x58(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0xdff0
jmp 0x2baf3
movslq -0x5c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
movl $0x1, (%rax)
jmp 0x2bcc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x6620
jmp 0x2c15a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2c148
movslq -0x5c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
cmpl $0x0, (%rax)
jne 0x2bcc5
movq -0x10(%rbp), %rsi
movl -0x5c(%rbp), %edx
leaq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rcx
callq 0x29a80
jmp 0x2bb62
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 0x2bba3
jmp 0x2bc14
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 0x2bbce
jmp 0x2bbed
leaq 0x2e219(%rip), %rdi     # 0x59dee
leaq 0x2e0d3(%rip), %rsi     # 0x59caf
movl $0x189, %edx            # imm = 0x189
leaq 0x2e37c(%rip), %rcx     # 0x59f64
callq 0x31a0
movslq -0x94(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x178f0
movl $0x1, (%rax)
leaq -0x88(%rbp), %rdi
callq 0xe120
jmp 0x2bb8a
leaq -0x58(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0xe090
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x177f0
leaq -0x78(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0xe060
movq -0x178(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0xe090
movq -0x170(%rbp), %rdi
movq %rax, -0xb8(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
callq 0x2de00
movq %rax, -0x168(%rbp)
jmp 0x2bc92
movq -0x168(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x6d30
jmp 0x2bcc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x6d30
jmp 0x2c148
jmp 0x2bcc7
jmp 0x2bcc9
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2bab5
leaq -0x58(%rbp), %rdi
callq 0x59a0
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x2bceb
jmp 0x2bd0a
leaq 0x2e12b(%rip), %rdi     # 0x59e1d
leaq 0x2dfb6(%rip), %rsi     # 0x59caf
movl $0x18f, %edx            # imm = 0x18F
leaq 0x2e25f(%rip), %rcx     # 0x59f64
callq 0x31a0
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0x17c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movl -0x17c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2bd76
movl -0xc4(%rbp), %eax
movl %eax, -0x180(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x178f0
movl -0x180(%rbp), %edx
movslq (%rax), %rcx
leaq 0x48094e(%rip), %rax    # 0x4ac6b0
movl %edx, (%rax,%rcx,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x2bd14
movq -0x10(%rbp), %rax
movslq 0x50(%rax), %rax
movq %rax, -0x190(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x17e40
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
callq 0x2deb0
jmp 0x2bdb4
leaq -0xe1(%rbp), %rdi
callq 0x5f50
leaq -0x100(%rbp), %rdi
callq 0xbd50
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x2c075
movslq -0x104(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x178f0
movl (%rax), %eax
movl %eax, -0x108(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0x108(%rbp), %ecx
movb %al, -0x191(%rbp)
jg 0x2be29
movl -0x108(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
setl %al
movb %al, -0x191(%rbp)
movb -0x191(%rbp), %al
testb $0x1, %al
jne 0x2be35
jmp 0x2be37
jmp 0x2be73
leaq 0x2dff8(%rip), %rdi     # 0x59e36
leaq 0x2de6a(%rip), %rsi     # 0x59caf
movl $0x197, %edx            # imm = 0x197
leaq 0x2e113(%rip), %rcx     # 0x59f64
callq 0x31a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe1(%rbp), %rdi
callq 0x5f50
jmp 0x2c148
movslq -0x104(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x178a0
movq %rax, %rdi
leaq -0x108(%rbp), %rsi
callq 0xdff0
jmp 0x2be97
movl $0xffffffff, -0x10c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x108(%rbp), %rsi
callq 0xbba0
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
callq 0x6680
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
callq 0x66b0
movq %rax, -0x128(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0xbbc0
testb $0x1, %al
jne 0x2befe
jmp 0x2bfcc
leaq -0x120(%rbp), %rdi
callq 0xbc00
movl (%rax), %eax
movl %eax, -0x12c(%rbp)
movslq -0x12c(%rbp), %rcx
leaq 0x480790(%rip), %rax    # 0x4ac6b0
movl (%rax,%rcx,4), %eax
cmpl -0x104(%rbp), %eax
jle 0x2bfb9
movslq -0x104(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x178a0
movq %rax, %rdi
leaq -0x12c(%rbp), %rsi
callq 0xdff0
jmp 0x2bf53
cmpl $-0x1, -0x10c(%rbp)
je 0x2bf75
movslq -0x12c(%rbp), %rcx
leaq 0x480746(%rip), %rax    # 0x4ac6b0
movl (%rax,%rcx,4), %eax
cmpl -0x10c(%rbp), %eax
jge 0x2bfb7
movslq -0x12c(%rbp), %rcx
leaq 0x48072d(%rip), %rax    # 0x4ac6b0
movl (%rax,%rcx,4), %eax
movl %eax, -0x10c(%rbp)
jmp 0x2bfb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x5470
leaq -0xe0(%rbp), %rdi
callq 0x5e20
jmp 0x2c148
jmp 0x2bfb9
jmp 0x2bfbb
leaq -0x120(%rbp), %rdi
callq 0xbc80
jmp 0x2bee2
movl -0x104(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x50(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2c05f
cmpl $-0x1, -0x10c(%rbp)
je 0x2c01c
leaq -0x134(%rbp), %rdi
leaq -0x104(%rbp), %rsi
leaq -0x10c(%rbp), %rdx
callq 0xdfc0
jmp 0x2c005
leaq -0x100(%rbp), %rdi
leaq -0x134(%rbp), %rsi
callq 0x179a0
jmp 0x2c01a
jmp 0x2c05d
movl -0x104(%rbp), %eax
incl %eax
movl %eax, -0x140(%rbp)
leaq -0x13c(%rbp), %rdi
leaq -0x104(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0x2df20
jmp 0x2c046
leaq -0x100(%rbp), %rdi
leaq -0x13c(%rbp), %rsi
callq 0x179a0
jmp 0x2c05b
jmp 0x2c05d
jmp 0x2c05f
jmp 0x2c061
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x2bdd6
leaq -0xe0(%rbp), %rdi
callq 0x5e80
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x2c08c
jmp 0x2c0ab
leaq 0x2df2c(%rip), %rdi     # 0x59fbf
leaq 0x2dc15(%rip), %rsi     # 0x59caf
movl $0x1ab, %edx            # imm = 0x1AB
leaq 0x2debe(%rip), %rcx     # 0x59f64
callq 0x31a0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jle 0x2c0f2
leaq -0x100(%rbp), %rdi
callq 0x5680
movq -0x10(%rbp), %rcx
movl 0x50(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2c0d1
jmp 0x2c0f0
leaq 0x2deff(%rip), %rdi     # 0x59fd7
leaq 0x2dbd0(%rip), %rsi     # 0x59caf
movl $0x1ac, %edx            # imm = 0x1AC
leaq 0x2de79(%rip), %rcx     # 0x59f64
callq 0x31a0
jmp 0x2c0f2
movq -0x160(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x2df50
jmp 0x2c10e
leaq -0x100(%rbp), %rdi
callq 0x5470
leaq -0xe0(%rbp), %rdi
callq 0x5e20
leaq -0x58(%rbp), %rdi
callq 0x6d30
leaq -0x28(%rbp), %rdi
callq 0x6d30
movq -0x158(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x6d30
leaq -0x28(%rbp), %rdi
callq 0x6d30
movq -0x38(%rbp), %rdi
callq 0x3480
nopw %cs:(%rax,%rax)