// File: /workspace/github_cpp_makefile_star2_O3/lemire[P]runningmaxmin/./mono_wedge.h
// Function: std::_Deque_iterator<Sample, Sample&, Sample*> mono_wedge::mono_wedge_search<std::_Deque_iterator<Sample, Sample&, Sample*>, Sample, std::greater<Sample>>(std::_Deque_iterator<Sample, Sample&, Sample*>, std::_Deque_iterator<Sample, Sample&, Sample*>, Sample const&, std::greater<Sample>)
Iterator mono_wedge_search(
		Iterator begin,
		Iterator end,
		const T &value,
		Compare  comp)
	{
		long size = long(end - begin);
		if (size <= 0) return end;

		// Linear search through at most J elements, J = log2(N-J).
		long i = 1;
		for (; ((size-i) >> i) > 0; ++i)
		{
			// If you get a compile error here, your Wedge type does not
			//   support random-access iterators and should be changed!
			Iterator test = end-i;
			if (comp(*test, value)) return test+1;
		}

		// Defer to lower_bound for binary search.
		return std::lower_bound<Iterator, T, Compare>(begin, end-(i-1), value, comp);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x18(%rdx), %rdi
movq (%rdx), %r12
movq 0x8(%rdx), %rax
movq %r12, %r11
subq %rax, %r11
sarq $0x4, %r11
movq (%rsi), %r15
movq 0x10(%rsi), %r14
movq %rdi, %r8
subq 0x18(%rsi), %r8
shrq $0x3, %r8
cmpq $0x1, %rdi
adcq $-0x1, %r8
shlq $0x5, %r8
subq %r15, %r14
sarq $0x4, %r14
addq %r11, %r14
leaq (%r8,%r14), %r10
testq %r10, %r10
jle 0x6897
vmovups 0x10(%rsi), %xmm0
movq 0x10(%rdx), %r9
cmpq $0x3, %r10
jb 0x68b5
movq %r15, 0x18(%rsp)
movq %rbx, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
vmovsd (%rcx), %xmm1
leaq (%r8,%r14), %r15
addq $-0x2, %r15
movq %r12, 0x10(%rsp)
addq $-0x10, %r12
leaq -0x1(%r11), %rbx
movl $0x1, %ebp
xorl %edx, %edx
testq %rbx, %rbx
js 0x682c
movq %rax, %r10
movq %r9, %r14
movq %rdi, %rcx
movq %r12, %r8
cmpq $0x20, %rbx
jb 0x6855
movq %rbx, %r13
shrq $0x5, %r13
jmp 0x6833
movq %rbx, %r13
sarq $0x5, %r13
movq %r11, %r8
subq %rbp, %r8
leaq (%rdi,%r13,8), %rcx
movq (%rcx), %r10
leaq 0x200(%r10), %r14
shlq $0x5, %r13
subq %r13, %r8
shlq $0x4, %r8
addq %r10, %r8
vmovsd (%r8), %xmm2
vucomisd %xmm1, %xmm2
ja 0x68db
incq %rbp
leal 0x2(%rdx), %ecx
movq %r15, %r8
sarq %cl, %r8
incq %rdx
decq %r15
addq $-0x10, %r12
decq %rbx
testq %r8, %r8
jg 0x680c
negq %rdx
movq 0x8(%rsp), %rbx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r12
jmp 0x68b7
vmovups (%rdx), %xmm0
vbroadcastsd 0x10(%rdx), %ymm1
vpinsrq $0x1, %rdi, %xmm1, %xmm1
vmovups %xmm0, (%rbx)
vmovdqu %xmm1, 0x10(%rbx)
jmp 0x6959
xorl %edx, %edx
movq 0x8(%rsi), %rsi
addq %rdx, %r11
js 0x68d2
cmpq $0x1f, %r11
ja 0x68fe
shlq $0x4, %rdx
addq %rdx, %r12
movq %r12, %r11
jmp 0x6921
movq %r11, %rdx
sarq $0x5, %rdx
jmp 0x6905
movq 0x8(%rsp), %rbx
movq %r8, (%rbx)
movq %r10, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6f7e
jmp 0x6959
movq %r11, %rdx
shrq $0x5, %rdx
leaq (%rdi,%rdx,8), %rdi
movq (%rdi), %rax
leaq 0x200(%rax), %r9
shlq $0x5, %rdx
subq %rdx, %r11
shlq $0x4, %r11
addq %rax, %r11
vmovq %rsi, %xmm1
vmovq %r15, %xmm2
vpunpcklqdq %xmm1, %xmm2, %xmm1 # xmm1 = xmm2[0],xmm1[0]
leaq 0x48(%rsp), %rsi
vmovups %xmm0, 0x10(%rsi)
vmovdqu %xmm1, (%rsi)
leaq 0x28(%rsp), %rdx
movq %r11, (%rdx)
movq %rax, 0x8(%rdx)
movq %r9, 0x10(%rdx)
movq %rdi, 0x18(%rdx)
movq %rbx, %rdi
callq 0x71a1
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq