// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/./runningmaxmin.h
// Function: GilKimmel::computePrefixSuffixMax(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>> const&, int)
void computePrefixSuffixMax(std::vector<floattype> & R,
                                std::vector<floattype> & S,
                                const std::vector<floattype> & array,
                                const int width) {
        for (int j = 0; j < static_cast<int>(array.size()); j += width) {
            const int begin = j;
            const int end = std::min(static_cast<int>(array.size()), j + width);
            const int midpoint = (end - begin + 1) / 2 + begin;
            S[begin] = array[begin];
            for (int jj = begin + 1; jj < midpoint; ++jj) {
                S[jj] = std::max(array[jj], S[jj - 1]);
            }
            R[end - 1] = array[end - 1];
            for (int jj = end - 2; jj >= midpoint; --jj) {
                R[jj] = std::max(R[jj + 1], array[jj]);
            }
            if (std::max(R[midpoint], S[midpoint - 1]) == R[midpoint]) {
                for (int jj = midpoint; jj < end; ++jj)
                    S[jj] = std::max(array[jj], S[jj - 1]);
                for (int jj = midpoint - 1; jj >= begin; --jj)
                    R[jj] = R[midpoint];
            } else {
                for (int jj = midpoint - 1; jj >= begin; --jj)
                    R[jj] = std::max(R[jj + 1], array[jj]);
                for (int jj = midpoint; jj < end; ++jj)
                    S[jj] = S[midpoint - 1];
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rcx), %rdi
movq 0x8(%rcx), %rcx
subq %rdi, %rcx
shrq $0x3, %rcx
movq (%rdx), %r9
movq (%rsi), %rsi
movslq %r8d, %r10
movslq %ecx, %rax
movq %rax, -0x8(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movabsq $0x1, %r11
xorl %r15d, %r15d
movq -0x8(%rsp), %rdx
cmpl %edx, %r8d
movl %ecx, %eax
cmovll %r8d, %eax
cmpq %rdx, %r15
jge 0x4cb2
addl $-0x2, %eax
movslq %eax, %rbp
leaq (%r15,%r10), %r12
cmpl %ecx, %r12d
movl %ecx, %r13d
cmovll %r12d, %r13d
movl %r13d, %eax
subl %r15d, %eax
incl %eax
cltd
movl $0x2, %r14d
idivl %r14d
leal (%rax,%r15), %edx
vmovsd (%rdi,%r15,8), %xmm0
vmovsd %xmm0, (%r9,%r15,8)
movslq %edx, %rdx
movq %r11, %r14
cmpq %rdx, %r14
jge 0x4bec
vmaxsd (%rdi,%r14,8), %xmm0, %xmm0
vmovsd %xmm0, (%r9,%r14,8)
incq %r14
jmp 0x4bd6
movslq %r13d, %r13
vmovsd -0x8(%rdi,%r13,8), %xmm0
vmovsd %xmm0, -0x8(%rsi,%r13,8)
cmpq %rdx, %rbp
jl 0x4c17
vmovsd (%rdi,%rbp,8), %xmm0
vmaxsd 0x8(%rsi,%rbp,8), %xmm0, %xmm0
vmovsd %xmm0, (%rsi,%rbp,8)
decq %rbp
jmp 0x4bfd
vmovsd (%rsi,%rdx,8), %xmm0
vmovsd -0x8(%r9,%rdx,8), %xmm1
vmaxsd %xmm0, %xmm1, %xmm1
vucomisd %xmm0, %xmm1
movslq %eax, %rbp
jne 0x4c69
jp 0x4c69
addq %r15, %rbp
cmpq %r13, %rbp
jge 0x4c51
vmovsd -0x8(%r9,%rbp,8), %xmm0
vmaxsd (%rdi,%rbp,8), %xmm0, %xmm0
vmovsd %xmm0, (%r9,%rbp,8)
incq %rbp
jmp 0x4c35
addl %ebx, %eax
cltq
cmpq %r15, %rax
jl 0x4ca1
vmovsd (%rsi,%rdx,8), %xmm0
vmovsd %xmm0, (%rsi,%rax,8)
decq %rax
jmp 0x4c55
addl %ebx, %eax
cltq
cmpq %r15, %rax
jl 0x4c87
vmovsd (%rdi,%rax,8), %xmm0
vmaxsd 0x8(%rsi,%rax,8), %xmm0, %xmm0
vmovsd %xmm0, (%rsi,%rax,8)
decq %rax
jmp 0x4c6d
addq %rbp, %r15
cmpq %r13, %r15
jge 0x4ca1
vmovsd -0x8(%r9,%rdx,8), %xmm0
vmovsd %xmm0, (%r9,%r15,8)
incq %r15
jmp 0x4c8a
addl %r10d, %r8d
addl %r10d, %ebx
addq %r10, %r11
movq %r12, %r15
jmp 0x4b83
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop