// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]Triangulator/src/minfill.cpp
// Function: MinFill::SolveAtom::greedyDegree2(Graph&)
vector<pair<int, int> > greedyDegree2(Graph& G) {
	queue<int> d1;
	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 (!d1.empty() || !d2.empty()) {
		while (!d1.empty()) {
			int x = d1.front();
			d1.pop();
			assert(G.g[x].size() <= 1);
			if (G.g[x].size() == 0) continue;
			int n1 = G.g[x][0];
			G.remEdge(x, n1);
			if (G.g[n1].size() == 1) d1.push(n1);
			if (G.g[n1].size() == 2) d2.push(n1);
		}
		if (!d2.empty()) {
			int x = d2.front();
			d2.pop();
			assert(G.g[x].size() == 0 || G.g[x].size() == 2);
			if (G.g[x].size() == 0) 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);
			}
			G.remEdge(x, n1);
			G.remEdge(x, n2);
			if (G.g[n1].size() == 1) d1.push(n1);
			if (G.g[n1].size() == 2) d2.push(n1);
			if (G.g[n2].size() == 1) d1.push(n2);
			if (G.g[n2].size() == 2) d2.push(n2);
		}
	}
	return sol;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x1b03c
leaq 0x10(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x1b03c
movl $0x0, 0x8(%rsp)
cmpl $0x0, 0x50(%r14)
jle 0x18ab7
xorl %eax, %eax
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movslq %eax, %rcx
movq 0x38(%r14), %rdx
leaq (%rcx,%rcx,2), %rsi
movq 0x8(%rdx,%rsi,8), %rcx
subq (%rdx,%rsi,8), %rcx
cmpq $0x4, %rcx
jbe 0x18eca
cmpq $0x8, %rcx
jne 0x18aa7
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rcx
je 0x18a9c
movl %eax, (%rcx)
addq $0x4, %rcx
movq %rcx, 0x40(%rsp)
jmp 0x18aa7
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b1b2
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cmpl 0x50(%r14), %eax
jl 0x18a58
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
leaq 0x60(%rsp), %r15
leaq 0x10(%rsp), %r13
leaq 0x8(%rsp), %r12
movq 0x70(%rsp), %rax
cmpq %rax, 0x90(%rsp)
je 0x18c2e
movslq (%rax), %rbp
movq 0x80(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x18b01
addq $0x4, %rax
jmp 0x18b3c
movq 0x78(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2210
movq 0x88(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x88(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x80(%rsp)
movq %rax, 0x70(%rsp)
movq 0x38(%r14), %rdx
leaq (,%rbp,2), %rsi
addq %rbp, %rsi
movq (%rdx,%rsi,8), %rcx
movq 0x8(%rdx,%rsi,8), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
cmpq $0x5, %rsi
jae 0x18e8c
cmpq %rcx, %rdx
je 0x18c1e
movl (%rcx), %edx
movl %edx, 0x8(%rsp)
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c0a
movslq 0x8(%rsp), %rcx
movq 0x38(%r14), %rax
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x4, %rsi
jne 0x18bd6
movq 0x90(%rsp), %rdx
movq 0xa0(%rsp), %rsi
addq $-0x4, %rsi
cmpq %rsi, %rdx
je 0x18bc7
movl %ecx, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x90(%rsp)
jmp 0x18bd6
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b1b2
movq 0x38(%r14), %rax
movslq 0x8(%rsp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x8, %rsi
jne 0x18c19
movq 0x40(%rsp), %rax
movq 0x50(%rsp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rax
je 0x18c0e
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x40(%rsp)
jmp 0x18c19
movq %r13, %rdi
movq %r12, %rsi
callq 0x1b1b2
movq 0x70(%rsp), %rax
cmpq %rax, 0x90(%rsp)
jne 0x18ae7
jmp 0x18c3e
movq 0x40(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x18e63
movq 0x20(%rsp), %rax
cmpq %rax, 0x40(%rsp)
je 0x18ad4
movslq (%rax), %rbp
movq 0x30(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x18c65
addq $0x4, %rax
jmp 0x18c97
movq 0x28(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2210
movq 0x38(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movq 0x38(%r14), %rcx
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
movq (%rcx,%rdx,8), %rax
movq 0x8(%rcx,%rdx,8), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
je 0x18ad4
cmpq $0x2, %rcx
jne 0x18eab
movl (%rax), %esi
movl %esi, 0x4(%rsp)
movl 0x4(%rax), %edx
movl %edx, (%rsp)
movq %r14, %rdi
callq 0x9ea6
testb %al, %al
jne 0x18d0c
movl 0x4(%rsp), %eax
movl %eax, 0x8(%rsp)
movl (%rsp), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb2ae
movl 0x4(%rsp), %esi
movl (%rsp), %edx
movq %r14, %rdi
callq 0x9836
movl 0x4(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c0a
movl (%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c0a
movslq 0x4(%rsp), %rcx
movq 0x38(%r14), %rax
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x4, %rsi
jne 0x18d7d
movq 0x90(%rsp), %rdx
movq 0xa0(%rsp), %rsi
addq $-0x4, %rsi
cmpq %rsi, %rdx
je 0x18d6c
movl %ecx, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x90(%rsp)
jmp 0x18d7d
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0x1b1b2
movq 0x38(%r14), %rax
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x8, %rsi
jne 0x18dc6
movq 0x40(%rsp), %rdx
movq 0x50(%rsp), %rsi
addq $-0x4, %rsi
cmpq %rsi, %rdx
je 0x18db5
movl %ecx, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x40(%rsp)
jmp 0x18dc6
movq %r13, %rdi
leaq 0x4(%rsp), %rsi
callq 0x1b1b2
movq 0x38(%r14), %rax
movslq (%rsp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x4, %rsi
jne 0x18e15
movq 0x90(%rsp), %rdx
movq 0xa0(%rsp), %rsi
addq $-0x4, %rsi
cmpq %rsi, %rdx
je 0x18e06
movl %ecx, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x90(%rsp)
jmp 0x18e15
movq %r15, %rdi
movq %rsp, %rsi
callq 0x1b1b2
movq 0x38(%r14), %rax
movslq (%rsp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
cmpq $0x8, %rsi
jne 0x18ad4
movq 0x40(%rsp), %rax
movq 0x50(%rsp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rax
je 0x18e53
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x40(%rsp)
jmp 0x18ad4
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1b1b2
jmp 0x18ad4
leaq 0x10(%rsp), %rdi
callq 0x1abca
leaq 0x60(%rsp), %rdi
callq 0x1abca
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11644(%rip), %rdi     # 0x2a4d7
leaq 0x1127e(%rip), %rsi     # 0x2a118
leaq 0x115f4(%rip), %rcx     # 0x2a495
movl $0x1c1, %edx            # imm = 0x1C1
callq 0x2140
leaq 0x11638(%rip), %rdi     # 0x2a4ea
leaq 0x1125f(%rip), %rsi     # 0x2a118
leaq 0x115d5(%rip), %rcx     # 0x2a495
movl $0x1cb, %edx            # imm = 0x1CB
callq 0x2140
leaq 0x115b2(%rip), %rdi     # 0x2a483
leaq 0x11240(%rip), %rsi     # 0x2a118
leaq 0x115b6(%rip), %rcx     # 0x2a495
movl $0x1b7, %edx            # imm = 0x1B7
callq 0x2140
movq %rax, %r14
jmp 0x18f18
movq %rax, %r14
jmp 0x18f0e
jmp 0x18ef7
jmp 0x18ef7
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x18f0e
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x2210
leaq 0x10(%rsp), %rdi
callq 0x1abca
leaq 0x60(%rsp), %rdi
callq 0x1abca
movq %r14, %rdi
callq 0x2310