// File: /workspace/github_cpp_makefile_star2_O3/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 %r9, 0x48(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, %r15
movsd %xmm1, 0x40(%rsp)
movsd %xmm0, 0x38(%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 0x2fc60
movq %rdx, %r12
movq %rdi, %rbp
movq 0x2740(%rsp), %rdi
movq 0x2738(%rsp), %rax
movq 0x2730(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r8, %rdx
testq %rdi, %rdi
cmoveq %r12, %rdx
movq %r12, %rsi
cmoveq %r8, %rsi
jne 0x2fa61
testq %r12, %r12
jle 0x2fb23
leaq 0x270(%rsp), %r8
xorl %r9d, %r9d
movq %rax, %r10
shlq $0x4, %r10
movq %rcx, %r11
cmpq $0x0, 0x18(%rsp)
jle 0x2fa52
movq %rsi, %rbx
movq %r8, %r14
movq %r11, %r13
movupd (%r13), %xmm0
movupd %xmm0, (%r14)
addq $0x180, %r14            # imm = 0x180
addq $0x10, %r13
decq %rbx
jne 0x2fa37
incq %r9
addq %r10, %r11
addq $0x10, %r8
cmpq %rdx, %r9
jne 0x2fa26
cmpq $0x2, %rdi
je 0x2fac0
cmpq $0x1, %rdi
jne 0x2fb23
cmpq $0x0, 0x18(%rsp)
jle 0x2fb23
shlq $0x4, %rax
leaq 0x270(%rsp), %rdi
xorl %r8d, %r8d
testq %r12, %r12
jle 0x2faac
movq %rsi, %r9
xorl %r10d, %r10d
movupd (%rcx,%r10), %xmm0
movupd %xmm0, (%rdi,%r10)
addq $0x10, %r10
decq %r9
jne 0x2fa97
incq %r8
addq $0x180, %rdi            # imm = 0x180
addq %rax, %rcx
cmpq %rdx, %r8
jne 0x2fa8c
jmp 0x2fb23
cmpq $0x0, 0x18(%rsp)
jle 0x2fb23
shlq $0x4, %rax
leaq 0x270(%rsp), %rdi
xorl %r8d, %r8d
movapd 0x36d1(%rip), %xmm0     # 0x331b0
testq %r12, %r12
jle 0x2fb11
movq %rsi, %r9
xorl %r10d, %r10d
movsd (%rcx,%r10), %xmm1
movsd %xmm1, (%rdi,%r10)
movsd 0x8(%rcx,%r10), %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, 0x8(%rdi,%r10)
addq $0x10, %r10
decq %r9
jne 0x2faea
incq %r8
addq $0x180, %rdi            # imm = 0x180
addq %rax, %rcx
cmpq %rdx, %r8
jne 0x2fadf
testq %rbp, %rbp
jle 0x2fc60
movq 0x2750(%rsp), %rbx
movq 0x2748(%rsp), %r14
xorpd %xmm0, %xmm0
movapd 0x60(%rsp), %xmm1
cmpeqpd %xmm0, %xmm1
cmpeqpd 0x50(%rsp), %xmm0
andpd %xmm1, %xmm0
movd %xmm0, %eax
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
setg %r13b
andb %al, %r13b
shlq $0x4, %rcx
movq %rcx, 0x30(%rsp)
shlq $0x4, %rbx
movq 0x20(%rsp), %rax
shlq $0x4, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x1, %rax
je 0x2fbbd
testq %rax, %rax
jne 0x2fbdc
movl $0x1, %edx
movl $0x1, %r8d
movq %r12, %rdi
movq %r15, %rsi
leaq 0x70(%rsp), %rcx
leaq 0x70fd(%rip), %r9       # 0x36cae
callq 0x2f0ba
addq 0x28(%rsp), %r15
jmp 0x2fc02
movl $0x1, %r8d
movq %r12, %rdi
movq %r15, %rsi
movq 0x20(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x70d4(%rip), %r9       # 0x36cae
jmp 0x2fbf9
movl $0x1, %r8d
movq %r12, %rdi
movq %r15, %rsi
movq 0x20(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x63ed(%rip), %r9       # 0x35fe6
callq 0x2f0ba
addq $0x10, %r15
testb %r13b, %r13b
je 0x2fc16
movq %r14, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x3170
movq $0x1, (%rsp)
movq 0x18(%rsp), %rdi
movq %r12, %rsi
leaq 0x270(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %r14, %r8
xorl %r9d, %r9d
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
callq 0x2eebd
addq %rbx, %r14
decq %rbp
jne 0x2fb84
movb 0x17(%rsp), %al
addq $0x26f8, %rsp           # imm = 0x26F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq