// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_cmatrixgemm(long, long, long, alglib_impl::ae_complex, alglib_impl::ae_complex*, long, long, alglib_impl::ae_complex*, long, long, alglib_impl::ae_complex, alglib_impl::ae_complex*, long)
ae_bool _ialglib_cmatrixgemm(ae_int_t m,
     ae_int_t n,
     ae_int_t k,
     ae_complex alpha,
     ae_complex *_a,
     ae_int_t _a_stride,
     ae_int_t optypea,
     ae_complex *_b,
     ae_int_t _b_stride,
     ae_int_t optypeb,
     ae_complex beta,
     ae_complex *_c,
     ae_int_t _c_stride)
 {
    const ae_complex *arow;
    ae_complex *crow;
    ae_int_t i;
    double _loc_abuf[2*alglib_c_block+alglib_simd_alignment];
    double _loc_b[2*alglib_c_block*alglib_c_block+alglib_simd_alignment];
    double * const abuf = (double * const) ae_align(_loc_abuf,alglib_simd_alignment);
    double * const b    = (double * const) ae_align(_loc_b,   alglib_simd_alignment);
    ae_int_t brows;
    ae_int_t bcols;
    void (*cmv)(ae_int_t, ae_int_t, const double *, const double *, ae_complex *, double *, ae_int_t, ae_complex, ae_complex) = &_ialglib_cmv;
    
    if( m>alglib_c_block || n>alglib_c_block || k>alglib_c_block )
        return ae_false;

    /*
     * Check for SSE2 support
     */
#ifdef AE_HAS_SSE2_INTRINSICS
    if( ae_cpuid() & CPU_SSE2 )
    {
        cmv = &_ialglib_cmv_sse2;
    }    
#endif
    
    /*
     * copy b
     */
    brows = optypeb==0 ? k : n;
    bcols = optypeb==0 ? n : k;
    if( optypeb==0 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 1, _b_stride, b);
    if( optypeb==1 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 0, _b_stride, b);
    if( optypeb==2 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 3, _b_stride, b);

    /*
     * multiply B by A (from the right, by rows)
     * and store result in C
     */
    arow  = _a;
    crow  = _c;
    for(i=0; i<m; i++)
    {
        if( optypea==0 )
        {
            _ialglib_vcopy_complex(k, arow, 1, abuf, 1, "No conj");
            arow += _a_stride;
        }
        else if( optypea==1 )
        {
            _ialglib_vcopy_complex(k, arow, _a_stride, abuf, 1, "No conj");
            arow++;
        }
        else
        {
            _ialglib_vcopy_complex(k, arow, _a_stride, abuf, 1, "Conj");
            arow++;
        }
        if( beta.x==0 && beta.y==0 )
            _ialglib_vzero_complex(n, crow, 1);
        cmv(n, k, b, abuf, crow, NULL, 1, alpha, beta);
        crow += _c_stride;
    }
    return ae_true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x26f8, %rsp           # imm = 0x26F8
movaps %xmm3, 0x60(%rsp)
movaps %xmm2, 0x50(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, %r15
movsd %xmm1, 0x48(%rsp)
movsd %xmm0, 0x40(%rsp)
cmpq $0x19, %rdi
setl %al
movq %rsi, 0x18(%rsp)
cmpq $0x19, %rsi
setl %cl
andb %al, %cl
cmpq $0x19, %rdx
setl %al
andb %cl, %al
movb %al, 0x17(%rsp)
cmpb $0x1, %al
jne 0x2ce16
movq %r9, %rbx
movq %rdx, %r12
movq %rdi, %rbp
movq 0x2750(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x2740(%rsp), %rax
movq 0x2738(%rsp), %r8
movq 0x2730(%rsp), %rdx
cmpq $0x2, %rax
je 0x2ccef
cmpq $0x1, %rax
je 0x2ccdb
testq %rax, %rax
jne 0x2cd07
pushq $0x1
popq %rcx
leaq 0x270(%rsp), %r9
movq %r12, %rdi
movq 0x18(%rsp), %rsi
jmp 0x2cd02
leaq 0x270(%rsp), %r9
movq 0x18(%rsp), %rdi
movq %r12, %rsi
xorl %ecx, %ecx
jmp 0x2cd02
pushq $0x3
popq %rcx
leaq 0x270(%rsp), %r9
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x2c669
movq 0x2748(%rsp), %r14
xorpd %xmm0, %xmm0
movapd 0x60(%rsp), %xmm1
cmpeqpd %xmm0, %xmm1
cmpeqpd 0x50(%rsp), %xmm0
andpd %xmm1, %xmm0
movss %xmm0, 0x2c(%rsp)
xorl %eax, %eax
testq %rbp, %rbp
cmovleq %rax, %rbp
shlq $0x4, 0x30(%rsp)
leaq 0x70(%rsp), %r13
movq 0x20(%rsp), %rax
shlq $0x4, %rax
movq %rax, 0x38(%rsp)
subq $0x1, %rbp
jb 0x2ce16
movq %r12, %rdi
movq %r15, %rsi
cmpq $0x1, %rbx
je 0x2cd88
testq %rbx, %rbx
jne 0x2cd9d
pushq $0x1
popq %rdx
movq %r13, %rcx
movq %rdx, %r8
leaq 0x6ec6(%rip), %r9       # 0x33c42
callq 0x2c3a9
addq 0x38(%rsp), %r15
jmp 0x2cdb9
movq 0x20(%rsp), %rdx
movq %r13, %rcx
pushq $0x1
popq %r8
leaq 0x6ea7(%rip), %r9       # 0x33c42
jmp 0x2cdb0
movq 0x20(%rsp), %rdx
movq %r13, %rcx
pushq $0x1
popq %r8
leaq 0x6226(%rip), %r9       # 0x32fd6
callq 0x2c3a9
addq $0x10, %r15
testb $0x1, 0x2c(%rsp)
je 0x2cdd0
movq 0x18(%rsp), %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
callq 0x2c2f7
movq $0x1, (%rsp)
movq 0x18(%rsp), %rdi
movq %r12, %rsi
leaq 0x270(%rsp), %rdx
movq %r13, %rcx
movq %r14, %r8
xorl %r9d, %r9d
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
callq 0x2c1a9
addq 0x30(%rsp), %r14
jmp 0x2cd51
movb 0x17(%rsp), %al
addq $0x26f8, %rsp           # imm = 0x26F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq