// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdi, %rbx
cmpq $0x21, %rdi
setl %dil
cmpq $0x21, %rsi
setl %al
andb %dil, %al
movl %eax, %r10d
xorb $0x1, %r10b
testq %rbx, %rbx
sete %dil
orb %r10b, %dil
jne 0x32181
xorl %r15d, %r15d
movapd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movsd %xmm2, 0x10(%rsp)
ucomisd %xmm0, %xmm2
cmovneq %rsi, %r15
cmovpq %rsi, %r15
testq %r15, %r15
jle 0x31f3b
testq %r8, %r8
je 0x31ecb
movq %rbx, %r14
shrq $0x3f, %r14
addq %rbx, %r14
sarq %r14
leaq 0x20b0(%rsp), %rsi
xorl %edi, %edi
movq %rdx, %r11
movq %rsi, %r8
cmpq $0x2, %rbx
jl 0x31eaa
movq %r14, %r10
movq %rsi, %r8
movq %rdx, %r11
movsd (%r11), %xmm0
movsd %xmm0, (%r8)
movsd 0x8(%r11), %xmm0
movsd %xmm0, 0x100(%r8)
addq $0x200, %r8             # imm = 0x200
addq $0x10, %r11
decq %r10
jne 0x31e81
testb $0x1, %bl
je 0x31eb9
movsd (%r11), %xmm0
movsd %xmm0, (%r8)
incq %rdi
leaq (%rdx,%rcx,8), %rdx
addq $0x8, %rsi
cmpq %r15, %rdi
jne 0x31e6c
jmp 0x31f3b
testq %rbx, %rbx
jle 0x31f3b
movq %r15, %r14
shrq %r14
leaq 0x20b0(%rsp), %rsi
xorl %edi, %edi
movq %rdx, %r11
movq %rsi, %r8
cmpq $0x1, %r15
je 0x31f18
movq %r14, %r10
movq %rsi, %r8
movq %rdx, %r11
movsd (%r11), %xmm0
movsd %xmm0, (%r8)
movsd 0x8(%r11), %xmm0
movsd %xmm0, 0x8(%r8)
addq $0x10, %r8
addq $0x10, %r11
decq %r10
jne 0x31ef5
testb $0x1, %r15b
je 0x31f28
movsd (%r11), %xmm0
movsd %xmm0, (%r8)
incq %rdi
leaq (%rdx,%rcx,8), %rdx
addq $0x100, %rsi            # imm = 0x100
cmpq %rbx, %rdi
jne 0x31ee0
movq 0x4170(%rsp), %r11
movq %rbx, %r14
shrq $0x3f, %r14
addq %rbx, %r14
sarq %r14
testq %rbx, %rbx
jle 0x31fb3
leaq 0x30(%rsp), %r10
xorl %ecx, %ecx
movq %r9, %rdx
movq %rdx, %rdi
movq %r10, %rsi
cmpq $0x1, %rbx
je 0x31f93
movq %r14, %r8
movq %r10, %rsi
movq %rdx, %rdi
movsd (%rdi), %xmm0
movsd %xmm0, (%rsi)
movsd 0x8(%rdi), %xmm0
movsd %xmm0, 0x8(%rsi)
addq $0x10, %rsi
addq $0x10, %rdi
decq %r8
jne 0x31f74
testb $0x1, %bl
je 0x31fa0
movsd (%rdi), %xmm0
movsd %xmm0, (%rsi)
incq %rcx
leaq (%rdx,%r11,8), %rdx
addq $0x100, %r10            # imm = 0x100
cmpq %rbx, %rcx
jne 0x31f5f
movq %r14, 0x20(%rsp)
movq %r15, 0x8(%rsp)
movb %al, 0x7(%rsp)
movq %r9, 0x28(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
setp %al
setne %cl
orb %al, %cl
testq %rbx, %rbx
setle %al
orb %cl, %al
movsd %xmm1, 0x18(%rsp)
jne 0x3203f
leaq (,%rbx,8), %r12
leaq 0x30(%rsp), %r15
movl $0x8, %ebp
movq %rbx, %r14
movq %r15, %r13
cmpb $0x0, 0x4178(%rsp)
je 0x32017
testq %r14, %r14
jle 0x32024
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
jmp 0x3201f
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x3170
addq $0x100, %r13            # imm = 0x100
addq $0x8, %rbp
addq $0x108, %r15            # imm = 0x108
addq $-0x8, %r12
decq %r14
jne 0x31ffe
cmpb $0x0, 0x4178(%rsp)
je 0x320a2
testq %rbx, %rbx
movq 0x8(%rsp), %r14
jle 0x3210b
leaq 0x20b0(%rsp), %r15
leaq 0x30(%rsp), %r12
movq %rbx, %r13
movl $0x1, %r9d
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r15, %rcx
movq %r12, %r8
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2f6c5
addq $0x100, %r15            # imm = 0x100
addq $0x108, %r12            # imm = 0x108
decq %r13
jne 0x32067
jmp 0x3210b
testq %rbx, %rbx
movq 0x8(%rsp), %r15
jle 0x3210b
movq %rbx, %r14
negq %r14
leaq 0x20b0(%rsp), %rbp
leaq 0x30(%rsp), %r12
movl $0x1, %r13d
movl $0x1, %r9d
movq %r13, %rdi
movq %r15, %rsi
leaq 0x20b0(%rsp), %rdx
movq %rbp, %rcx
movq %r12, %r8
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2f6c5
movl $0x100, %eax            # imm = 0x100
addq %rax, %rbp
addq %rax, %r12
leaq (%r14,%r13), %rax
incq %rax
incq %r13
cmpq $0x1, %rax
jne 0x320c5
testq %rbx, %rbx
movq 0x28(%rsp), %r8
movb 0x7(%rsp), %al
movq 0x4170(%rsp), %r10
movq 0x20(%rsp), %r11
jle 0x32181
leaq 0x30(%rsp), %r9
xorl %ecx, %ecx
movq %r9, %rsi
movq %r8, %rdx
cmpq $0x1, %rbx
je 0x32161
movq %r11, %rdi
movq %r8, %rdx
movq %r9, %rsi
movsd (%rsi), %xmm0
movsd %xmm0, (%rdx)
movsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x8(%rdx)
addq $0x10, %rdx
addq $0x10, %rsi
decq %rdi
jne 0x32142
testb $0x1, %bl
je 0x3216e
movsd (%rsi), %xmm0
movsd %xmm0, (%rdx)
incq %rcx
addq $0x100, %r9             # imm = 0x100
leaq (%r8,%r10,8), %r8
cmpq %rbx, %rcx
jne 0x3212d
addq $0x4138, %rsp           # imm = 0x4138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq