// File: Luthaf[P]zeopp/voro++/src/cell.cc
// Function: voro::voronoicell_base::search_downward(unsigned int&, int&, int&, int&, double&, double&)
inline bool voronoicell_base::search_downward(unsigned int &lw,int &lp,int &ls,int &us,double &l,double &u) {
	int vs;

	// The test point is outside of the cutting space
	for(us=0;us<nu[up];us++) {
		lp=ed[up][us];
		lw=m_test(lp,l);
		if(u>l) break;
	}
	if(us==nu[up]) if(definite_min(lp,us,l,u,lw)) return false;

	while(lw==2) {
		//if(++count>=p) failsafe_find(lp,ls,us,l,u);

		// Test all the neighbors of the current point
		// and find the one which is closest to the
		// plane
		vs=ed[up][nu[up]+us];up=lp;u=l;
		for(us=0;us<nu[up];us++) {
			if(us==vs) continue;
			lp=ed[up][us];
			lw=m_test(lp,l);
			if(u>l) break;
		}
		if(us==nu[up]&&definite_min(lp,us,l,u,lw)) return false;
	}
	ls=ed[up][nu[up]+us];
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq 0x30(%rdx), %rcx
movslq 0x20(%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xf987
movq -0x48(%rbp), %rdi
movq 0x28(%rdi), %rax
movslq 0x20(%rdi), %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl (%rax), %esi
movq -0x38(%rbp), %rdx
callq 0xf860
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0xf978
jmp 0xf987
jmp 0xf97a
movq -0x30(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xf916
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq 0x30(%rdx), %rcx
movslq 0x20(%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xf9cc
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq 0x10(%rbp), %r8
movq -0x18(%rbp), %r9
callq 0x98a0
testb $0x1, %al
jne 0xf9c1
jmp 0xf9ca
movb $0x0, -0x1(%rbp)
jmp 0xfb1c
jmp 0xf9cc
jmp 0xf9ce
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0xfaeb
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rcx
movslq 0x20(%rax), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x30(%rax), %rdx
movslq 0x20(%rax), %rsi
movl (%rdx,%rsi,4), %edx
movq -0x30(%rbp), %rsi
addl (%rsi), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x3c(%rbp)
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0x20(%rax)
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq 0x30(%rdx), %rcx
movslq 0x20(%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xfaa6
movq -0x30(%rbp), %rax
movl (%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0xfa4c
jmp 0xfa99
movq -0x48(%rbp), %rdi
movq 0x28(%rdi), %rax
movslq 0x20(%rdi), %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl (%rax), %esi
movq -0x38(%rbp), %rdx
callq 0xf860
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0xfa97
jmp 0xfaa6
jmp 0xfa99
movq -0x30(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0xfa28
movq -0x48(%rbp), %rdx
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq 0x30(%rdx), %rcx
movslq 0x20(%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xfae6
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq 0x10(%rbp), %r8
movq -0x18(%rbp), %r9
callq 0x98a0
testb $0x1, %al
jne 0xfae0
jmp 0xfae6
movb $0x0, -0x1(%rbp)
jmp 0xfb1c
jmp 0xf9ce
movq -0x48(%rbp), %rdx
movq 0x28(%rdx), %rax
movslq 0x20(%rdx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rdx), %rcx
movslq 0x20(%rdx), %rdx
movl (%rcx,%rdx,4), %ecx
movq -0x30(%rbp), %rdx
addl (%rdx), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)