// File: Luthaf[P]zeopp/voro++/src/cell.cc
// Function: voro::voronoicell_base::definite_max(int&, int&, double&, double&, unsigned int&)
bool voronoicell_base::definite_max(int &lp,int &ls,double &l,double &u,unsigned int &uw) {
	int tp=lp,ts,qp=0;
	unsigned int qw;
	double q;

	// Check to see whether point up is a well-defined maximum. Otherwise
	// any neighboring vertices of up that are marginal need to be
	// followed, to see if they lead to a better maximum.
	for(ts=0;ts<nu[tp];ts++) {
		qp=ed[tp][ts];
		m_test(qp,q);
		if(q>l-big_tol) break;
	}
	if(ts==nu[tp]) return true;

	// The point tp is marginal, so it will be necessary to do the
	// flood-fill search. Mark the point tp and the point qp, and search
	// any remaining neighbors of the point tp.
	int *stackp=ds+1;
	flip(lp);
	flip(qp);
	*ds=qp;
	ts++;
	while(ts<nu[tp]) {
		qp=ed[tp][ts];
		m_test(qp,q);
		if(q>l-big_tol) {
			if(stackp==stacke) add_memory_ds();
			*(stackp++)=up;
			flip(up);
		}
		ts++;
	}

	// Consider additional marginal points, starting with the original
	// point qp
	int *spp=ds;
	while(spp<stackp) {
		tp=*(spp++);
		for(ts=0;ts<nu[tp];ts++) {
			qp=ed[tp][ts];

			// Skip the point if it's already marked
			if(ed[qp][nu[qp]<<1]<0) continue;
			qw=m_test(qp,q);

			// This point is a better maximum. Reset markers and
			// return true.
			if(q>l) {
				flip(lp);
				lp=tp;
				ls=ts;
				m_test(lp,l);
				up=qp;
				uw=qw;
				u=q;
				while(stackp>ds) flip(*(--stackp));
				return false;
			}

			// The point is marginal and therefore must also be
			// considered
			if(q>l-big_tol) {
				if(stackp==stacke) {
					int nn=stackp-spp;
					add_memory_ds();
					spp=stackp-nn;
				}
				*(stackp++)=qp;
				flip(qp);
			}
		}
	}

	// Reset markers and return false
	flip(lp);
	while(stackp>ds) flip(*(--stackp));
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
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, -0x70(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x70(%rbp), %rcx
movl -0x40(%rbp), %eax
movq 0x30(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x9584
movq -0x70(%rbp), %rdi
movq 0x28(%rdi), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %esi
leaq -0x50(%rbp), %rdx
callq 0xf860
movq -0x70(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm1
subsd 0x58(%rax), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x9577
jmp 0x9584
jmp 0x9579
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x951f
movq -0x70(%rbp), %rcx
movl -0x40(%rbp), %eax
movq 0x30(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x95a1
movb $0x1, -0x1(%rbp)
jmp 0x988f
movq -0x70(%rbp), %rdi
movq 0x78(%rdi), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x15ea0
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x15ea0
movq -0x70(%rbp), %rax
movl -0x44(%rbp), %ecx
movq 0x78(%rax), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x70(%rbp), %rcx
movl -0x40(%rbp), %eax
movq 0x30(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x9680
movq -0x70(%rbp), %rdi
movq 0x28(%rdi), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %esi
leaq -0x50(%rbp), %rdx
callq 0xf860
movq -0x70(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm1
subsd 0x58(%rax), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x9672
movq -0x70(%rbp), %rcx
movq -0x58(%rbp), %rax
cmpq 0x88(%rcx), %rax
jne 0x9652
movq -0x70(%rbp), %rdi
callq 0x6ff0
movq -0x70(%rbp), %rdi
movl 0x20(%rdi), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, (%rax)
movl 0x20(%rdi), %esi
callq 0x15ea0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x95de
movq -0x70(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x9851
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x60(%rbp)
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x70(%rbp), %rcx
movl -0x40(%rbp), %eax
movq 0x30(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x984c
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x40(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movl %eax, -0x44(%rbp)
movq 0x28(%rcx), %rax
movslq -0x44(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movslq -0x44(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shll %ecx
movslq %ecx, %rcx
cmpl $0x0, (%rax,%rcx,4)
jge 0x970e
jmp 0x983e
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
leaq -0x50(%rbp), %rdx
callq 0xf860
movl %eax, -0x48(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0x97bc
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x15ea0
movq -0x70(%rbp), %rdi
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x28(%rbp), %rdx
callq 0xf860
movq -0x70(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, 0x20(%rax)
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movsd -0x50(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x70(%rbp), %rcx
movq -0x58(%rbp), %rax
cmpq 0x78(%rcx), %rax
jbe 0x97b3
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $-0x4, %rcx
movq %rcx, -0x58(%rbp)
movl -0x4(%rax), %esi
callq 0x15ea0
jmp 0x9788
movb $0x0, -0x1(%rbp)
jmp 0x988f
movq -0x70(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rcx
movsd (%rcx), %xmm1
subsd 0x58(%rax), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x983c
movq -0x70(%rbp), %rcx
movq -0x58(%rbp), %rax
cmpq 0x88(%rcx), %rax
jne 0x981c
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, -0x64(%rbp)
callq 0x6ff0
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, (%rax)
movl -0x44(%rbp), %esi
callq 0x15ea0
jmp 0x983e
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x96b5
jmp 0x968c
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x15ea0
movq -0x70(%rbp), %rcx
movq -0x58(%rbp), %rax
cmpq 0x78(%rcx), %rax
jbe 0x988b
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $-0x4, %rcx
movq %rcx, -0x58(%rbp)
movl -0x4(%rax), %esi
callq 0x15ea0
jmp 0x9860
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)