// File: /workspace/github_cpp_makefile_star2_O1/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, 0x18(%rsp)
movq %rcx, %r15
movsd %xmm1, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
cmpq $0x19, %rdi
setl %al
movq %rsi, 0x20(%rsp)
cmpq $0x19, %rsi
setl %cl
andb %al, %cl
movq %rdx, 0x10(%rsp)
cmpq $0x19, %rdx
setl %al
andb %cl, %al
movb %al, 0xf(%rsp)
cmpb $0x1, %al
jne 0x3095c
movq %rdi, %rbp
movq 0x2740(%rsp), %rdi
movq 0x2738(%rsp), %rax
testq %rdi, %rdi
movq 0x20(%rsp), %r8
movq %r8, %rcx
movq 0x10(%rsp), %rsi
cmoveq %rsi, %rcx
movq 0x2730(%rsp), %rdx
cmoveq %r8, %rsi
setne %r8b
testq %rcx, %rcx
setle %r9b
orb %r8b, %r9b
jne 0x30750
leaq 0x270(%rsp), %r8
xorl %r9d, %r9d
movq %rax, %r10
shlq $0x4, %r10
movq %rdx, %r11
testq %rsi, %rsi
jle 0x30741
movq %rsi, %rbx
movq %r8, %r14
movq %r11, %r12
movsd (%r12), %xmm0
movsd %xmm0, (%r14)
movsd 0x8(%r12), %xmm0
movsd %xmm0, 0x8(%r14)
addq $0x180, %r14            # imm = 0x180
addq $0x10, %r12
decq %rbx
jne 0x30719
incq %r9
addq %r10, %r11
addq $0x10, %r8
cmpq %rcx, %r9
jne 0x3070b
cmpq $0x2, %rdi
je 0x307ba
cmpq $0x1, %rdi
jne 0x3081a
testq %rcx, %rcx
jle 0x3081a
shlq $0x4, %rax
leaq 0x270(%rsp), %rdi
xorl %r8d, %r8d
testq %rsi, %rsi
jle 0x307a6
movq %rsi, %r9
xorl %r10d, %r10d
movsd (%rdx,%r10), %xmm0
movsd %xmm0, (%rdi,%r10)
movsd 0x8(%rdx,%r10), %xmm0
movsd %xmm0, 0x8(%rdi,%r10)
addq $0x10, %r10
decq %r9
jne 0x30783
incq %r8
addq $0x180, %rdi            # imm = 0x180
addq %rax, %rdx
cmpq %rcx, %r8
jne 0x30778
jmp 0x3081a
testq %rcx, %rcx
jle 0x3081a
shlq $0x4, %rax
leaq 0x270(%rsp), %rdi
xorl %r8d, %r8d
movapd 0x3a0a(%rip), %xmm0     # 0x341e0
testq %rsi, %rsi
jle 0x30808
movq %rsi, %r9
xorl %r10d, %r10d
movsd (%rdx,%r10), %xmm1
movsd %xmm1, (%rdi,%r10)
movsd 0x8(%rdx,%r10), %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, 0x8(%rdi,%r10)
addq $0x10, %r10
decq %r9
jne 0x307e1
incq %r8
addq $0x180, %rdi            # imm = 0x180
addq %rax, %rdx
cmpq %rcx, %r8
jne 0x307d6
testq %rbp, %rbp
jle 0x3095c
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 0x20(%rsp), %rcx
testq %rcx, %rcx
setg %r12b
andb %al, %r12b
shlq $0x4, %rcx
movq %rcx, 0x30(%rsp)
shlq $0x4, %rbx
leaq 0x70(%rsp), %r13
movq 0x18(%rsp), %rax
shlq $0x4, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x1, %rax
je 0x308b9
testq %rax, %rax
jne 0x308d8
movl $0x1, %edx
movl $0x1, %r8d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rcx
leaq 0x7225(%rip), %r9       # 0x37ad2
callq 0x2fd66
addq 0x28(%rsp), %r15
jmp 0x308fe
movl $0x1, %r8d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
leaq 0x71fc(%rip), %r9       # 0x37ad2
jmp 0x308f5
movl $0x1, %r8d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
leaq 0x6569(%rip), %r9       # 0x36e5e
callq 0x2fd66
addq $0x10, %r15
testb %r12b, %r12b
je 0x30912
movq %r14, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x3170
movq $0x1, (%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x270(%rsp), %rdx
movq %r13, %rcx
movq %r14, %r8
xorl %r9d, %r9d
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
callq 0x2fb27
addq %rbx, %r14
decq %rbp
jne 0x30880
movb 0xf(%rsp), %al
addq $0x26f8, %rsp           # imm = 0x26F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq