// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl 0x50(%rsi), %eax
movq %rdx, 0x78(%rsp)
cmpl 0x50(%rdx), %eax
jne 0xeb26
movq %rcx, %r12
movq %rsi, %rbp
xorl %ecx, %ecx
leaq 0x2cd43a(%rip), %r8     # 0x2dbbe0
leaq 0x2fe173(%rip), %r14    # 0x30c920
xorl %edx, %edx
movslq %eax, %rsi
cmpq %rsi, %rdx
jge 0xe7d8
leaq 0x29c6e2(%rip), %rax    # 0x2aaea0
andl $0x0, (%rcx,%rax)
andl $0x0, (%rcx,%r8)
andl $0x0, (%rcx,%r14)
incq %rdx
movl 0x50(%rbp), %eax
addq $0x4, %rcx
jmp 0xe7af
movq %r8, 0x48(%rsp)
movq %rdi, 0x68(%rsp)
leaq 0x50(%rsp), %rcx
andq $0x0, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
xorl %edx, %edx
leaq 0x80(%rsp), %rbx
leaq 0xa0(%rsp), %r13
movl $0x0, 0x8(%rsp)
movq %rbp, 0x70(%rsp)
movq %r12, 0x38(%rsp)
movslq %eax, %rcx
cmpq %rcx, %rdx
jge 0xea66
movq 0x18(%r12), %rax
cmpl $0x0, 0x4(%rax,%rdx,8)
je 0xea49
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %rdx, 0x40(%rsp)
movslq (%rax,%rdx,8), %rax
movq 0x78(%rsp), %rcx
movq 0x38(%rcx), %rcx
imulq $0x18, %rax, %rax
movq (%rcx,%rax), %r15
movq 0x8(%rcx,%rax), %r12
cmpq %r12, %r15
je 0xe88e
movslq (%r15), %rax
movl %eax, 0xa0(%rsp)
leaq 0x29c62b(%rip), %rcx    # 0x2aaea0
cmpl $0x0, (%rcx,%rax,4)
jne 0xe888
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x6402
addq $0x4, %r15
jmp 0xe85f
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rax, %rdx
movq 0x38(%rsp), %r12
cmpq %rcx, %rdx
je 0xe8b6
movslq (%rdx), %rsi
movl $0x1, (%r14,%rsi,4)
addq $0x4, %rdx
jmp 0xe8a0
movq 0x38(%rbp), %rdx
movq %rcx, %rsi
subq %rax, %rsi
shrq $0x2, %rsi
movq %rsi, 0x30(%rsp)
leal -0x1(%rsi), %edi
xorl %esi, %esi
movq %rax, %r8
cmpq %rcx, %r8
je 0xe910
movslq (%r8), %r9
imulq $0x18, %r9, %r10
movq (%rdx,%r10), %r9
movq 0x8(%rdx,%r10), %r11
xorl %r10d, %r10d
cmpq %r11, %r9
je 0xe900
movslq (%r9), %r15
cmpl $0x1, (%r14,%r15,4)
sbbl $-0x1, %r10d
addq $0x4, %r9
jmp 0xe8e9
cmpl %edi, %r10d
setl %r9b
orb %r9b, %sil
addq $0x4, %r8
jmp 0xe8d1
testb $0x1, %sil
je 0xe924
movl 0x8(%rsp), %edx
movq %rdx, 0x30(%rsp)
jmp 0xea27
movq 0x30(%rsp), %rcx
incl %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
cmovgl %eax, %ecx
movq %rcx, 0x30(%rsp)
andq $0x0, 0x90(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq 0x18(%r12), %rax
movq 0x40(%rsp), %rcx
movl (%rax,%rcx,8), %edi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xe68f
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
xorl %r12d, %r12d
pushq $0x1
popq %rbp
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movslq %edx, %rdx
cmpq %rdx, %r12
jge 0xe9dd
leaq 0x1(%r12), %rdx
movq %rdx, 0x8(%rsp)
movq %rbp, %r15
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
cmpl %edx, %r15d
jge 0xe9d3
movl (%rax,%r12,4), %ecx
movl %ecx, 0xa0(%rsp)
movl (%rax,%r15,4), %eax
movl %eax, 0xa4(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x92ce
incq %r15
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
jmp 0xe994
incq %rbp
movq 0x8(%rsp), %r12
jmp 0xe975
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7b04
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x109b4
movq 0x70(%rsp), %rbp
movq 0x38(%rsp), %r12
movq %r13, %rdi
callq 0x36d2
movq %rbx, %rdi
callq 0x3bfe
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
jmp 0xea27
movslq (%rax), %rdx
andl $0x0, (%r14,%rdx,4)
addq $0x4, %rax
cmpq %rcx, %rax
jne 0xea1b
leaq 0x10(%rsp), %rdi
callq 0x38e4
movq 0x18(%r12), %rax
movq 0x30(%rsp), %rcx
movl %ecx, 0x8(%rsp)
movq 0x40(%rsp), %rdx
movslq (%rax,%rdx,8), %rax
leaq 0x29c44c(%rip), %rcx    # 0x2aaea0
movl $0x1, (%rcx,%rax,4)
incq %rdx
movl 0x50(%rbp), %eax
jmp 0xe816
movq %rbp, %r15
xorl %ebx, %ebx
leaq 0x10(%rsp), %rbp
leaq 0xa0(%rsp), %r12
leaq 0x50(%rsp), %r13
xorl %r14d, %r14d
movslq %eax, %rcx
cmpq %rcx, %rbx
jge 0xeae5
movq 0x48(%rsp), %rcx
cmpl $0x0, (%rcx)
jne 0xeada
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movl %ebx, %edi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xe68f
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7b04
movq %r13, %rdi
movq %r12, %rsi
callq 0x109b4
movq %r12, %rdi
callq 0x36d2
incl %r14d
movq %rbp, %rdi
callq 0x3bfe
movl 0x50(%r15), %eax
incq %rbx
addq $0x4, 0x48(%rsp)
jmp 0xea80
cmpl $0x1, %r14d
jne 0xeb43
movq 0x68(%rsp), %rbx
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x50(%rsp), %rsi
callq 0x10854
leaq 0x50(%rsp), %rdi
callq 0x52ce
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1220a(%rip), %rdi     # 0x20d37
leaq 0x121ab(%rip), %rsi     # 0x20cdf
leaq 0x1220b(%rip), %rcx     # 0x20d46
pushq $0x6c
popq %rdx
callq 0x2150
leaq 0x1227f(%rip), %rdi     # 0x20dc9
leaq 0x1218e(%rip), %rsi     # 0x20cdf
leaq 0x121ee(%rip), %rcx     # 0x20d46
movl $0xa3, %edx
callq 0x2150
movq %rax, %rbx
jmp 0xebbf
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x36d2
jmp 0xeba8
jmp 0xeba5
jmp 0xeba5
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x36d2
jmp 0xeb94
jmp 0xeb91
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3bfe
jmp 0xebbf
movq %rax, %rbx
jmp 0xebb5
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3bfe
leaq 0x10(%rsp), %rdi
callq 0x38e4
leaq 0x50(%rsp), %rdi
callq 0x52ce
movq %rbx, %rdi
callq 0x2340