// File: /workspace/github_cpp_makefile_star2_O3/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
movq %r8, 0x30(%rsp)
movq %rcx, %r14
movq %rdx, %r15
cmpq $0x21, %rdi
setl %al
cmpq $0x21, %rsi
setl %cl
andb %al, %cl
cmpq $0x21, %rdx
setl %al
testq %rdi, %rdi
setg %dl
andb %al, %dl
andb %cl, %dl
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
setg %al
testq %r15, %r15
setg %cl
andb %al, %cl
andb %dl, %cl
xorpd %xmm2, %xmm2
movsd %xmm0, 0x28(%rsp)
ucomisd %xmm2, %xmm0
setp %al
setne %dl
orb %al, %dl
andb %cl, %dl
movb %dl, 0xf(%rsp)
cmpb $0x1, %dl
jne 0x2f95e
movq %rdi, %r13
movsd %xmm1, 0x18(%rsp)
movq 0x2288(%rsp), %rax
movq 0x2280(%rsp), %rcx
cmpq $0x0, 0x2290(%rsp)
je 0x2f77d
movq %r15, %rdx
shrq %rdx
leaq 0x1c0(%rsp), %rsi
xorl %edi, %edi
movq 0x10(%rsp), %rbx
movq %rcx, %r10
movq %rsi, %r8
cmpq $0x2, %r15
jb 0x2f758
movq %rdx, %r11
movq %rsi, %r8
movq %rcx, %r10
movupd (%r10), %xmm0
movupd %xmm0, (%r8)
addq $0x10, %r8
addq $0x10, %r10
decq %r11
jne 0x2f741
testb $0x1, %r15b
je 0x2f768
movsd (%r10), %xmm0
movsd %xmm0, (%r8)
incq %rdi
leaq (%rcx,%rax,8), %rcx
addq $0x100, %rsi            # imm = 0x100
cmpq %rbx, %rdi
jne 0x2f72c
jmp 0x2f7ef
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
shrq %rdx
leaq 0x1c0(%rsp), %rsi
xorl %edi, %edi
movq %rcx, %r10
movq %rsi, %r8
cmpq $0x2, %rbx
jb 0x2f7d0
movq %rdx, %r11
movq %rsi, %r8
movq %rcx, %r10
movsd (%r10), %xmm0
movsd %xmm0, (%r8)
movsd 0x8(%r10), %xmm0
movsd %xmm0, 0x100(%r8)
addq $0x200, %r8             # imm = 0x200
addq $0x10, %r10
decq %r11
jne 0x2f7a7
testb $0x1, %bl
je 0x2f7df
movsd (%r10), %xmm0
movsd %xmm0, (%r8)
incq %rdi
leaq (%rcx,%rax,8), %rcx
addq $0x8, %rsi
cmpq %r15, %rdi
jne 0x2f792
movq 0x22a0(%rsp), %r12
movq 0x2298(%rsp), %rbp
testq %r9, %r9
je 0x2f896
leaq (,%rbx,8), %rax
movq %rax, 0x20(%rsp)
shlq $0x3, %r12
leaq 0x40(%rsp), %rbx
movl $0x1, %r8d
movq %r15, %rdi
movq %r14, %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x2f041
movsd 0x18(%rsp), %xmm1
ucomisd 0x6fdb(%rip), %xmm1     # 0x36820
jne 0x2f85e
jp 0x2f85e
movq %rbp, %rdi
xorl %esi, %esi
movq 0x20(%rsp), %rdx
callq 0x3170
movsd 0x18(%rsp), %xmm1
movl $0x1, %r9d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
leaq 0x1c0(%rsp), %rdx
movq %rbx, %rcx
movq %rbp, %r8
movsd 0x28(%rsp), %xmm0
callq 0x2ea57
addq $0x8, %r14
addq %r12, %rbp
decq %r13
jne 0x2f81e
jmp 0x2f95e
movq %r15, %rax
shrq %rax
movq %rax, 0x38(%rsp)
leaq (,%rbx,8), %rax
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x40(%rsp), %rcx
movq %rcx, %rax
movq %r14, %rsi
cmpq $0x2, %r15
jb 0x2f8e1
movq %r14, %rsi
movq 0x38(%rsp), %rdx
movq %rcx, %rax
movupd (%rsi), %xmm0
movupd %xmm0, (%rax)
addq $0x10, %rsi
addq $0x10, %rax
decq %rdx
jne 0x2f8cc
testb $0x1, %r15b
movsd 0x18(%rsp), %xmm1
je 0x2f8f5
movsd (%rsi), %xmm0
movsd %xmm0, (%rax)
ucomisd 0x6f23(%rip), %xmm1     # 0x36820
jne 0x2f91b
jp 0x2f91b
movq %rbp, %rdi
xorl %esi, %esi
movq 0x20(%rsp), %rdx
callq 0x3170
leaq 0x40(%rsp), %rcx
movsd 0x18(%rsp), %xmm1
movl $0x1, %r9d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
leaq 0x1c0(%rsp), %rdx
movq %rbp, %r8
movsd 0x28(%rsp), %xmm0
callq 0x2ea57
leaq 0x40(%rsp), %rcx
leaq (%rbp,%r12,8), %rbp
movq 0x30(%rsp), %rax
leaq (%r14,%rax,8), %r14
incq %rbx
cmpq %r13, %rbx
jne 0x2f8b5
movb 0xf(%rsp), %al
addq $0x2248, %rsp           # imm = 0x2248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq