// File: Laakeri[P]Triangulator/src/treewidth.cpp
// Function: TreeWidth::SolveAtom::greedyDegree2(Graph&)
vector<pair<int, int> > greedyDegree2(Graph& G) {
	queue<int> d2;
	for (int i = 0; i < G.n; i++) {
		assert(G.g[i].size() > 1);
		if (G.g[i].size() == 2) {
			d2.push(i);
		}
	}
	vector<pair<int, int> > sol;
	while (!d2.empty()) {
		int x = d2.front();
		d2.pop();
		if (G.g[x].size() != 2) continue;
		int n1 = G.g[x][0];
		int n2 = G.g[x][1];
		if (!G.hasEdge(n1, n2)) {
			sol.push_back({n1, n2});
			G.addEdge(n1, n2);
		}
	}
	return sol;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x37340
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x56185
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x64(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
callq 0x59a0
cmpq $0x1, %rax
jbe 0x56115
jmp 0x56134
leaq 0x4337(%rip), %rdi      # 0x5a453
leaq 0x51dd(%rip), %rsi      # 0x5b300
movl $0x35, %edx
leaq 0x5240(%rip), %rcx      # 0x5b36f
callq 0x31a0
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x64(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
callq 0x59a0
cmpq $0x2, %rax
jne 0x56175
leaq -0x60(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0x37370
jmp 0x56162
jmp 0x56175
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x56304
jmp 0x56177
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x560e4
movq -0xa0(%rbp), %rdi
movb $0x0, -0x75(%rbp)
callq 0xbd50
leaq -0x60(%rbp), %rdi
callq 0x373a0
movb %al, -0xa1(%rbp)
jmp 0x561a6
movb -0xa1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x561b7
jmp 0x562d5
leaq -0x60(%rbp), %rdi
callq 0x373c0
movq %rax, -0xb0(%rbp)
jmp 0x561c9
movq -0xb0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x373e0
jmp 0x561e0
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
callq 0x59a0
cmpq $0x2, %rax
je 0x5621e
jmp 0x56195
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
callq 0x5470
jmp 0x56304
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x178f0
movl (%rax), %eax
movl %eax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x178a0
movq %rax, %rdi
movl $0x1, %esi
callq 0x178f0
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
movl -0x80(%rbp), %esi
movl -0x84(%rbp), %edx
callq 0x16400
movb %al, -0xb1(%rbp)
jmp 0x56280
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x562d0
jmp 0x5628c
leaq -0x8c(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x84(%rbp), %rdx
callq 0xdfc0
jmp 0x562a5
movq -0xa0(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0x179a0
jmp 0x562ba
movq -0x10(%rbp), %rdi
movl -0x80(%rbp), %esi
movl -0x84(%rbp), %edx
callq 0x15830
jmp 0x562ce
jmp 0x562d0
jmp 0x56195
movb $0x1, -0x75(%rbp)
testb $0x1, -0x75(%rbp)
jne 0x562eb
movq -0xa0(%rbp), %rdi
callq 0x5470
leaq -0x60(%rbp), %rdi
callq 0x37400
movq -0x98(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x37400
movq -0x70(%rbp), %rdi
callq 0x3480
nopw %cs:(%rax,%rax)