// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x28(%rsp)
movq %rdi, 0x8(%rsp)
movq %rcx, %rdi
subq %rdx, %rdi
js 0x18fc8
movq %rdx, %r15
movsd %xmm0, 0x38(%rsp)
incq %rdi
cmpq %rcx, %rdx
jg 0x18ead
leaq (,%r15,8), %rax
xorl %r10d, %r10d
movq 0x8(%rsp), %r8
movq 0x38(%r8), %r8
addq %rax, %r8
movq (%r8,%r10,8), %r8
addq %rax, %r8
movsd (%r8,%r10,8), %xmm0
movq 0x28(%rsp), %r8
movq 0x28(%r8), %r8
mulsd 0x8(%r8,%r10,8), %xmm0
movq 0x28(%r9), %r8
movsd %xmm0, 0x8(%r8,%r10,8)
incq %r10
cmpq %r10, %rdi
jne 0x18e71
movq %rdi, 0x30(%rsp)
testb %sil, %sil
je 0x18fd7
movq %r15, %rsi
subq %rcx, %rsi
jge 0x190d5
shlq $0x3, %r15
movl $0x10, %ebx
movl $0x2, %ebp
movq %r9, 0x50(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x30(%rsp), %r12
movq 0x28(%rsp), %r13
movq 0x28(%r13), %rax
movsd -0x8(%rax,%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x28(%r9), %r14
addq %rbx, %r14
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
addq %r15, %rax
movq -0x10(%rbx,%rax), %rax
addq %r15, %rax
addq %rbx, %rax
addq $-0x8, %rax
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2897c
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq 0x18(%rsp), %rdx
movq %rax, %r8
movsd 0x20(%rsp), %xmm0
callq 0x28815
movq 0x28(%r13), %r14
addq %rbx, %r14
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
addq %r15, %rax
movq -0x10(%rbx,%rax), %rax
addq %r15, %rax
leaq (%rbx,%rax), %r13
addq $-0x8, %r13
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2897c
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq %r13, %rdx
movq %rax, %r8
callq 0x28519
movq 0x10(%rsp), %rsi
movq 0x50(%rsp), %r9
movq 0x28(%r9), %rax
addsd -0x8(%rax,%rbx), %xmm0
movsd %xmm0, -0x8(%rax,%rbx)
addq $0x8, %rbx
leaq (%rsi,%rbp), %rax
incq %rax
incq %rbp
cmpq $0x2, %rax
jne 0x18ee4
jmp 0x190d5
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq %rcx, %r15
jge 0x190d5
movl $0x1, %ebp
leaq (,%r15,8), %rax
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq 0x28(%rsp), %r13
movq 0x40(%rsp), %r12
movq %r15, 0x18(%rsp)
leaq 0x1(%r15), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%r13), %r14
addq $0x8, %r14
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax,%r15,8), %r15
addq %r12, %r15
movl $0x1, %edi
movq %rbp, %rsi
movq %r9, %rbx
callq 0x2897c
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %r8
callq 0x28519
movq 0x28(%rbx), %rax
addsd 0x8(%rax,%rbp,8), %xmm0
movsd %xmm0, 0x8(%rax,%rbp,8)
movq 0x28(%r13), %rax
movsd 0x8(%rax,%rbp,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x28(%rbx), %r14
addq $0x8, %r14
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %r15
addq %r12, %r15
movl $0x1, %edi
movq %rbp, %rsi
callq 0x2897c
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x28815
movq 0x48(%rsp), %rcx
movq %rbx, %r9
incq %rbp
movq 0x20(%rsp), %rax
movq %rax, %r15
cmpq %rax, %rcx
jne 0x19001
movq 0x28(%r9), %rbx
addq $0x8, %rbx
movl $0x1, %edi
movq 0x30(%rsp), %rsi
callq 0x2897c
movl $0x1, %esi
movq %rbx, %rdi
movq %rax, %rdx
movsd 0x38(%rsp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28939