// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_rmatrixgemm(long, long, long, double, double*, long, long, double*, long, long, double, double*, long)
ae_bool _ialglib_rmatrixgemm(ae_int_t m,
     ae_int_t n,
     ae_int_t k,
     double alpha,
     double *_a,
     ae_int_t _a_stride,
     ae_int_t optypea,
     double *_b,
     ae_int_t _b_stride,
     ae_int_t optypeb,
     double beta,
     double *_c,
     ae_int_t _c_stride)
{
    int i;
    double *crow;
    double __abuf[alglib_r_block+alglib_simd_alignment];
    double __b[alglib_r_block*alglib_r_block+alglib_simd_alignment];
    double * const abuf = (double * const) ae_align(__abuf,alglib_simd_alignment);
    double * const b    = (double * const) ae_align(__b,   alglib_simd_alignment);
    void (*rmv)(ae_int_t, ae_int_t, const double *, const double *, double *, ae_int_t, double, double) = &_ialglib_rmv;
    void (*mcopyblock)(ae_int_t, ae_int_t, const double *, ae_int_t, ae_int_t, double *) = &_ialglib_mcopyblock;
    
    if( m>alglib_r_block || n>alglib_r_block || k>alglib_r_block || m<=0 || n<=0 || k<=0 || alpha==0.0 )
        return ae_false;

    /*
     * Check for SSE2 support
     */
#ifdef AE_HAS_SSE2_INTRINSICS
    if( ae_cpuid() & CPU_SSE2 )
    {
        rmv = &_ialglib_rmv_sse2;
        mcopyblock = &_ialglib_mcopyblock_sse2;
    }
#endif
    
    /*
     * copy b
     */
    if( optypeb==0 )
        mcopyblock(k, n, _b, 1, _b_stride, b);
    else
        mcopyblock(n, k, _b, 0, _b_stride, b);

    /*
     * multiply B by A (from the right, by rows)
     * and store result in C
     */
    crow  = _c;
    if( optypea==0 )
    {
        const double *arow = _a;
        for(i=0; i<m; i++)
        {
            _ialglib_vcopy(k, arow, 1, abuf, 1);
            if( beta==0 )
                _ialglib_vzero(n, crow, 1);
            rmv(n, k, b, abuf, crow, 1, alpha, beta);
            crow += _c_stride;
            arow += _a_stride;
        }
    }
    else
    {
        const double *acol = _a;
        for(i=0; i<m; i++)
        {
            _ialglib_vcopy(k, acol, _a_stride, abuf, 1);
            if( beta==0 )
                _ialglib_vzero(n, crow, 1);
            rmv(n, k, b, abuf, crow, 1, alpha, beta);
            crow += _c_stride;
            acol++;
        }
    }
    return ae_true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2248, %rsp           # imm = 0x2248
movsd %xmm1, 0x18(%rsp)
movq %r8, 0x28(%rsp)
movq %rdx, %r15
movq %rdi, %r13
cmpq $0x21, %rdi
setl %al
cmpq $0x21, %rsi
setl %dil
andb %al, %dil
cmpq $0x21, %rdx
setl %al
testq %r13, %r13
setg %dl
andb %al, %dl
andb %dil, %dl
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
setg %al
testq %r15, %r15
setg %sil
andb %al, %sil
andb %dl, %sil
xorpd %xmm1, %xmm1
movsd %xmm0, 0x30(%rsp)
ucomisd %xmm1, %xmm0
setp %al
setne %dl
orb %al, %dl
andb %sil, %dl
movb %dl, 0xf(%rsp)
cmpb $0x1, %dl
jne 0x2cc18
movq %r9, %rbx
movq %rcx, %r14
movq 0x2288(%rsp), %r8
movq 0x2280(%rsp), %rdx
cmpq $0x0, 0x2290(%rsp)
je 0x2caaa
leaq 0x1c0(%rsp), %r9
movq 0x10(%rsp), %rdi
movq %r15, %rsi
xorl %ecx, %ecx
jmp 0x2cabd
pushq $0x1
popq %rcx
leaq 0x1c0(%rsp), %r9
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x2c4ad
movq 0x22a0(%rsp), %rax
movq 0x2298(%rsp), %rbp
testq %rbx, %rbx
movq %r14, %rsi
je 0x2cb76
shlq $0x3, %rax
pushq $0x1
popq %r14
movq %rax, 0x20(%rsp)
subq $0x1, %r13
jb 0x2cc18
movq %r15, %rbx
movq %r15, %rdi
movq %rsi, %r12
movq 0x28(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %r14, %r8
callq 0x2c32e
movsd 0x18(%rsp), %xmm0
ucomisd 0x671a(%rip), %xmm0     # 0x33238
movq 0x10(%rsp), %r15
jne 0x2cb35
jp 0x2cb35
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2c2c3
movq %r15, %rdi
movq %rbx, %r15
movq %rbx, %rsi
leaq 0x1c0(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %rbp, %r8
movq %r14, %r9
movsd 0x30(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2bded
movq %r12, %rsi
addq $0x8, %rsi
movq 0x20(%rsp), %rax
addq %rax, %rbp
jmp 0x2caeb
shlq $0x3, %rax
shlq $0x3, 0x28(%rsp)
leaq 0x40(%rsp), %rbx
pushq $0x1
popq %r12
movq %rax, 0x20(%rsp)
subq $0x1, %r13
jb 0x2cc18
movq %r15, %rdi
movq %rsi, 0x38(%rsp)
movq %r12, %rdx
movq %rbx, %r14
movq %rbx, %rcx
movq %r12, %r8
callq 0x2c32e
movsd 0x18(%rsp), %xmm0
ucomisd 0x6679(%rip), %xmm0     # 0x33238
movq 0x10(%rsp), %rbx
jne 0x2cbd6
jp 0x2cbd6
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x2c2c3
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x1c0(%rsp), %rdx
movq %r14, %rbx
movq %r14, %rcx
movq %rbp, %r8
movq %r12, %r9
movsd 0x30(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2bded
movq 0x20(%rsp), %rax
addq %rax, %rbp
movq 0x38(%rsp), %rsi
addq 0x28(%rsp), %rsi
jmp 0x2cb8e
movb 0xf(%rsp), %al
addq $0x2248, %rsp           # imm = 0x2248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq