// File: /workspace/github_cpp_makefile_star2_O3/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 0x31556
xorl %r12d, %r12d
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
cmovneq %rsi, %r12
movq 0x4170(%rsp), %r15
cmovpq %rsi, %r12
testq %r12, %r12
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x18(%rsp)
jle 0x312db
testq %r8, %r8
je 0x31273
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 0x31252
movq %r14, %r10
movq %rsi, %r8
movq %rdx, %r11
movsd (%r11), %xmm2
movsd %xmm2, (%r8)
movsd 0x8(%r11), %xmm2
movsd %xmm2, 0x100(%r8)
addq $0x200, %r8             # imm = 0x200
addq $0x10, %r11
decq %r10
jne 0x31229
testb $0x1, %bl
je 0x31261
movsd (%r11), %xmm2
movsd %xmm2, (%r8)
incq %rdi
leaq (%rdx,%rcx,8), %rdx
addq $0x8, %rsi
cmpq %r12, %rdi
jne 0x31214
jmp 0x312db
testq %rbx, %rbx
jle 0x313e4
movq %r12, %r14
shrq %r14
leaq 0x20b0(%rsp), %rsi
xorl %edi, %edi
movq %rsi, %r8
movq %rdx, %r11
cmpq $0x1, %r12
je 0x312be
movq %r14, %r10
movq %rsi, %r8
movq %rdx, %r11
movupd (%r11), %xmm2
movupd %xmm2, (%r8)
addq $0x10, %r8
addq $0x10, %r11
decq %r10
jne 0x312a1
testb $0x1, %r12b
je 0x312c8
movsd (%r11), %xmm2
movsd %xmm2, (%r8)
incq %rdi
leaq (%rdx,%rcx,8), %rdx
addq $0x100, %rsi            # imm = 0x100
cmpq %rbx, %rdi
jne 0x3128c
movq %rbx, %r11
shrq $0x3f, %r11
addq %rbx, %r11
sarq %r11
testq %rbx, %rbx
jle 0x313f0
leaq 0x30(%rsp), %r10
xorl %ecx, %ecx
movq %r9, %rdx
movq %r10, %rsi
movq %rdx, %rdi
cmpq $0x1, %rbx
je 0x3132a
movq %r11, %r8
movq %r10, %rsi
movq %rdx, %rdi
movupd (%rdi), %xmm2
movupd %xmm2, (%rsi)
addq $0x10, %rsi
addq $0x10, %rdi
decq %r8
jne 0x31310
testb $0x1, %bl
je 0x31332
movsd (%rdi), %xmm2
movsd %xmm2, (%rsi)
incq %rcx
leaq (%rdx,%r15,8), %rdx
addq $0x100, %r10            # imm = 0x100
cmpq %rbx, %rcx
jne 0x312fb
movb $0x1, %cl
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x313f2
jp 0x313f2
movq %r11, 0x8(%rsp)
movq %r12, 0x20(%rsp)
movb %al, 0x3(%rsp)
movq %r9, 0x10(%rsp)
leaq (,%rbx,8), %r12
leaq 0x30(%rsp), %r15
movl $0x8, %ebp
movq %rbx, %r14
movq %r15, %r13
cmpb $0x0, 0x4178(%rsp)
je 0x3139f
testq %r14, %r14
jle 0x313b2
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
jmp 0x313a7
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x3170
movsd 0x18(%rsp), %xmm0
addq $0x100, %r13            # imm = 0x100
addq $0x8, %rbp
addq $0x108, %r15            # imm = 0x108
addq $-0x8, %r12
decq %r14
jne 0x31386
movq 0x10(%rsp), %r9
movb 0x3(%rsp), %al
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %r11
movb $0x1, %cl
jmp 0x313f2
movq %rbx, %r11
negq %r11
shrq %r11
negq %r11
xorl %ecx, %ecx
cmpb $0x0, 0x4178(%rsp)
je 0x31467
testb %cl, %cl
je 0x31556
movl %ecx, 0x4(%rsp)
movq %r11, 0x8(%rsp)
movb %al, 0x3(%rsp)
movq %r9, 0x10(%rsp)
leaq 0x20b0(%rsp), %r15
movq %r12, %r14
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 0x28(%rsp), %xmm1
callq 0x2ea57
movsd 0x18(%rsp), %xmm0
addq $0x100, %r15            # imm = 0x100
addq $0x108, %r12            # imm = 0x108
decq %r13
jne 0x31429
jmp 0x314e8
testb %cl, %cl
je 0x31556
movl %ecx, 0x4(%rsp)
movq %r11, 0x8(%rsp)
movb %al, 0x3(%rsp)
movq %r9, 0x10(%rsp)
movq %rbx, %r14
negq %r14
leaq 0x20b0(%rsp), %rbp
movq %r12, 0x20(%rsp)
leaq 0x30(%rsp), %r12
movl $0x1, %r13d
movl $0x100, %r15d           # imm = 0x100
movl $0x1, %r9d
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x20b0(%rsp), %rdx
movq %rbp, %rcx
movq %r12, %r8
movsd 0x28(%rsp), %xmm1
callq 0x2ea57
movsd 0x18(%rsp), %xmm0
addq %r15, %rbp
addq %r15, %r12
leaq (%r14,%r13), %rax
incq %rax
incq %r13
cmpq $0x1, %rax
jne 0x314a5
cmpb $0x0, 0x4(%rsp)
movq 0x10(%rsp), %r8
movb 0x3(%rsp), %al
movq 0x4170(%rsp), %r10
movq 0x8(%rsp), %r11
je 0x31556
leaq 0x30(%rsp), %r9
xorl %ecx, %ecx
movq %r9, %rsi
movq %r8, %rdx
cmpq $0x2, %rbx
jl 0x31536
movq %r11, %rdi
movq %r8, %rdx
movq %r9, %rsi
movupd (%rsi), %xmm0
movupd %xmm0, (%rdx)
addq $0x10, %rdx
addq $0x10, %rsi
decq %rdi
jne 0x31521
testb $0x1, %bl
je 0x31543
movsd (%rsi), %xmm0
movsd %xmm0, (%rdx)
incq %rcx
addq $0x100, %r9             # imm = 0x100
leaq (%r8,%r10,8), %r8
cmpq %rbx, %rcx
jne 0x3150c
addq $0x4138, %rsp           # imm = 0x4138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq