// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::symmetricmatrixvectormultiply(alglib_impl::ae_matrix*, bool, long, long, alglib_impl::ae_vector*, double, alglib_impl::ae_vector*, alglib_impl::ae_state*)
void symmetricmatrixvectormultiply(/* Real    */ ae_matrix* a,
     ae_bool isupper,
     ae_int_t i1,
     ae_int_t i2,
     /* Real    */ ae_vector* x,
     double alpha,
     /* Real    */ ae_vector* y,
     ae_state *_state)
{
    ae_int_t i;
    ae_int_t ba1;
    ae_int_t ba2;
    ae_int_t by1;
    ae_int_t by2;
    ae_int_t bx1;
    ae_int_t bx2;
    ae_int_t n;
    double v;


    n = i2-i1+1;
    if( n<=0 )
    {
        return;
    }
    
    /*
     * Let A = L + D + U, where
     *  L is strictly lower triangular (main diagonal is zero)
     *  D is diagonal
     *  U is strictly upper triangular (main diagonal is zero)
     *
     * A*x = L*x + D*x + U*x
     *
     * Calculate D*x first
     */
    for(i=i1; i<=i2; i++)
    {
        y->ptr.p_double[i-i1+1] = a->ptr.pp_double[i][i]*x->ptr.p_double[i-i1+1];
    }
    
    /*
     * Add L*x + U*x
     */
    if( isupper )
    {
        for(i=i1; i<=i2-1; i++)
        {
            
            /*
             * Add L*x to the result
             */
            v = x->ptr.p_double[i-i1+1];
            by1 = i-i1+2;
            by2 = n;
            ba1 = i+1;
            ba2 = i2;
            ae_v_addd(&y->ptr.p_double[by1], 1, &a->ptr.pp_double[i][ba1], 1, ae_v_len(by1,by2), v);
            
            /*
             * Add U*x to the result
             */
            bx1 = i-i1+2;
            bx2 = n;
            ba1 = i+1;
            ba2 = i2;
            v = ae_v_dotproduct(&x->ptr.p_double[bx1], 1, &a->ptr.pp_double[i][ba1], 1, ae_v_len(bx1,bx2));
            y->ptr.p_double[i-i1+1] = y->ptr.p_double[i-i1+1]+v;
        }
    }
    else
    {
        for(i=i1+1; i<=i2; i++)
        {
            
            /*
             * Add L*x to the result
             */
            bx1 = 1;
            bx2 = i-i1;
            ba1 = i1;
            ba2 = i-1;
            v = ae_v_dotproduct(&x->ptr.p_double[bx1], 1, &a->ptr.pp_double[i][ba1], 1, ae_v_len(bx1,bx2));
            y->ptr.p_double[i-i1+1] = y->ptr.p_double[i-i1+1]+v;
            
            /*
             * Add U*x to the result
             */
            v = x->ptr.p_double[i-i1+1];
            by1 = 1;
            by2 = i-i1;
            ba1 = i1;
            ba2 = i-1;
            ae_v_addd(&y->ptr.p_double[by1], 1, &a->ptr.pp_double[i][ba1], 1, ae_v_len(by1,by2), v);
        }
    }
    ae_v_muld(&y->ptr.p_double[1], 1, ae_v_len(1,n), alpha);
}

// Assembly:
movq %rcx, %rax
subq %rdx, %rax
js 0x17e1c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm0, 0x48(%rsp)
incq %rax
movq %rax, 0x20(%rsp)
pushq $0x1
popq %rax
movq %rdx, %r10
cmpq %rcx, %r10
jg 0x17cfe
movq 0x38(%rdi), %r11
movq (%r11,%r10,8), %r11
movsd (%r11,%r10,8), %xmm0
movq 0x28(%r8), %r11
mulsd (%r11,%rax,8), %xmm0
movq 0x28(%r9), %r11
movsd %xmm0, (%r11,%rax,8)
incq %r10
incq %rax
jmp 0x17ccf
movq %rdi, 0x38(%rsp)
movq %r8, 0x28(%rsp)
movq %r9, 0x10(%rsp)
testb %sil, %sil
movq %rcx, 0x40(%rsp)
je 0x17e1d
leaq (,%rdx,8), %rax
movq %rax, 0x18(%rsp)
pushq $0x10
popq %r13
pushq $0x2
popq %r14
movq 0x38(%rsp), %rbp
movq 0x18(%rsp), %r15
cmpq %rcx, %rdx
jge 0x17f02
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movsd -0x8(%rax,%r13), %xmm0
movsd %xmm0, 0x8(%rsp)
incq %rdx
movq %rdx, 0x30(%rsp)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %r12
addq %r13, %r12
movq 0x38(%rbp), %rax
addq %r15, %rax
movq -0x10(%r13,%rax), %rax
addq %r15, %rax
leaq (%rax,%r13), %rbx
addq $-0x8, %rbx
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x26b4d
movq %r12, %rdi
pushq $0x1
popq %rcx
movq %rcx, %rsi
movq %rbx, %rdx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x269b8
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r13, %rbx
movq 0x38(%rbp), %rax
addq %r15, %rax
movq -0x10(%r13,%rax), %rax
addq %r15, %rax
leaq (%rax,%r13), %r12
addq $-0x8, %r12
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rcx
movq %rcx, %rsi
movq %r12, %rdx
movq %rax, %r8
callq 0x2668d
movq 0x30(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
addsd -0x8(%rax,%r13), %xmm0
movsd %xmm0, -0x8(%rax,%r13)
addq $0x8, %r13
incq %r14
jmp 0x17d3a
retq
pushq $0x1
popq %r14
leaq (,%rdx,8), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %r13
movq 0x38(%rsp), %rbp
pushq $0x1
popq %r12
cmpq %rcx, %rdx
jge 0x17f02
leaq 0x1(%rdx), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%r13), %rbx
addq $0x8, %rbx
movq 0x38(%rbp), %rax
movq 0x8(%rax,%rdx,8), %r15
addq 0x8(%rsp), %r15
movq %r12, %rdi
movq %r14, %rsi
movq %rdx, 0x30(%rsp)
callq 0x26b4d
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x2668d
movq 0x10(%rsp), %rcx
movq 0x28(%rcx), %rax
addsd 0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x8(%rax,%r14,8)
movq 0x28(%r13), %rax
movsd 0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x28(%rcx), %rbx
addq $0x8, %rbx
movq 0x38(%rbp), %rax
movq 0x30(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %r15
addq 0x8(%rsp), %r15
movq %r12, %rdi
movq %r14, %rsi
callq 0x26b4d
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
movsd 0x50(%rsp), %xmm0
callq 0x269b8
movq 0x40(%rsp), %rcx
incq %r14
movq 0x18(%rsp), %rdx
jmp 0x17e3c
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rbx
addq $0x8, %rbx
pushq $0x1
popq %r14
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x26b4d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movsd 0x48(%rsp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x26b08