// File: Laakeri[P]Triangulator/src/MCS.cpp
// Function: MCS::getAtoms(Graph const&, Graph const&, std::pair<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>> const&)
pair<int, vector<Graph> > getAtoms(const Graph& G, const Graph& gFill, const pair<vector<pair<int, int> >, vector<pair<int, int> > >& fill) {
	assert(G.n == gFill.n);
	for (int i = 0; i < G.n; i++) {
		rm[i] = 0;
		rc[i] = 0;
		ca[i] = 0;
	}
	int maxSep = 0;
	vector<Graph> ret;
	for (int i = 0; i < G.n; i++) {
		if (fill.S[i].S) {
			vector<int> cand;
			for (int nx : gFill.g[fill.S[i].F]) {
				if (rm[nx] == 0) {
					cand.push_back(nx);
				}
			}
			for (int x : cand) {
				ca[x] = 1;
			}
			bool no = false;
			for (int x : cand) {
				int fo = 0;
				for (int nx : G.g[x]) {
					if (ca[nx]) fo++;
				}
				if (fo < (int)cand.size()-1) {
					no = true;
				}
			}
			if (!no) {
				maxSep = max(maxSep, (int)cand.size()+1);
				vector<pair<int, int> > es;
				findCC(fill.S[i].F, G, es);
				for (int j = 0; j < (int)cand.size(); j++) {
					for (int jj = j+1; jj < (int)cand.size(); jj++) {
						es.push_back({cand[j], cand[jj]});
					}
				}
				ret.push_back(es);
			}
			for (int x : cand) {
				ca[x] = 0;
			}
		}
		rm[fill.S[i].F] = 1;
	}
	int fo = 0;
	for (int i = 0; i < G.n; i++) {
		if (!rc[i]) {
			vector<pair<int, int> > es;
			findCC(i, G, es);
			ret.push_back(Graph(es));
			fo++;
		}
	}
	assert(fo == 1);
	return {maxSep, ret};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x218(%rbp)
movq %rdi, %rax
movq %rax, -0x210(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x292ee
jmp 0x2930d
leaq 0x30a12(%rip), %rdi     # 0x59d07
leaq 0x309b3(%rip), %rsi     # 0x59caf
movl $0x6c, %edx
leaq 0x30a0e(%rip), %rcx     # 0x59d16
callq 0x31a0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x29361
movslq -0x24(%rbp), %rcx
leaq 0x2cbc45(%rip), %rax    # 0x2f4f70
movl $0x0, (%rax,%rcx,4)
movslq -0x24(%rbp), %rcx
leaq 0x2fc973(%rip), %rax    # 0x325cb0
movl $0x0, (%rax,%rcx,4)
movslq -0x24(%rbp), %rcx
leaq 0x32d6a1(%rip), %rax    # 0x3569f0
movl $0x0, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x29314
movl $0x0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2dd10
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x298eb
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
movslq -0x44(%rbp), %rsi
callq 0x2dd30
cmpl $0x0, 0x4(%rax)
je 0x298bb
leaq -0x60(%rbp), %rdi
callq 0xdf40
movq -0x18(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x220(%rbp)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
movslq -0x44(%rbp), %rsi
callq 0x2dd30
movq -0x220(%rbp), %rdi
movslq (%rax), %rsi
callq 0xbba0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x6680
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0x66b0
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xbbc0
testb $0x1, %al
jne 0x2940c
jmp 0x29460
leaq -0x70(%rbp), %rdi
callq 0xbc00
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movslq -0x7c(%rbp), %rcx
leaq 0x2cbb4b(%rip), %rax    # 0x2f4f70
cmpl $0x0, (%rax,%rcx,4)
jne 0x29453
leaq -0x60(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xdff0
jmp 0x2943a
jmp 0x29453
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x298ad
jmp 0x29455
leaq -0x70(%rbp), %rdi
callq 0xbc80
jmp 0x293f9
leaq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0xe060
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
callq 0xe090
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xe0c0
testb $0x1, %al
jne 0x294aa
jmp 0x294e1
leaq -0xa0(%rbp), %rdi
callq 0xe100
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movslq -0xac(%rbp), %rcx
leaq 0x32d524(%rip), %rax    # 0x3569f0
movl $0x1, (%rax,%rcx,4)
leaq -0xa0(%rbp), %rdi
callq 0xe120
jmp 0x29491
movb $0x0, -0xad(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xe060
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xe090
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xe0c0
testb $0x1, %al
jne 0x29535
jmp 0x29633
leaq -0xc0(%rbp), %rdi
callq 0xe100
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
movl $0x0, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0xcc(%rbp), %rsi
callq 0xbba0
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x6680
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x66b0
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xbbc0
testb $0x1, %al
jne 0x295ad
jmp 0x295f4
leaq -0xe0(%rbp), %rdi
callq 0xbc00
movl (%rax), %eax
movl %eax, -0xec(%rbp)
movslq -0xec(%rbp), %rcx
leaq 0x32d421(%rip), %rax    # 0x3569f0
cmpl $0x0, (%rax,%rcx,4)
je 0x295e4
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x295e6
leaq -0xe0(%rbp), %rdi
callq 0xbc80
jmp 0x29594
movl -0xd0(%rbp), %eax
movl %eax, -0x224(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movl -0x224(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x29620
movb $0x1, -0xad(%rbp)
jmp 0x29622
leaq -0xc0(%rbp), %rdi
callq 0xe120
jmp 0x29519
testb $0x1, -0xad(%rbp)
jne 0x29821
leaq -0x60(%rbp), %rdi
callq 0x59a0
incl %eax
movl %eax, -0xf0(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x23c80
movq %rax, -0x230(%rbp)
jmp 0x2966a
movq -0x230(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
leaq -0x108(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0xbd50
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
movslq -0x44(%rbp), %rsi
callq 0x2dd30
movq -0x238(%rbp), %rdx
movl (%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x29130
jmp 0x296ae
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x23c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movl -0x23c(%rbp), %eax
cmpl %ecx, %eax
jge 0x297b1
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0x240(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x59a0
movq %rax, %rcx
movl -0x240(%rbp), %eax
cmpl %ecx, %eax
jge 0x2979b
movslq -0x10c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x178f0
movq -0x250(%rbp), %rdi
movq %rax, -0x248(%rbp)
movslq -0x110(%rbp), %rsi
callq 0x178f0
movq -0x248(%rbp), %rsi
movq %rax, %rdx
leaq -0x118(%rbp), %rdi
callq 0xdfc0
jmp 0x2975c
leaq -0x108(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x179a0
jmp 0x29771
jmp 0x29773
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x296ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x29810
jmp 0x2979d
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x296b8
leaq -0x170(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x158e0
jmp 0x297c6
leaq -0x40(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x2dd50
jmp 0x297d8
leaq -0x170(%rbp), %rdi
callq 0x59e0
leaq -0x108(%rbp), %rdi
callq 0x5470
jmp 0x29821
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x59e0
leaq -0x108(%rbp), %rdi
callq 0x5470
jmp 0x298ad
leaq -0x60(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
callq 0xe060
movq %rax, -0x180(%rbp)
movq -0x178(%rbp), %rdi
callq 0xe090
movq %rax, -0x188(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0xe0c0
testb $0x1, %al
jne 0x2986b
jmp 0x298a2
leaq -0x180(%rbp), %rdi
callq 0xe100
movl (%rax), %eax
movl %eax, -0x18c(%rbp)
movslq -0x18c(%rbp), %rcx
leaq 0x32d163(%rip), %rax    # 0x3569f0
movl $0x0, (%rax,%rcx,4)
leaq -0x180(%rbp), %rdi
callq 0xe120
jmp 0x29852
leaq -0x60(%rbp), %rdi
callq 0x6d30
jmp 0x298bb
leaq -0x60(%rbp), %rdi
callq 0x6d30
jmp 0x29a69
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
movslq -0x44(%rbp), %rsi
callq 0x2dd30
movslq (%rax), %rcx
leaq 0x2cb69a(%rip), %rax    # 0x2f4f70
movl $0x1, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x29378
movl $0x0, -0x190(%rbp)
movl $0x0, -0x194(%rbp)
movl -0x194(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x299fe
movslq -0x194(%rbp), %rcx
leaq 0x2fc390(%rip), %rax    # 0x325cb0
cmpl $0x0, (%rax,%rcx,4)
jne 0x299e8
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0xbd50
movq -0x258(%rbp), %rdx
movl -0x194(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x29130
jmp 0x29955
leaq -0x208(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x158e0
jmp 0x2996a
leaq -0x40(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x2dd50
jmp 0x2997c
leaq -0x208(%rbp), %rdi
callq 0x59e0
movl -0x190(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x190(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x5470
jmp 0x299e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x299d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x59e0
leaq -0x1b0(%rbp), %rdi
callq 0x5470
jmp 0x29a69
jmp 0x299ea
movl -0x194(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x194(%rbp)
jmp 0x298ff
cmpl $0x1, -0x190(%rbp)
jne 0x29a09
jmp 0x29a28
leaq 0x30389(%rip), %rdi     # 0x59d99
leaq 0x30298(%rip), %rsi     # 0x59caf
movl $0xa3, %edx
leaq 0x302f3(%rip), %rcx     # 0x59d16
callq 0x31a0
movq -0x218(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x2dd80
jmp 0x29a3e
leaq -0x40(%rbp), %rdi
callq 0xc120
movq -0x210(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc120
movq -0x88(%rbp), %rdi
callq 0x3480
nop