// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movq 0x18(%rdx), %r10
movq (%rdx), %r13
movq 0x8(%rdx), %rbx
movq %r13, %r11
subq %rbx, %r11
sarq $0x4, %r11
movq (%rsi), %r9
movq 0x10(%rsi), %rax
movq %r10, %r8
subq 0x18(%rsi), %r8
shrq $0x3, %r8
cmpq $0x1, %r10
adcq $-0x1, %r8
shlq $0x5, %r8
subq %r9, %rax
sarq $0x4, %rax
addq %r11, %rax
leaq (%r8,%rax), %rdi
testq %rdi, %rdi
jle 0x6722
vmovups 0x10(%rsi), %xmm0
cmpq $0x3, %rdi
jl 0x6742
movq %r9, 0x18(%rsp)
movq %r15, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
vmovsd (%rcx), %xmm1
leaq (%r8,%rax), %r12
addq $-0x2, %r12
movq %r13, 0x10(%rsp)
addq $-0x10, %r13
leaq -0x1(%r11), %rbp
movl $0x1, %eax
xorl %r14d, %r14d
cmpq $0x1f, %rbp
ja 0x6698
movq 0x10(%rdx), %r15
movq %rbx, %r8
movq %r10, %r9
movq %r13, %rcx
jmp 0x66d8
movq %r11, %rcx
subq %rax, %rcx
movq %rbp, %r8
shrq $0x5, %r8
movq %r8, %rdi
movabsq $-0x800000000000000, %r9 # imm = 0xF800000000000000
orq %r9, %rdi
testq %rbp, %rbp
cmovgq %r8, %rdi
leaq (%r10,%rdi,8), %r9
movq (%r9), %r8
leaq 0x200(%r8), %r15
shlq $0x5, %rdi
subq %rdi, %rcx
shlq $0x4, %rcx
addq %r8, %rcx
vmovsd (%rcx), %xmm2
vucomisd %xmm1, %xmm2
ja 0x67e6
incq %rax
leal 0x2(%r14), %ecx
movq %r12, %rdi
sarq %cl, %rdi
incq %r14
decq %r12
addq $-0x10, %r13
decq %rbp
testq %rdi, %rdi
jg 0x6683
negq %r14
movq 0x8(%rsp), %r15
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r9
movq 0x10(%rsp), %r13
jmp 0x6745
vmovups (%rdx), %xmm0
vbroadcastsd 0x10(%rdx), %ymm1
vpinsrq $0x1, %r10, %xmm1, %xmm1
vmovups %xmm0, (%r15)
vmovdqu %xmm1, 0x10(%r15)
jmp 0x67d1
xorl %r14d, %r14d
movq 0x8(%rsi), %rax
addq %r14, %r11
cmpq $0x1f, %r11
ja 0x675f
movq 0x10(%rdx), %rdi
shlq $0x4, %r14
addq %r14, %r13
jmp 0x6799
movq %r11, %rsi
shrq $0x5, %rsi
movabsq $-0x800000000000000, %rdx # imm = 0xF800000000000000
orq %rsi, %rdx
testq %r11, %r11
cmovgq %rsi, %rdx
leaq (%r10,%rdx,8), %r10
movq (%r10), %rbx
leaq 0x200(%rbx), %rdi
shlq $0x5, %rdx
subq %rdx, %r11
shlq $0x4, %r11
addq %rbx, %r11
movq %r11, %r13
vmovq %rax, %xmm1
vmovq %r9, %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 %r13, (%rdx)
movq %rbx, 0x8(%rdx)
movq %rdi, 0x10(%rdx)
movq %r10, 0x18(%rdx)
movq %r15, %rdi
callq 0x6ff4
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
movq 0x8(%rsp), %rbx
movq %rcx, (%rbx)
movq %r8, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq %r9, 0x18(%rbx)
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6dc8
movq %rbx, %rax
jmp 0x67d4