// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_rmatrixsyrk(long, long, double, double*, long, long, double, double*, long, bool)
ae_bool _ialglib_rmatrixsyrk(ae_int_t n,
     ae_int_t k,
     double alpha,
     double *_a,
     ae_int_t _a_stride,
     ae_int_t optypea,
     double beta,
     double *_c,
     ae_int_t _c_stride,
     ae_bool isupper)
{
    /*
     * local buffers
     */
    double *arow, *crow;
    ae_int_t i;
    double _loc_abuf[alglib_r_block*alglib_r_block+alglib_simd_alignment];
    double _loc_cbuf[alglib_r_block*alglib_r_block+alglib_simd_alignment];
    double * const abuf   = (double * const) ae_align(_loc_abuf,  alglib_simd_alignment);
    double * const cbuf   = (double * const) ae_align(_loc_cbuf,  alglib_simd_alignment);

    if( n>alglib_r_block || k>alglib_r_block )
        return ae_false;
    if( n==0 )
        return ae_true;

    /*
     * copy A and C, task is transformed to "A*A^T"-form.
     * if beta==0, then C is filled by zeros (and not referenced)
     *
     * alpha==0 or k==0 are correctly processed (A is not referenced)
     */
    if( alpha==0 )
        k = 0;
    if( k>0 )
    {
        if( optypea==0 )
            _ialglib_mcopyblock(n, k, _a, 0, _a_stride, abuf);
        else
            _ialglib_mcopyblock(k, n, _a, 1, _a_stride, abuf);
    }
    _ialglib_mcopyblock(n, n, _c, 0, _c_stride, cbuf);
    if( beta==0 )
    {
        for(i=0,crow=cbuf; i<n; i++,crow+=alglib_r_block)
            if( isupper )
                _ialglib_vzero(n-i, crow+i, 1);
            else
                _ialglib_vzero(i+1, crow, 1);
    }


    /*
     * update C
     */
    if( isupper )
    {
        for(i=0,arow=abuf,crow=cbuf; i<n; i++,arow+=alglib_r_block,crow+=alglib_r_block)
        {
            _ialglib_rmv(n-i, k, arow, arow, crow+i, 1, alpha, beta);
        }
    }
    else
    {
        for(i=0,arow=abuf,crow=cbuf; i<n; i++,arow+=alglib_r_block,crow+=alglib_r_block)
        {
            _ialglib_rmv(i+1, k, abuf, arow, crow, 1, alpha, beta);
        }
    }

    /*
     * copy back
     */
    _ialglib_mcopyunblock(n, n, cbuf, 0, _c, _c_stride);

    return ae_true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4138, %rsp           # imm = 0x4138
movsd %xmm1, 0x18(%rsp)
movq %rcx, %r10
movq %rdi, %r14
cmpq $0x21, %rdi
setl %cl
cmpq $0x21, %rsi
setl %al
andb %cl, %al
movl %eax, %ecx
xorb $0x1, %cl
testq %rdi, %rdi
sete %dil
orb %cl, %dil
jne 0x2dd29
movq %r9, %rbx
movb %al, 0xf(%rsp)
xorl %r12d, %r12d
xorpd %xmm1, %xmm1
movsd %xmm0, 0x20(%rsp)
ucomisd %xmm1, %xmm0
cmovneq %rsi, %r12
movq 0x4170(%rsp), %r15
cmovpq %rsi, %r12
testq %r12, %r12
jle 0x2dbad
testq %r8, %r8
je 0x2db98
pushq $0x1
popq %rcx
leaq 0x30(%rsp), %r9
movq %r12, %rdi
movq %r14, %rsi
jmp 0x2dba5
leaq 0x30(%rsp), %r9
movq %r14, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
movq %r10, %r8
callq 0x2c4ad
leaq 0x20b0(%rsp), %r13
movq %r14, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rsi
movq %rbx, 0x28(%rsp)
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r15, %r8
movq %r13, %r9
callq 0x2c4ad
movsd 0x18(%rsp), %xmm0
ucomisd 0x5655(%rip), %xmm0     # 0x33238
jne 0x2dc49
jp 0x2dc49
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
testq %rax, %rax
movl $0x0, %r14d
cmovgq %rax, %r14
leaq 0x20b0(%rsp), %rbx
pushq $0x1
popq %rbp
cmpq %r14, %r15
je 0x2dc49
cmpb $0x0, 0x4178(%rsp)
je 0x2dc2f
movq 0x10(%rsp), %rdi
subq %r15, %rdi
leaq (%rbx,%r15,8), %rsi
movq %rbp, %rdx
callq 0x2c2c3
incq %r15
jmp 0x2dc40
incq %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x2c2c3
addq $0x100, %rbx            # imm = 0x100
jmp 0x2dc07
xorl %r14d, %r14d
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
cmovgq %rbp, %r14
cmpb $0x0, 0x4178(%rsp)
je 0x2dcb5
leaq 0x30(%rsp), %rbx
leaq 0x20b0(%rsp), %r15
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x2dd01
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %rbx, %rcx
movq %r15, %r8
pushq $0x1
popq %r9
movsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2bded
incq %r13
addq $0x100, %rbx            # imm = 0x100
addq $0x108, %r15            # imm = 0x108
decq %rbp
jmp 0x2dc72
negq %r14
leaq 0x30(%rsp), %rbx
pushq $0x1
popq %rbp
movl $0x100, %r15d           # imm = 0x100
leaq (%r14,%rbp), %rax
cmpq $0x1, %rax
je 0x2dd01
movq %rbp, %rdi
movq %r12, %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r8
pushq $0x1
popq %r9
movsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2bded
addq %r15, %rbx
addq %r15, %r13
incq %rbp
jmp 0x2dcc6
leaq 0x20b0(%rsp), %rdx
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
xorl %ecx, %ecx
movq 0x28(%rsp), %r8
movq 0x4170(%rsp), %r9
callq 0x2c58b
movb 0xf(%rsp), %al
addq $0x4138, %rsp           # imm = 0x4138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq