// File: /workspace/github_cpp_makefile_star2_O2/lemire[P]runningmaxmin/./runningmaxmin.h
// Function: simplelemiremaxmin::simplelemiremaxmin(std::vector<double, std::allocator<double>>&, unsigned int)
simplelemiremaxmin(std::vector<floattype> & array, uint width)
        : maxvalues(array.size() - width + 1),
          minvalues(array.size() - width + 1) {
        std::deque<int> maxfifo, minfifo;
        maxfifo.push_back(0);
        minfifo.push_back(0);
        for (uint i = 1; i < width; ++i) {
            if (array[i] > array[i - 1]) { // overshoot
                maxfifo.pop_back();
                while (!maxfifo.empty()) {
                    if (array[i] <= array[maxfifo.back()])
                        break;
                    maxfifo.pop_back();
                }
            } else {
                minfifo.pop_back();
                while (!minfifo.empty()) {
                    if (array[i] >= array[minfifo.back()])
                        break;
                    minfifo.pop_back();
                }
            }
            maxfifo.push_back(i);
            minfifo.push_back(i);
        }
        for (uint i = width; i < array.size(); ++i) {
            maxvalues[i - width] = array[maxfifo.front()];
            minvalues[i - width] = array[minfifo.front()];
            if (array[i] > array[i - 1]) { // overshoot
                maxfifo.pop_back();
                while (!maxfifo.empty()) {
                    if (array[i] <= array[maxfifo.back()])
                        break;
                    maxfifo.pop_back();
                }
            } else {
                minfifo.pop_back();
                while (!minfifo.empty()) {
                    if (array[i] >= array[minfifo.back()])
                        break;
                    minfifo.pop_back();
                }
            }
            maxfifo.push_back(i);
            minfifo.push_back(i);
            if (i == width + maxfifo.front())
                maxfifo.pop_front();
            else if (i == width + minfifo.front())
                minfifo.pop_front();
        }
        maxvalues[array.size() - width] = array[maxfifo.front()];
        minvalues[array.size() - width] = array[minfifo.front()];
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x7950(%rip), %rax      # 0xac50
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x8, %rdi
movq 0x8(%rsi), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movl %edx, 0xc(%rsp)
movl %edx, %r14d
subq %r14, %rsi
incq %rsi
leaq 0x28(%rsp), %rdx
movq %rdi, 0x18(%rsp)
callq 0x4392
movq 0x8(%r15), %rsi
subq (%r15), %rsi
addq $0x20, %rbx
sarq $0x3, %rsi
movq %r14, 0x20(%rsp)
subq %r14, %rsi
incq %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
callq 0x4392
leaq 0x28(%rsp), %rdi
callq 0x44a8
leaq 0x78(%rsp), %rdi
callq 0x44a8
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0x28(%rsp), %rdi
callq 0x46b0
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0x78(%rsp), %rdi
callq 0x46b0
pushq $0x1
popq %r14
leaq 0x28(%rsp), %r12
movl $0x200, %ebp            # imm = 0x200
leaq 0x8(%rsp), %rbx
leaq 0x78(%rsp), %r13
cmpq 0x20(%rsp), %r14
jae 0x3477
movq (%r15), %rax
vmovsd (%rax,%r14,8), %xmm0
vucomisd -0x8(%rax,%r14,8), %xmm0
jbe 0x3408
movq %r12, %rdi
callq 0x4472
movq 0x58(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x344f
cmpq 0x60(%rsp), %rax
jne 0x33f2
movq 0x70(%rsp), %rax
movq -0x8(%rax), %rax
addq %rbp, %rax
movq (%r15), %rcx
movslq -0x4(%rax), %rax
vmovsd (%rcx,%rax,8), %xmm0
vucomisd (%rcx,%r14,8), %xmm0
jb 0x33cb
jmp 0x344f
movq %r13, %rdi
callq 0x4472
movq 0xa8(%rsp), %rax
cmpq 0x88(%rsp), %rax
je 0x344f
cmpq 0xb0(%rsp), %rax
jne 0x343b
movq 0xc0(%rsp), %rax
movq -0x8(%rax), %rax
addq %rbp, %rax
movq (%r15), %rcx
vmovsd (%rcx,%r14,8), %xmm0
movslq -0x4(%rax), %rax
vucomisd (%rcx,%rax,8), %xmm0
jb 0x3408
movl %r14d, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x46b0
movl %r14d, 0x8(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x46b0
incq %r14
jmp 0x33ae
movl $0x200, %r14d           # imm = 0x200
movl 0xc(%rsp), %eax
movl %eax, %ebx
movl %ebx, %ebp
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq 0x38(%rsp), %rdx
movslq (%rdx), %rdx
vmovsd (%rax,%rdx,8), %xmm0
cmpq %rbp, %rcx
jbe 0x35c0
movl %ebx, %ecx
subl 0xc(%rsp), %ecx
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
vmovsd %xmm0, (%rdx,%rcx,8)
movq 0x88(%rsp), %rdx
movslq (%rdx), %rdx
vmovsd (%rax,%rdx,8), %xmm0
movq 0x10(%rsp), %rdx
movq (%rdx), %rdx
vmovsd %xmm0, (%rdx,%rcx,8)
vmovsd (%rax,%rbp,8), %xmm0
leal -0x1(%rbx), %ecx
vucomisd (%rax,%rcx,8), %xmm0
jbe 0x3524
movq %r12, %rdi
callq 0x4472
movq 0x58(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x356a
cmpq 0x60(%rsp), %rax
jne 0x350f
movq 0x70(%rsp), %rax
movq -0x8(%rax), %rax
addq %r14, %rax
movq (%r15), %rcx
movslq -0x4(%rax), %rax
vmovsd (%rcx,%rax,8), %xmm0
vucomisd (%rcx,%rbp,8), %xmm0
jb 0x34e8
jmp 0x356a
movq %r13, %rdi
callq 0x4472
movq 0xa8(%rsp), %rax
cmpq 0x88(%rsp), %rax
je 0x356a
cmpq 0xb0(%rsp), %rax
jne 0x3557
movq 0xc0(%rsp), %rax
movq -0x8(%rax), %rax
addq %r14, %rax
movq (%r15), %rcx
vmovsd (%rcx,%rbp,8), %xmm0
movslq -0x4(%rax), %rax
vucomisd (%rcx,%rax,8), %xmm0
jb 0x3524
movl %ebx, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rbp
movq %rbp, %rsi
callq 0x46b0
movl %ebx, 0x8(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x46b0
movq 0x38(%rsp), %rax
movl (%rax), %eax
addl 0xc(%rsp), %eax
movq %r12, %rdi
cmpl %eax, %ebx
je 0x35b4
movq 0x88(%rsp), %rax
movl (%rax), %eax
addl 0xc(%rsp), %eax
movq %r13, %rdi
cmpl %eax, %ebx
jne 0x35b9
callq 0x4454
incl %ebx
jmp 0x3483
subq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
vmovsd %xmm0, (%rdx,%rcx,8)
leaq 0x78(%rsp), %rdi
movq 0x10(%rdi), %rdx
movslq (%rdx), %rdx
vmovsd (%rax,%rdx,8), %xmm0
movq 0x10(%rsp), %rax
movq (%rax), %rax
vmovsd %xmm0, (%rax,%rcx,8)
callq 0x4942
leaq 0x28(%rsp), %rdi
callq 0x4942
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x362a
jmp 0x362a
movq %rax, %rbx
jmp 0x3637
movq %rax, %rbx
jmp 0x3641
movq %rax, %rbx
jmp 0x364b
jmp 0x362a
jmp 0x362a
jmp 0x362a
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4942
leaq 0x28(%rsp), %rdi
callq 0x4942
movq 0x10(%rsp), %rdi
callq 0x60f0
movq 0x18(%rsp), %rdi
callq 0x60f0
movq %rbx, %rdi
callq 0x2160
nop