// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]Triangulator/src/minfill.cpp
// Function: MinFill::SolveAtom::findCycle2(Graph const&, int, int, std::vector<int, std::allocator<int>>&)
vector<int> findCycle2(const Graph& G, int x, int y, vector<int>& removedFromB) {
	int bfsBack = 0;
	int tmpBack = 0;
	bfs[bfsBack++] = y;
	d[y] = 1;
	int i2 = 1;
	for (int ny : G.g[y]) {
		if (!del1[ny] && !removedFromB[ny]) {
			d[ny] = 1;
			from[ny] = y;
			bfs[bfsBack++] = ny;
		}
		else if (ny != x) {
			d[ny] = 1;
			tmp[tmpBack++] = ny;
		}
	}
	bool fo = false;
	while (i2 < bfsBack) {
		int t = bfs[i2++];
		for (int nt : G.g[t]) {
			if (d[nt]) continue;
			if (del1[nt]) continue;
			if (nt == x) {
				fo = true;
				from[x] = t;
				bfs[bfsBack++] = nt;
				break;
			}
			d[nt] = d[t]+1;
			from[nt] = t;
			bfs[bfsBack++] = nt;
		}
		if (fo) break;
	}
	vector<int> ret;
	if (fo) {
		while (x != y) {
			ret.push_back(x);
			x = from[x];
		}
		ret.push_back(y);
	}
	for (int i = 0; i < bfsBack; i++) {
		d[bfs[i]] = 0;
		from[bfs[i]] = 0;
	}
	for (int i = 0; i < tmpBack; i++) {
		d[tmp[i]] = 0;
		from[tmp[i]] = 0;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl %ecx, 0x575922(%rip)    # 0x58c570
movl %ecx, 0x4(%rsp)
movslq %ecx, %rcx
leaq 0x4e3154(%rip), %r15    # 0x4f9db0
movl $0x1, (%r15,%rcx,4)
movq 0x38(%rsi), %rax
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rsi
movq 0x8(%rax,%rcx,8), %r9
cmpq %r9, %rsi
movq %rdi, 0x8(%rsp)
je 0x16d89
movq (%r8), %r8
xorl %r12d, %r12d
movl $0x1, %r13d
leaq 0x4b23da(%rip), %rcx    # 0x4c9070
leaq 0x5758d3(%rip), %rdi    # 0x58c570
leaq 0x5a660c(%rip), %r10    # 0x5bd2b0
movl (%rsi), %r11d
movslq %r11d, %rbx
cmpl $0x0, (%rcx,%rbx,4)
jne 0x16cb7
cmpl $0x0, (%r8,%rbx,4)
je 0x16cd4
cmpl %edx, %r11d
je 0x16cff
movl $0x1, (%r15,%rbx,4)
movl %r12d, %ebx
leal 0x1(%r12), %ebp
movq %r10, %r14
movl %ebp, %r12d
jmp 0x16cf8
movl $0x1, (%r15,%rbx,4)
movl 0x4(%rsp), %ebp
leaq 0x513e09(%rip), %r14    # 0x52aaf0
movl %ebp, (%r14,%rbx,4)
movl %r13d, %ebx
leal 0x1(%r13), %ebp
movq %rdi, %r14
movl %ebp, %r13d
movslq %ebx, %rbx
movl %r11d, (%r14,%rbx,4)
addq $0x4, %rsi
cmpq %r9, %rsi
jne 0x16ca4
cmpl $0x2, %r13d
jl 0x16d82
movl $0x1, %edi
leaq 0x575856(%rip), %rsi    # 0x58c570
movl (%rsi,%rdi,4), %r8d
movslq %r8d, %r9
leaq (%r9,%r9,2), %r11
movq (%rax,%r11,8), %r10
movq 0x8(%rax,%r11,8), %r11
cmpq %r11, %r10
je 0x16d77
movl (%r10), %r14d
movslq %r14d, %rbp
cmpl $0x0, (%r15,%rbp,4)
jne 0x16d71
cmpl $0x0, (%rcx,%rbp,4)
jne 0x16d71
movslq %r13d, %rbx
cmpl %edx, %r14d
je 0x16e1a
movl (%r15,%r9,4), %r13d
incl %r13d
movl %r13d, (%r15,%rbp,4)
leaq 0x513d8c(%rip), %r13    # 0x52aaf0
movl %r9d, (%r13,%rbp,4)
leal 0x1(%rbx), %r13d
movl %r14d, (%rsi,%rbx,4)
addq $0x4, %r10
jmp 0x16d2e
incq %rdi
movslq %r13d, %r8
cmpq %r8, %rdi
jl 0x16d1a
movq 0x8(%rsp), %rdi
jmp 0x16d92
movl $0x1, %r13d
xorl %r12d, %r12d
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
testl %r13d, %r13d
jle 0x16dd3
movl %r13d, %eax
shlq $0x2, %rax
xorl %ecx, %ecx
leaq 0x5757bb(%rip), %rdx    # 0x58c570
leaq 0x513d34(%rip), %rsi    # 0x52aaf0
xorl %edi, %edi
movslq (%rdi,%rdx), %r8
movl %ecx, (%r15,%r8,4)
movl %ecx, (%rsi,%r8,4)
addq $0x4, %rdi
cmpq %rdi, %rax
jne 0x16dbe
testl %r12d, %r12d
movq 0x8(%rsp), %rax
jle 0x16e0b
movl %r12d, %r9d
shlq $0x2, %r9
xorl %ecx, %ecx
leaq 0x5a64c3(%rip), %rdx    # 0x5bd2b0
leaq 0x513cfc(%rip), %rsi    # 0x52aaf0
xorl %edi, %edi
movslq (%rdi,%rdx), %r8
movl %ecx, (%r15,%r8,4)
movl %ecx, (%rsi,%r8,4)
addq $0x4, %rdi
cmpq %rdi, %r9
jne 0x16df6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %edx, %rax
leaq 0x513ccc(%rip), %rcx    # 0x52aaf0
movl %r8d, (%rcx,%rax,4)
leal 0x1(%rbx), %r13d
movl %edx, (%rsi,%rbx,4)
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
cmpl 0x4(%rsp), %edx
jne 0x16e4c
xorl %esi, %esi
jmp 0x16eaa
leaq 0x10(%rsp), %rbx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x16e67
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x16e6f
movq %rbx, %rdx
callq 0x92c4
movslq 0x10(%rsp), %rax
leaq 0x513c75(%rip), %rcx    # 0x52aaf0
movl (%rcx,%rax,4), %edx
movl %edx, 0x10(%rsp)
cmpl 0x4(%rsp), %edx
movq 0x8(%rsp), %rdi
jne 0x16e51
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x16eaa
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x16da0
leaq 0x14(%rsp), %rdx
callq 0x92c4
jmp 0x16da0
jmp 0x16ebb
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x16edc
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x2210
movq %r14, %rdi
callq 0x2310