// File: /workspace/github_cpp_makefile_star2_O3/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
movq %r9, %rbx
cmpq $0x19, %rdi
setl %r9b
cmpq $0x19, %rsi
setl %al
andb %r9b, %al
movl %eax, %r10d
xorb $0x1, %r10b
testq %rdi, %rdi
sete %r9b
orb %r10b, %r9b
jne 0x31179
xorl %r15d, %r15d
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
cmovneq %rsi, %r15
movq 0x4b80(%rsp), %r14
cmovpq %rsi, %r15
testq %r15, %r15
jle 0x30ea5
testq %r8, %r8
je 0x30e47
leaq 0x26c0(%rsp), %r11
xorl %esi, %esi
shlq $0x4, %rcx
testq %rdi, %rdi
jle 0x30e36
movq %rdi, %r10
movq %r11, %r8
movq %rdx, %r9
movupd (%r9), %xmm2
movupd %xmm2, (%r8)
addq $0x180, %r8             # imm = 0x180
addq $0x10, %r9
decq %r10
jne 0x30e1c
incq %rsi
addq %rcx, %rdx
addq $0x10, %r11
cmpq %r15, %rsi
jne 0x30e0e
jmp 0x30ea5
testq %rdi, %rdi
jle 0x30fb1
shlq $0x4, %rcx
leaq 0x26c0(%rsp), %r10
xorl %esi, %esi
movapd 0x234a(%rip), %xmm3     # 0x331b0
movq %r15, %r9
xorl %r8d, %r8d
movsd (%rdx,%r8), %xmm2
movsd %xmm2, (%r10,%r8)
movsd 0x8(%rdx,%r8), %xmm2
xorpd %xmm3, %xmm2
movlpd %xmm2, 0x8(%r10,%r8)
addq $0x10, %r8
decq %r9
jne 0x30e6c
incq %rsi
addq $0x180, %r10            # imm = 0x180
addq %rcx, %rdx
cmpq %rdi, %rsi
jne 0x30e66
testq %rdi, %rdi
jle 0x30fb1
movq %r14, %r10
shlq $0x4, %r10
leaq 0x240(%rsp), %rcx
xorl %edx, %edx
movq %rbx, %rsi
movq %rdi, %r9
xorl %r8d, %r8d
movupd (%rsi,%r8), %xmm2
movupd %xmm2, (%rcx,%r8)
addq $0x10, %r8
decq %r9
jne 0x30ec8
incq %rdx
addq $0x180, %rcx            # imm = 0x180
addq %r10, %rsi
cmpq %rdi, %rdx
jne 0x30ec2
movb $0x1, %cl
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x30fb3
jp 0x30fb3
movq %r15, 0x28(%rsp)
movb %al, 0x17(%rsp)
movq %rbx, 0x38(%rsp)
movq %rdi, %r12
shlq $0x4, %r12
movq %rdi, %rbx
leaq 0x240(%rsp), %r15
movl $0x10, %ebp
movl $0x2, %r14d
movq %rdi, 0x30(%rsp)
movq %r15, %r13
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
cmpb $0x0, 0x4b88(%rsp)
je 0x30f5d
testq %rbx, %rbx
jle 0x30f7b
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
jmp 0x30f6a
testq %r14, %r14
jle 0x30f7b
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x3170
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
addq $0x180, %r13            # imm = 0x180
addq $0x190, %r15            # imm = 0x190
addq $-0x10, %r12
addq $0x10, %rbp
addq $0x2, %r14
decq %rbx
jne 0x30f44
movq 0x38(%rsp), %rbx
movq 0x30(%rsp), %rdi
movb 0x17(%rsp), %al
movq 0x28(%rsp), %r15
movb $0x1, %cl
jmp 0x30fb3
xorl %ecx, %ecx
cmpb $0x0, 0x4b88(%rsp)
je 0x31068
testb %cl, %cl
je 0x31179
movl %ecx, 0x28(%rsp)
movb %al, 0x17(%rsp)
leaq 0x26c0(%rsp), %r12
leaq 0x240(%rsp), %r13
leaq 0x40(%rsp), %rbp
movq %rdi, 0x30(%rsp)
movq %r15, %r14
movq %rdi, %r15
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rcx
leaq 0x4fce(%rip), %r9       # 0x35fe6
callq 0x2f136
movq $0x1, (%rsp)
xorpd %xmm1, %xmm1
xorpd %xmm3, %xmm3
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
movq %r13, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm2
callq 0x2eebd
addq $0x180, %r12            # imm = 0x180
addq $0x190, %r13            # imm = 0x190
decq %r15
jne 0x30ffd
jmp 0x31128
testb %cl, %cl
je 0x31179
movl %ecx, 0x28(%rsp)
movb %al, 0x17(%rsp)
movq %rdi, 0x30(%rsp)
movq %r15, %r14
movq %rdi, %r15
negq %r15
movq %r15, 0x38(%rsp)
leaq 0x240(%rsp), %r12
leaq 0x26c0(%rsp), %r13
movl $0x1, %ebp
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %r13, %rsi
leaq 0x40(%rsp), %r15
movq %r15, %rcx
leaq 0x4f1a(%rip), %r9       # 0x35fe6
callq 0x2f136
movq $0x1, (%rsp)
xorpd %xmm1, %xmm1
xorpd %xmm3, %xmm3
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x26c0(%rsp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm2
callq 0x2eebd
movl $0x180, %eax            # imm = 0x180
addq %rax, %r13
addq %rax, %r12
movq 0x38(%rsp), %rax
addq %rbp, %rax
incq %rax
incq %rbp
cmpq $0x1, %rax
jne 0x310ac
cmpb $0x0, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movb 0x17(%rsp), %al
movq 0x4b80(%rsp), %r9
je 0x31179
shlq $0x4, %r9
leaq 0x240(%rsp), %r8
xorl %ecx, %ecx
movq %rdi, %rdx
xorl %esi, %esi
movupd (%r8,%rsi), %xmm0
movupd %xmm0, (%rbx,%rsi)
addq $0x10, %rsi
decq %rdx
jne 0x31153
incq %rcx
addq $0x180, %r8             # imm = 0x180
addq %r9, %rbx
cmpq %rdi, %rcx
jne 0x3114e
addq $0x4b48, %rsp           # imm = 0x4B48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq