// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::matrixmatrixmultiply(alglib_impl::ae_matrix*, long, long, long, long, bool, alglib_impl::ae_matrix*, long, long, long, long, bool, double, alglib_impl::ae_matrix*, long, long, long, long, double, alglib_impl::ae_vector*, alglib_impl::ae_state*)
void matrixmatrixmultiply(/* Real    */ ae_matrix* a,
     ae_int_t ai1,
     ae_int_t ai2,
     ae_int_t aj1,
     ae_int_t aj2,
     ae_bool transa,
     /* Real    */ ae_matrix* b,
     ae_int_t bi1,
     ae_int_t bi2,
     ae_int_t bj1,
     ae_int_t bj2,
     ae_bool transb,
     double alpha,
     /* Real    */ ae_matrix* c,
     ae_int_t ci1,
     ae_int_t ci2,
     ae_int_t cj1,
     ae_int_t cj2,
     double beta,
     /* Real    */ ae_vector* work,
     ae_state *_state)
{
    ae_int_t arows;
    ae_int_t acols;
    ae_int_t brows;
    ae_int_t bcols;
    ae_int_t crows;
    ae_int_t ccols;
    ae_int_t i;
    ae_int_t j;
    ae_int_t k;
    ae_int_t l;
    ae_int_t r;
    double v;


    
    /*
     * Setup
     */
    if( !transa )
    {
        arows = ai2-ai1+1;
        acols = aj2-aj1+1;
    }
    else
    {
        arows = aj2-aj1+1;
        acols = ai2-ai1+1;
    }
    if( !transb )
    {
        brows = bi2-bi1+1;
        bcols = bj2-bj1+1;
    }
    else
    {
        brows = bj2-bj1+1;
        bcols = bi2-bi1+1;
    }
    ae_assert(acols==brows, "MatrixMatrixMultiply: incorrect matrix sizes!", _state);
    if( ((arows<=0||acols<=0)||brows<=0)||bcols<=0 )
    {
        return;
    }
    crows = arows;
    ccols = bcols;
    
    /*
     * Test WORK
     */
    i = ae_maxint(arows, acols, _state);
    i = ae_maxint(brows, i, _state);
    i = ae_maxint(i, bcols, _state);
    work->ptr.p_double[1] = 0;
    work->ptr.p_double[i] = 0;
    
    /*
     * Prepare C
     */
    if( ae_fp_eq(beta,0) )
    {
        for(i=ci1; i<=ci2; i++)
        {
            for(j=cj1; j<=cj2; j++)
            {
                c->ptr.pp_double[i][j] = 0;
            }
        }
    }
    else
    {
        for(i=ci1; i<=ci2; i++)
        {
            ae_v_muld(&c->ptr.pp_double[i][cj1], 1, ae_v_len(cj1,cj2), beta);
        }
    }
    
    /*
     * A*B
     */
    if( !transa&&!transb )
    {
        for(l=ai1; l<=ai2; l++)
        {
            for(r=bi1; r<=bi2; r++)
            {
                v = alpha*a->ptr.pp_double[l][aj1+r-bi1];
                k = ci1+l-ai1;
                ae_v_addd(&c->ptr.pp_double[k][cj1], 1, &b->ptr.pp_double[r][bj1], 1, ae_v_len(cj1,cj2), v);
            }
        }
        return;
    }
    
    /*
     * A*B'
     */
    if( !transa&&transb )
    {
        if( arows*acols<brows*bcols )
        {
            for(r=bi1; r<=bi2; r++)
            {
                for(l=ai1; l<=ai2; l++)
                {
                    v = ae_v_dotproduct(&a->ptr.pp_double[l][aj1], 1, &b->ptr.pp_double[r][bj1], 1, ae_v_len(aj1,aj2));
                    c->ptr.pp_double[ci1+l-ai1][cj1+r-bi1] = c->ptr.pp_double[ci1+l-ai1][cj1+r-bi1]+alpha*v;
                }
            }
            return;
        }
        else
        {
            for(l=ai1; l<=ai2; l++)
            {
                for(r=bi1; r<=bi2; r++)
                {
                    v = ae_v_dotproduct(&a->ptr.pp_double[l][aj1], 1, &b->ptr.pp_double[r][bj1], 1, ae_v_len(aj1,aj2));
                    c->ptr.pp_double[ci1+l-ai1][cj1+r-bi1] = c->ptr.pp_double[ci1+l-ai1][cj1+r-bi1]+alpha*v;
                }
            }
            return;
        }
    }
    
    /*
     * A'*B
     */
    if( transa&&!transb )
    {
        for(l=aj1; l<=aj2; l++)
        {
            for(r=bi1; r<=bi2; r++)
            {
                v = alpha*a->ptr.pp_double[ai1+r-bi1][l];
                k = ci1+l-aj1;
                ae_v_addd(&c->ptr.pp_double[k][cj1], 1, &b->ptr.pp_double[r][bj1], 1, ae_v_len(cj1,cj2), v);
            }
        }
        return;
    }
    
    /*
     * A'*B'
     */
    if( transa&&transb )
    {
        if( arows*acols<brows*bcols )
        {
            for(r=bi1; r<=bi2; r++)
            {
                k = cj1+r-bi1;
                for(i=1; i<=crows; i++)
                {
                    work->ptr.p_double[i] = 0.0;
                }
                for(l=ai1; l<=ai2; l++)
                {
                    v = alpha*b->ptr.pp_double[r][bj1+l-ai1];
                    ae_v_addd(&work->ptr.p_double[1], 1, &a->ptr.pp_double[l][aj1], 1, ae_v_len(1,crows), v);
                }
                ae_v_add(&c->ptr.pp_double[ci1][k], c->stride, &work->ptr.p_double[1], 1, ae_v_len(ci1,ci2));
            }
            return;
        }
        else
        {
            for(l=aj1; l<=aj2; l++)
            {
                k = ai2-ai1+1;
                ae_v_move(&work->ptr.p_double[1], 1, &a->ptr.pp_double[ai1][l], a->stride, ae_v_len(1,k));
                for(r=bi1; r<=bi2; r++)
                {
                    v = ae_v_dotproduct(&work->ptr.p_double[1], 1, &b->ptr.pp_double[r][bj1], 1, ae_v_len(1,k));
                    c->ptr.pp_double[ci1+l-aj1][cj1+r-bi1] = c->ptr.pp_double[ci1+l-aj1][cj1+r-bi1]+alpha*v;
                }
            }
            return;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movsd %xmm1, (%rsp)
movsd %xmm0, 0x40(%rsp)
movq %r8, %r14
movq %rdi, 0x38(%rsp)
movq 0xb8(%rsp), %r8
movq 0xb0(%rsp), %r12
movq 0xc0(%rsp), %rax
movq %r14, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
subq %rcx, %r14
movq %rdx, 0x30(%rsp)
movq %rdx, %r13
movq %rsi, 0x28(%rsp)
subq %rsi, %r13
movl %r9d, 0x54(%rsp)
testl %r9d, %r9d
movq %r14, %rbp
cmovneq %r13, %rbp
movq %r13, %r15
cmovneq %r14, %r15
movq %r8, 0x10(%rsp)
subq %r8, %rax
subq 0xa8(%rsp), %r12
cmpb $0x0, 0xc8(%rsp)
movq %r12, %rbx
cmovneq %rax, %rbx
cmoveq %rax, %r12
xorl %edi, %edi
cmpq %rbx, %rbp
sete %dil
movq 0x100(%rsp), %rdx
leaq 0x1d010(%rip), %rsi     # 0x32fa8
callq 0x238ca
movq %r12, %rax
movq %r13, 0x8(%rsp)
orq %r13, %r14
orq %rbx, %r14
orq %r12, %r14
jns 0x15fbf
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %r12
movq 0xf8(%rsp), %r14
movq 0xe8(%rsp), %r13
movq %rbp, %rsi
movq 0xd8(%rsp), %rbp
movq %r15, %rdi
incq %rdi
incq %rsi
incq %rax
incq %r12
movq %rdi, 0x48(%rsp)
movq %rsi, 0x60(%rsp)
movq %rax, %r15
movq 0x100(%rsp), %rbx
movq %rbx, %rdx
callq 0x244a0
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x244a0
movq %rax, %rdi
movq %r15, 0x58(%rsp)
movq %r15, %rsi
movq %rbx, %rdx
callq 0x244a0
movq 0x28(%r14), %rcx
andq $0x0, 0x8(%rcx)
movq 0x28(%r14), %rcx
andq $0x0, (%rcx,%rax,8)
xorps %xmm1, %xmm1
movsd (%rsp), %xmm0
callq 0x241f5
testb %al, %al
je 0x16086
movq %rbp, %rax
cmpq 0xe0(%rsp), %rax
jg 0x160d6
movq %r13, %rcx
cmpq 0xf0(%rsp), %rcx
jg 0x16081
movq 0xd0(%rsp), %rdx
movq 0x38(%rdx), %rdx
movq (%rdx,%rax,8), %rdx
andq $0x0, (%rdx,%rcx,8)
incq %rcx
jmp 0x1605d
incq %rax
jmp 0x16050
leaq (,%r13,8), %r14
movq %rbp, %r15
cmpq 0xe0(%rsp), %r15
jg 0x160d6
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r15,8), %rbx
addq %r14, %rbx
movq %r13, %rdi
movq 0xf0(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %rax, %rdx
movsd (%rsp), %xmm0
callq 0x26b08
incq %r15
jmp 0x16091
movl 0x54(%rsp), %esi
movl %esi, %eax
movb 0xc8(%rsp), %dil
orb %dil, %al
je 0x1628c
movl %edi, %eax
xorb $0x1, %al
movl %eax, %ecx
orb %sil, %cl
movq 0x20(%rsp), %rcx
movq 0xa8(%rsp), %rdx
je 0x1636d
xorb $0x1, %sil
orb %sil, %dil
je 0x1644b
orb %al, %sil
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rdx
jne 0x15fb0
movq 0x48(%rsp), %rcx
imulq %rcx, %rax
imulq %rdx, %r12
cmpq %r12, %rax
jge 0x165f0
movq 0xa8(%rsp), %r14
movq 0xe8(%rsp), %rax
subq %r14, %rax
xorl %edx, %edx
testq %rcx, %rcx
cmovgq %rcx, %rdx
shlq $0x3, %rax
movq %rax, (%rsp)
pushq $0x1
popq %rbp
shlq $0x3, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
cmpq 0xb0(%rsp), %r14
jg 0x15fb0
movq %r14, %r13
xorl %eax, %eax
movq 0x28(%rsp), %r15
cmpq %rax, %rdx
je 0x161a5
movq 0xf8(%rsp), %rcx
movq 0x28(%rcx), %rcx
andq $0x0, 0x8(%rcx,%rax,8)
incq %rax
jmp 0x16189
movq 0xb8(%rsp), %r14
cmpq 0x30(%rsp), %r15
jg 0x16227
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r14,8), %xmm0
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0xf8(%rsp), %rax
movq 0x28(%rax), %rbx
addq $0x8, %rbx
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r15,8), %r12
addq 0x20(%rsp), %r12
movq %rbp, %rdi
movq 0x48(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %rax, %r8
movsd 0x18(%rsp), %xmm0
callq 0x269b8
incq %r15
incq %r14
jmp 0x161ad
movq 0xd0(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
movq 0xd8(%rsp), %rdi
movq (%rax,%rdi,8), %rax
addq (%rsp), %rax
movq %r13, %r14
leaq (%rax,%r13,8), %r12
movq 0xf8(%rsp), %rax
movq 0x28(%rax), %rbx
addq $0x8, %rbx
movq 0xe0(%rsp), %rsi
callq 0x26b4d
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movq %rax, %r8
callq 0x2691c
incq %r14
movq 0x8(%rsp), %rdx
jmp 0x16171
movq 0x28(%rsp), %rcx
subq %rcx, %rbp
shlq $0x3, %rbp
movq %rbp, (%rsp)
leaq (,%r13,8), %rax
movq %rax, 0x8(%rsp)
shlq $0x3, 0x10(%rsp)
pushq $0x1
popq %rbx
cmpq 0x30(%rsp), %rcx
jg 0x15fb0
movq %rcx, %r15
movq 0x20(%rsp), %r14
movq 0xa8(%rsp), %rbp
cmpq 0xb0(%rsp), %rbp
movq %r15, %rcx
jg 0x16365
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rcx,8), %rax
movsd (%rax,%r14,8), %xmm0
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
addq (%rsp), %rax
movq (%rax,%rcx,8), %r12
addq 0x8(%rsp), %r12
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbp,8), %r13
addq 0x10(%rsp), %r13
movq 0xe8(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x26b4d
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x18(%rsp), %xmm0
callq 0x269b8
incq %rbp
incq %r14
jmp 0x162cd
incq %rcx
jmp 0x162b2
movq 0x48(%rsp), %rax
imulq 0x60(%rsp), %rax
imulq 0x58(%rsp), %r12
cmpq %r12, %rax
jge 0x16526
subq %rdx, %r13
leaq (,%rcx,8), %rax
movq %rax, 0x8(%rsp)
shlq $0x3, 0x10(%rsp)
shlq $0x3, %r13
movq %r13, (%rsp)
cmpq 0xb0(%rsp), %rdx
jg 0x15fb0
movq %rdx, %rbp
movq 0xd8(%rsp), %r15
movq 0x28(%rsp), %r14
cmpq 0x30(%rsp), %r14
jg 0x16440
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %rbx
addq 0x8(%rsp), %rbx
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbp,8), %r12
addq 0x10(%rsp), %r12
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rcx
movq %rcx, %rsi
movq %r12, %rdx
movq %rax, %r8
callq 0x2668d
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r15,8), %rax
addq (%rsp), %rax
mulsd 0x40(%rsp), %xmm0
addsd (%rax,%rbp,8), %xmm0
movsd %xmm0, (%rax,%rbp,8)
incq %r14
incq %r15
jmp 0x163c3
movq %rbp, %rdx
incq %rdx
jmp 0x163a5
subq %rcx, %rbp
shlq $0x3, %rbp
movq %rbp, (%rsp)
leaq (,%r13,8), %rax
movq %rax, 0x30(%rsp)
shlq $0x3, 0x10(%rsp)
pushq $0x1
popq %rbx
cmpq 0x18(%rsp), %rcx
jg 0x15fb0
movq %rcx, %r15
movq 0x28(%rsp), %r14
movq 0xa8(%rsp), %rbp
cmpq 0xb0(%rsp), %rbp
movq %r15, %rcx
jg 0x1651e
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%rcx,8), %xmm0
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
addq (%rsp), %rax
movq (%rax,%rcx,8), %r12
addq 0x30(%rsp), %r12
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbp,8), %r13
addq 0x10(%rsp), %r13
movq 0xe8(%rsp), %rdi
movq 0xf0(%rsp), %rsi
callq 0x26b4d
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x269b8
incq %rbp
incq %r14
jmp 0x16487
incq %rcx
jmp 0x1646c
movq 0x28(%rsp), %rbx
subq %rbx, %rbp
leaq (,%rcx,8), %rax
movq %rax, (%rsp)
shlq $0x3, 0x10(%rsp)
shlq $0x3, %rbp
cmpq 0x30(%rsp), %rbx
jg 0x15fb0
movq %rbx, %r13
movq 0xe8(%rsp), %r15
movq 0xa8(%rsp), %r14
cmpq 0xb0(%rsp), %r14
jg 0x165e8
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbx,8), %rbx
addq (%rsp), %rbx
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %r12
addq 0x10(%rsp), %r12
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rcx
movq %rcx, %rsi
movq %r12, %rdx
movq %r13, %rbx
movq %rax, %r8
callq 0x2668d
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
addq %rbp, %rax
movq (%rax,%r13,8), %rax
mulsd 0x40(%rsp), %xmm0
addsd (%rax,%r15,8), %xmm0
movsd %xmm0, (%rax,%r15,8)
incq %r14
incq %r15
jmp 0x16562
incq %rbx
jmp 0x16544
incq 0x8(%rsp)
movq 0x20(%rsp), %r13
movq 0xd8(%rsp), %rax
subq %r13, %rax
pushq $0x1
popq %rbp
shlq $0x3, 0x10(%rsp)
shlq $0x3, %rax
movq %rax, (%rsp)
cmpq 0x18(%rsp), %r13
jg 0x15fb0
movq %r13, %rcx
movq 0xf8(%rsp), %rax
movq 0x28(%rax), %rbx
addq $0x8, %rbx
movq 0x38(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x38(%rax), %rax
leaq (,%rcx,8), %r12
movq 0x28(%rsp), %rcx
addq (%rax,%rcx,8), %r12
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x2675e
movq 0xe8(%rsp), %r14
movq 0xa8(%rsp), %r15
cmpq 0xb0(%rsp), %r15
jg 0x16701
movq 0xf8(%rsp), %rax
movq 0x28(%rax), %rbx
addq $0x8, %rbx
movq 0xa0(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r15,8), %r12
addq 0x10(%rsp), %r12
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %rax, %r8
callq 0x2668d
movq 0xd0(%rsp), %rax
movq 0x38(%rax), %rax
addq (%rsp), %rax
movq (%rax,%r13,8), %rax
mulsd 0x40(%rsp), %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
incq %r15
incq %r14
jmp 0x16683
incq %r13
jmp 0x16616