// File: /workspace/github_cpp_makefile_star2_O3/lemire[P]runningmaxmin/runningmaxmin.cpp
// Function: main
int main(int params, char ** args) {
    int whitesize = 0;
    int walksize = 0;
    int times = 1;
    int sinesize = 0;
    floattype sineperiod = 0.0;
    int windowbegin = 10;
    int windowend = 11;
    bool doslow = true;
    bool cininput = false;
    std::vector<floattype> data(0);
    for (int i = 1; i < params; ++i) {
        if (strcmp(args[i], "--skipslow") == 0) {
            doslow = false;
        }
        if (strcmp(args[i], "--pipedata") == 0) {
            cininput = true;
        }
        if (strcmp(args[i], "--unit") == 0) {
            std::cout << "OK " << std::endl;
            return 0;
        }
        if (strcmp(args[i], "--window") == 0) {
            if (params - i > 1) {
                windowbegin = atoi(args[++i]);
                windowend = windowbegin + 1;
            } else {
                std::cerr << "--window expects an integer (length)"
                          << std::endl;
                return -1;
            }
            continue;
        }
        if (strcmp(args[i], "--windowrange") == 0) {
            if (params - i > 2) {
                windowbegin = atoi(args[++i]);
                windowend = atoi(args[++i]) + 1;
            } else {
                std::cerr << "--windowrange expects two integers (length)"
                          << std::endl;
                return -1;
            }
            continue;
        }
        if (strcmp(args[i], "--white") == 0) {
            if (params - i > 1)
                whitesize = atoi(args[++i]);
            else {
                std::cerr << "--white expects an integer (length)" << std::endl;
                return -1;
            }
            continue;
        }
        if (strcmp(args[i], "--walk") == 0) {
            if (params - i > 1)
                walksize = atoi(args[++i]);
            else {
                std::cerr << "--walk expects an integer (length)" << std::endl;
                return -1;
            }
            continue;
        }
        if (strcmp(args[i], "--sine") == 0) {
            if (params - i > 1)
                sinesize = atoi(args[++i]);
            else {
                std::cerr << "--sine expects an integer (length)" << std::endl;
                return -1;
            }
            if (params - i > 1)
                sineperiod = atof(args[++i]);
            else {
                std::cerr << "--sine expects an integer (length) followed by a "
                             "float (freq) "
                          << std::endl;
                return -1;
            }
            continue;
        }
        if (strcmp(args[i], "--times") == 0) {
            if (params - i > 1)
                times = atoi(args[++i]);
            else {
                std::cerr << "--times expects an integer" << std::endl;
                return -1;
            }
            continue;
        }
    }
    std::cout << "# we report timings (in seconds) so lower is better" << std::endl;
    for (int window = windowbegin; window < windowend; ++window) {
        if (whitesize > 0) {
            std::cout << "# window = " << window << " whitesize = " << whitesize
                      << " times = " << times << " doslow = " << doslow
                      << std::endl;
            assert(window + 1 < whitesize);
            timings(window, whitesize, times, doslow);
        } else if (walksize > 0) {
            std::cout << "# window = " << window << " walksize = " << walksize
                      << " times = " << times << " doslow = " << doslow
                      << std::endl;
            walktimings(window, walksize, times, doslow);

        } else if (sinesize > 0) {
            std::cout << "# window = " << window << " sinesize = " << sinesize
                      << " sine period " << sineperiod << " times = " << times
                      << " doslow = " << doslow << std::endl;
            assert(window + 1 < sinesize);
            sinetimings(window, sinesize, sineperiod, times, doslow);
        } else {
            if ((data.empty()) && cininput) {
                data = getcin();
                std::cout << "# window = " << window << " times = " << times
                          << " doslow = " << doslow << std::endl;
                process(data, window, times, doslow);
            } else {
                std::cout << "Generating sine waves." << std::endl;
                for (uint width = 3; width <= 100; ++width) {
                    std::cout << "Using a min/max width of " << width
                              << std::endl;
                    sinetimings(width);
                }
            }
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
vxorps %xmm0, %xmm0, %xmm0
vmovaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpl $0x2, %edi
jl 0x3851
movq %rsi, %rbp
movl $0x0, 0x14(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovsd %xmm0, 0x28(%rsp)
movl $0xa, %ebx
movl $0xb, 0x10(%rsp)
movb $0x1, %r14b
movl $0x1, %r15d
movl $0x0, 0x8(%rsp)
movl $0x1, (%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x24(%rsp)
movq %rbx, 0x18(%rsp)
movl %edi, %ebx
movslq %r15d, %r13
movq %rbp, %r12
movq (%rbp,%r13,8), %rbp
movq %rbp, %rdi
leaq 0x5ae2(%rip), %rsi      # 0x9124
callq 0x2190
testl %eax, %eax
movzbl %r14b, %r14d
cmovel %eax, %r14d
movq %rbp, %rdi
leaq 0x5ad4(%rip), %rsi      # 0x912f
callq 0x2190
testl %eax, %eax
sete 0x7(%rsp)
movq %rbp, %rdi
leaq 0x5ac9(%rip), %rsi      # 0x913a
callq 0x2190
testl %eax, %eax
je 0x3da0
movq %rbp, %rdi
leaq 0x5abd(%rip), %rsi      # 0x9145
callq 0x2190
testl %eax, %eax
je 0x370e
movq %rbp, %rdi
leaq 0x5ad8(%rip), %rsi      # 0x9173
callq 0x2190
testl %eax, %eax
je 0x3732
movq %rbp, %rdi
leaq 0x5afb(%rip), %rsi      # 0x91ad
callq 0x2190
testl %eax, %eax
je 0x376e
movq %rbp, %rdi
leaq 0x5b10(%rip), %rsi      # 0x91d9
callq 0x2190
testl %eax, %eax
je 0x3797
movq %rbp, %rdi
leaq 0x5b23(%rip), %rsi      # 0x9203
callq 0x2190
testl %eax, %eax
je 0x37bd
movq %rbp, %rdi
leaq 0x5b75(%rip), %rsi      # 0x926c
callq 0x2190
testl %eax, %eax
je 0x3806
movq %r12, %rbp
movl %ebx, %edi
jmp 0x3829
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x2, %eax
jl 0x3deb
incl %r15d
movq %r12, %rbp
movq 0x8(%r12,%r13,8), %rdi
callq 0x21c0
movl %ebx, %edi
movl %eax, %ebx
jmp 0x3763
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x3, %eax
jl 0x3df9
movq %r12, %rbp
movq 0x8(%r12,%r13,8), %rdi
callq 0x21c0
movl %eax, %r12d
addl $0x2, %r15d
movq 0x10(%rbp,%r13,8), %rdi
callq 0x21c0
movl %ebx, %edi
movq %r12, %rbx
incl %eax
movl %eax, 0x10(%rsp)
jmp 0x382e
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x2, %eax
jl 0x3e07
incl %r15d
movq %r12, %rbp
movq 0x8(%r12,%r13,8), %rdi
callq 0x21c0
movl %ebx, %edi
movl %eax, 0x24(%rsp)
jmp 0x3829
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x2, %eax
jl 0x3e15
incl %r15d
movq %r12, %rbp
movq 0x8(%r12,%r13,8), %rdi
callq 0x21c0
movl %ebx, %edi
movl %eax, 0xc(%rsp)
jmp 0x3829
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x2, %eax
jl 0x3e82
movl %ebx, %ecx
leal 0x1(%r15), %eax
subl %eax, %ecx
cmpl $0x2, %ecx
jl 0x3e90
movq %r12, %rbp
cltq
movq (%r12,%rax,8), %rdi
callq 0x21c0
movl %eax, 0x8(%rsp)
addl $0x2, %r15d
movq 0x10(%r12,%r13,8), %rdi
callq 0x2170
movl %ebx, %edi
vmovsd %xmm0, 0x28(%rsp)
jmp 0x3829
movl %ebx, %eax
subl %r15d, %eax
cmpl $0x2, %eax
jl 0x3e9e
movq %r12, %rbp
incl %r15d
movq 0x8(%r12,%r13,8), %rdi
callq 0x21c0
movl %ebx, %edi
movl %eax, (%rsp)
movq 0x18(%rsp), %rbx
movl 0x14(%rsp), %eax
orb 0x7(%rsp), %al
movl %eax, 0x14(%rsp)
incl %r15d
cmpl %edi, %r15d
jl 0x3626
movl 0x24(%rsp), %r13d
movl 0x8(%rsp), %ebp
jmp 0x3887
xorl %r13d, %r13d
movb $0x1, %r14b
movl $0xb, 0x10(%rsp)
movl $0xa, %ebx
vxorps %xmm0, %xmm0, %xmm0
vmovsd %xmm0, 0x28(%rsp)
movl $0x1, (%rsp)
movl $0x0, 0xc(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x14(%rsp)
movq 0x973a(%rip), %r15      # 0xcfc8
leaq 0x59fa(%rip), %rsi      # 0x928f
movl $0x33, %edx
movq %r15, %rdi
callq 0x2150
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x9708(%rip), %rdi      # 0xcfc8
callq 0x2030
movq %rax, %rdi
callq 0x20f0
xorl %r15d, %r15d
cmpl 0x10(%rsp), %ebx
jge 0x3e61
movl %ebp, 0x8(%rsp)
movzbl %r14b, %r12d
andl $0x1, %r12d
movl 0x14(%rsp), %r14d
testl %r13d, %r13d
jle 0x39cb
movl $0xb, %edx
movq 0x96c8(%rip), %rdi      # 0xcfc8
leaq 0x59bc(%rip), %rsi      # 0x92c3
callq 0x2150
movq 0x96b5(%rip), %rdi      # 0xcfc8
movl %ebx, %esi
callq 0x2210
movq %rax, %r15
movl $0xd, %edx
movq %rax, %rdi
leaq 0x59a3(%rip), %rsi      # 0x92cf
callq 0x2150
movq %r15, %rdi
movl %r13d, %esi
callq 0x2210
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x598f(%rip), %rsi      # 0x92dd
callq 0x2150
movq %r15, %rdi
movl (%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x5977(%rip), %rsi      # 0x92e7
callq 0x2150
movq %r15, %rdi
movl %r12d, %esi
callq 0x2200
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leal 0x1(%rbx), %eax
cmpl %r13d, %eax
jge 0x3eca
movl %r13d, %esi
movl %ebx, %edi
movl (%rsp), %edx
movl %r12d, %ecx
callq 0x2b4d
jmp 0x3d8c
cmpl $0x0, 0xc(%rsp)
jle 0x3aa3
movl $0xb, %edx
movq 0x95e6(%rip), %rdi      # 0xcfc8
leaq 0x58da(%rip), %rsi      # 0x92c3
callq 0x2150
movq 0x95d3(%rip), %rdi      # 0xcfc8
movl %ebx, %esi
callq 0x2210
movq %rax, %r15
movl $0xc, %edx
movq %rax, %rdi
leaq 0x5924(%rip), %rsi      # 0x9332
callq 0x2150
movq %r15, %rdi
movl 0xc(%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x58ac(%rip), %rsi      # 0x92dd
callq 0x2150
movq %r15, %rdi
movl (%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x5894(%rip), %rsi      # 0x92e7
callq 0x2150
movq %r15, %rdi
movl %r12d, %esi
callq 0x2200
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl %ebx, %edi
movl 0xc(%rsp), %esi
movl (%rsp), %edx
movl %r12d, %ecx
callq 0x2dae
jmp 0x3d8c
cmpl $0x0, 0x8(%rsp)
jle 0x3bb1
movl $0xb, %edx
movq 0x950e(%rip), %rdi      # 0xcfc8
leaq 0x5802(%rip), %rsi      # 0x92c3
callq 0x2150
movq 0x94fb(%rip), %rdi      # 0xcfc8
movl %ebx, %esi
callq 0x2210
movq %rax, %r15
movl $0xc, %edx
movq %rax, %rdi
leaq 0x5859(%rip), %rsi      # 0x933f
callq 0x2150
movq %r15, %rdi
movl 0x8(%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0xd, %edx
movq %rax, %rdi
leaq 0x5843(%rip), %rsi      # 0x934c
callq 0x2150
movq %r15, %rdi
vmovsd 0x28(%rsp), %xmm0
callq 0x21d0
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x57af(%rip), %rsi      # 0x92dd
callq 0x2150
movq %r15, %rdi
movl (%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x5797(%rip), %rsi      # 0x92e7
callq 0x2150
movq %r15, %rdi
movl %r12d, %esi
callq 0x2200
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leal 0x1(%rbx), %eax
movl 0x8(%rsp), %esi
cmpl %esi, %eax
jge 0x3ee9
movl %ebx, %edi
vmovsd 0x28(%rsp), %xmm0
movl (%rsp), %edx
movl %r12d, %ecx
callq 0x300f
jmp 0x3d8c
movq 0x30(%rsp), %rax
cmpq 0x38(%rsp), %rax
sete %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x3cc5
leaq 0x50(%rsp), %rdi
callq 0x2467
movq 0x30(%rsp), %rdi
vmovaps 0x50(%rsp), %xmm0
vmovaps %xmm0, 0x30(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0x3c1a
callq 0x2120
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3c1a
callq 0x2120
movl $0xb, %edx
movq 0x93a2(%rip), %rdi      # 0xcfc8
leaq 0x5696(%rip), %rsi      # 0x92c3
callq 0x2150
movq 0x938f(%rip), %rdi      # 0xcfc8
movl %ebx, %esi
callq 0x2210
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x568b(%rip), %rsi      # 0x92dd
callq 0x2150
movq %r15, %rdi
movl (%rsp), %esi
callq 0x2210
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x5673(%rip), %rsi      # 0x92e7
callq 0x2150
movq %r15, %rdi
movl %r12d, %esi
callq 0x2200
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0x30(%rsp), %rdi
movl %ebx, %esi
movl (%rsp), %edx
movl %r12d, %ecx
callq 0x29ae
jmp 0x3d8c
movl $0x16, %edx
movq 0x92f7(%rip), %rdi      # 0xcfc8
leaq 0x5698(%rip), %rsi      # 0x9370
callq 0x2150
movq 0x92e4(%rip), %rcx      # 0xcfc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x92c6(%rip), %rdi      # 0xcfc8
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x3, %ebp
movl $0x19, %edx
movq 0x92a8(%rip), %rdi      # 0xcfc8
leaq 0x5660(%rip), %rsi      # 0x9387
callq 0x2150
movq 0x9295(%rip), %rdi      # 0xcfc8
movq %rbp, %rsi
callq 0x20e0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl %ebp, %edi
movl $0x2710, %esi           # imm = 0x2710
vmovsd 0x52b4(%rip), %xmm0     # 0x9028
movl $0x1f4, %edx            # imm = 0x1F4
movl $0x1, %ecx
callq 0x300f
incq %rbp
cmpq $0x65, %rbp
jne 0x3d14
incl %ebx
cmpl 0x10(%rsp), %ebx
jne 0x38eb
xorl %r15d, %r15d
jmp 0x3e61
movq 0x9221(%rip), %rbx      # 0xcfc8
leaq 0x5393(%rip), %rsi      # 0x9141
movl $0x3, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x91ef(%rip), %rdi      # 0xcfc8
callq 0x2030
xorl %r15d, %r15d
movq %rax, %rdi
callq 0x20f0
jmp 0x3e61
movl $0x24, %edx
leaq 0x5357(%rip), %rsi      # 0x914e
jmp 0x3e21
movl $0x2b, %edx
leaq 0x537c(%rip), %rsi      # 0x9181
jmp 0x3e21
movl $0x23, %edx
leaq 0x53a2(%rip), %rsi      # 0x91b5
jmp 0x3e21
movl $0x22, %edx
leaq 0x53bf(%rip), %rsi      # 0x91e0
movq 0x91c8(%rip), %rbx      # 0xcff0
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x91a2(%rip), %rdi      # 0xcff0
callq 0x2030
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x20f0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3e70
callq 0x2120
movl %r15d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x22, %edx
leaq 0x537c(%rip), %rsi      # 0x920a
jmp 0x3eaa
movl $0x3e, %edx
leaq 0x5391(%rip), %rsi      # 0x922d
jmp 0x3eaa
movl $0x1a, %edx
leaq 0x53ca(%rip), %rsi      # 0x9274
movq 0x913f(%rip), %rdi      # 0xcff0
callq 0x2150
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq 0x912d(%rip), %rdi      # 0xcff0
callq 0x2090
jmp 0x3e61
leaq 0x5421(%rip), %rdi      # 0x92f2
leaq 0x5431(%rip), %rsi      # 0x9309
leaq 0x543c(%rip), %rcx      # 0x931b
movl $0x11e, %edx            # imm = 0x11E
callq 0x20c0
leaq 0x546a(%rip), %rdi      # 0x935a
leaq 0x5412(%rip), %rsi      # 0x9309
leaq 0x541d(%rip), %rcx      # 0x931b
movl $0x12a, %edx            # imm = 0x12A
callq 0x20c0
jmp 0x3f10
jmp 0x3f10
jmp 0x3f10
jmp 0x3f10
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3f22
callq 0x2120
movq %rbx, %rdi
callq 0x2220