// File: 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:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movl %r8d, 0xa4(%rsp)
movl $0x0, 0xa0(%rsp)
movl 0xa0(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x3410
movq %rax, %rcx
movl 0x70(%rsp), %eax
cmpl %ecx, %eax
jge 0x99e7
movl 0xa0(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x3410
movl %eax, 0x94(%rsp)
movl 0xa0(%rsp), %eax
addl 0xa4(%rsp), %eax
movl %eax, 0x90(%rsp)
leaq 0x94(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x99f0
movl (%rax), %eax
movl %eax, 0x98(%rsp)
movl 0x98(%rsp), %eax
subl 0x9c(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl 0x9c(%rsp), %eax
movl %eax, 0x8c(%rsp)
movq 0xa8(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0x9fc0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x68(%rsp)
movq 0xb0(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0x3430
vmovsd 0x68(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
movl 0x88(%rsp), %eax
cmpl 0x8c(%rsp), %eax
jge 0x9670
movq 0xa8(%rsp), %rdi
movslq 0x88(%rsp), %rsi
callq 0x9fc0
movq %rax, 0x58(%rsp)
movq 0xb0(%rsp), %rdi
movl 0x88(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x9fe0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x60(%rsp)
movq 0xb0(%rsp), %rdi
movslq 0x88(%rsp), %rsi
callq 0x3430
vmovsd 0x60(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x95dc
movq 0xa8(%rsp), %rdi
movl 0x98(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x9fc0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x50(%rsp)
movq 0xb8(%rsp), %rdi
movl 0x98(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
vmovsd 0x50(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x98(%rsp), %eax
subl $0x2, %eax
movl %eax, 0x84(%rsp)
movl 0x84(%rsp), %eax
cmpl 0x8c(%rsp), %eax
jl 0x975d
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0x9fc0
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x9fe0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x48(%rsp)
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0x3430
vmovsd 0x48(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x84(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x96c9
movq 0xb8(%rsp), %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3430
movq %rax, 0x30(%rsp)
movq 0xb0(%rsp), %rdi
movl 0x8c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x9fe0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x38(%rsp)
movq 0xb8(%rsp), %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3430
vmovsd 0x38(%rsp), %xmm0
vucomisd (%rax), %xmm0
jne 0x98dd
jp 0x98dd
movl 0x8c(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x80(%rsp), %eax
cmpl 0x98(%rsp), %eax
jge 0x9875
movq 0xa8(%rsp), %rdi
movslq 0x80(%rsp), %rsi
callq 0x9fc0
movq %rax, 0x20(%rsp)
movq 0xb0(%rsp), %rdi
movl 0x80(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x9fe0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x28(%rsp)
movq 0xb0(%rsp), %rdi
movslq 0x80(%rsp), %rsi
callq 0x3430
vmovsd 0x28(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0x97e1
movl 0x8c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
cmpl 0x9c(%rsp), %eax
jl 0x98d8
movq 0xb8(%rsp), %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3430
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x18(%rsp)
movq 0xb8(%rsp), %rdi
movslq 0x7c(%rsp), %rsi
callq 0x3430
vmovsd 0x18(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x7c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x9883
jmp 0x99cb
movl 0x8c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x78(%rsp)
movl 0x78(%rsp), %eax
cmpl 0x9c(%rsp), %eax
jl 0x9966
movq 0xb8(%rsp), %rdi
movl 0x78(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
movq %rax, 0x8(%rsp)
movq 0xa8(%rsp), %rdi
movslq 0x78(%rsp), %rsi
callq 0x9fc0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x9fe0
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq 0xb8(%rsp), %rdi
movslq 0x78(%rsp), %rsi
callq 0x3430
vmovsd 0x10(%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x78(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x98eb
movl 0x8c(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
cmpl 0x98(%rsp), %eax
jge 0x99c9
movq 0xb0(%rsp), %rdi
movl 0x8c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x3430
vmovsd (%rax), %xmm0
vmovsd %xmm0, (%rsp)
movq 0xb0(%rsp), %rdi
movslq 0x74(%rsp), %rsi
callq 0x3430
vmovsd (%rsp), %xmm0
vmovsd %xmm0, (%rax)
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x9971
jmp 0x99cb
jmp 0x99cd
movl 0xa4(%rsp), %eax
addl 0xa0(%rsp), %eax
movl %eax, 0xa0(%rsp)
jmp 0x94ea
addq $0xc8, %rsp
retq
nop