// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_cmatrixsyrk(long, long, double, alglib_impl::ae_complex*, long, long, double, alglib_impl::ae_complex*, long, bool)
ae_bool _ialglib_cmatrixsyrk(ae_int_t n,
     ae_int_t k,
     double alpha,
     ae_complex *_a,
     ae_int_t _a_stride,
     ae_int_t optypea,
     double beta,
     ae_complex *_c,
     ae_int_t _c_stride,
     ae_bool isupper)
{
    /*
     * local buffers
     */
    double *arow, *crow;
    ae_complex c_alpha, c_beta;
    ae_int_t i;
    double _loc_abuf[2*alglib_c_block*alglib_c_block+alglib_simd_alignment];
    double _loc_cbuf[2*alglib_c_block*alglib_c_block+alglib_simd_alignment];
    double _loc_tmpbuf[2*alglib_c_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);
    double * const tmpbuf = (double * const) ae_align(_loc_tmpbuf,alglib_simd_alignment);

    if( n>alglib_c_block || k>alglib_c_block )
        return ae_false;
    if( n==0 )
        return ae_true;

    /*
     * copy A and C, task is transformed to "A*A^H"-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)
     */
    c_alpha.x = alpha;
    c_alpha.y = 0;
    c_beta.x = beta;
    c_beta.y = 0;
    if( alpha==0 )
        k = 0;
    if( k>0 )
    {
        if( optypea==0 )
            _ialglib_mcopyblock_complex(n, k, _a, 3, _a_stride, abuf);
        else
            _ialglib_mcopyblock_complex(k, n, _a, 1, _a_stride, abuf);
    }
    _ialglib_mcopyblock_complex(n, n, _c, 0, _c_stride, cbuf);
    if( beta==0 )
    {
        for(i=0,crow=cbuf; i<n; i++,crow+=2*alglib_c_block)
            if( isupper )
                _ialglib_vzero(2*(n-i), crow+2*i, 1);
            else
                _ialglib_vzero(2*(i+1), crow, 1);
    }


    /*
     * update C
     */
    if( isupper )
    {
        for(i=0,arow=abuf,crow=cbuf; i<n; i++,arow+=2*alglib_c_block,crow+=2*alglib_c_block)
        {
            _ialglib_vcopy_dcomplex(k, arow, 1, tmpbuf, 1, "Conj");
            _ialglib_cmv(n-i, k, arow, tmpbuf, NULL, crow+2*i, 1, c_alpha, c_beta);
        }
    }
    else
    {
        for(i=0,arow=abuf,crow=cbuf; i<n; i++,arow+=2*alglib_c_block,crow+=2*alglib_c_block)
        {
            _ialglib_vcopy_dcomplex(k, arow, 1, tmpbuf, 1, "Conj");
            _ialglib_cmv(i+1, k, abuf, tmpbuf, NULL, crow, 1, c_alpha, c_beta);
        }
    }

    /*
     * copy back
     */
    _ialglib_mcopyunblock_complex(n, n, cbuf, 0, _c, _c_stride);

    return ae_true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b48, %rsp           # imm = 0x4B48
movsd %xmm1, 0x28(%rsp)
movq %rcx, %r10
movq %rdi, %r14
cmpq $0x19, %rdi
setl %cl
cmpq $0x19, %rsi
setl %al
andb %cl, %al
movl %eax, %ecx
xorb $0x1, %cl
testq %rdi, %rdi
sete %dil
orb %cl, %dil
jne 0x2db02
movq %r9, %rbx
movb %al, 0x17(%rsp)
xorl %eax, %eax
xorpd %xmm1, %xmm1
movsd %xmm0, 0x30(%rsp)
ucomisd %xmm1, %xmm0
cmovneq %rsi, %rax
movq 0x4b80(%rsp), %r15
cmovpq %rsi, %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
jle 0x2d91c
testq %r8, %r8
je 0x2d901
pushq $0x1
popq %rcx
leaq 0x240(%rsp), %r9
movq 0x18(%rsp), %rdi
movq %r14, %rsi
jmp 0x2d914
pushq $0x3
popq %rcx
leaq 0x240(%rsp), %r9
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq %r10, %r8
callq 0x2c669
leaq 0x26c0(%rsp), %r13
movq %r14, %rdi
movq %r14, 0x20(%rsp)
movq %r14, %rsi
movq %rbx, 0x38(%rsp)
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r15, %r8
movq %r13, %r9
callq 0x2c669
movsd 0x28(%rsp), %xmm0
ucomisd 0x58e6(%rip), %xmm0     # 0x33238
jne 0x2d9b6
jp 0x2d9b6
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
testq %rax, %rax
cmovgq %rax, %r12
leaq (%rax,%rax), %rbx
leaq 0x26c0(%rsp), %rbp
pushq $0x2
popq %r15
movq %rbp, %r14
subq $0x1, %r12
jb 0x2d9b6
cmpb $0x0, 0x4b88(%rsp)
je 0x2d990
movq %rbx, %rdi
movq %rbp, %rsi
jmp 0x2d996
movq %r15, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
callq 0x2c2c3
addq $0x180, %r14            # imm = 0x180
addq $0x2, %r15
addq $0x190, %rbp            # imm = 0x190
addq $-0x2, %rbx
jmp 0x2d978
xorl %ebp, %ebp
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
cmovgq %rbx, %rbp
cmpb $0x0, 0x4b88(%rsp)
je 0x2da56
leaq 0x240(%rsp), %r13
leaq 0x26c0(%rsp), %r15
movq 0x18(%rsp), %r12
subq $0x1, %rbp
jb 0x2dada
movq %r12, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
leaq 0x40(%rsp), %r14
movq %r14, %rcx
movq %rdx, %r8
leaq 0x55ca(%rip), %r9       # 0x32fd6
callq 0x2c42d
movq $0x1, (%rsp)
xorpd %xmm1, %xmm1
xorps %xmm3, %xmm3
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
movq %r15, %r9
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
callq 0x2c1a9
addq $0x180, %r13            # imm = 0x180
addq $0x190, %r15            # imm = 0x190
decq %rbx
jmp 0x2d9e7
negq %rbp
leaq 0x240(%rsp), %r15
pushq $0x1
popq %rbx
movq 0x18(%rsp), %r14
leaq (%rbx,%rbp), %rax
cmpq $0x1, %rax
je 0x2dada
movq %r14, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
leaq 0x40(%rsp), %r12
movq %r12, %rcx
movq %rdx, %r8
leaq 0x5548(%rip), %r9       # 0x32fd6
callq 0x2c42d
movq $0x1, (%rsp)
xorpd %xmm1, %xmm1
xorps %xmm3, %xmm3
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x240(%rsp), %rdx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r13, %r9
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
callq 0x2c1a9
movl $0x180, %eax            # imm = 0x180
addq %rax, %r15
addq %rax, %r13
incq %rbx
jmp 0x2da69
leaq 0x26c0(%rsp), %rdx
movq 0x20(%rsp), %rdi
movq %rdi, %rsi
xorl %ecx, %ecx
movq 0x38(%rsp), %r8
movq 0x4b80(%rsp), %r9
callq 0x2c82d
movb 0x17(%rsp), %al
addq $0x4b48, %rsp           # imm = 0x4B48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq