// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::hermitianmatrixvectormultiply(alglib_impl::ae_matrix*, bool, long, long, alglib_impl::ae_vector*, alglib_impl::ae_complex, alglib_impl::ae_vector*, alglib_impl::ae_state*)
void hermitianmatrixvectormultiply(/* Complex */ ae_matrix* a,
     ae_bool isupper,
     ae_int_t i1,
     ae_int_t i2,
     /* Complex */ ae_vector* x,
     ae_complex alpha,
     /* Complex */ 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;
    ae_complex 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_complex[i-i1+1] = ae_c_mul(a->ptr.pp_complex[i][i],x->ptr.p_complex[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_complex[i-i1+1];
            by1 = i-i1+2;
            by2 = n;
            ba1 = i+1;
            ba2 = i2;
            ae_v_caddc(&y->ptr.p_complex[by1], 1, &a->ptr.pp_complex[i][ba1], 1, "Conj", 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_cdotproduct(&x->ptr.p_complex[bx1], 1, "N", &a->ptr.pp_complex[i][ba1], 1, "N", ae_v_len(bx1,bx2));
            y->ptr.p_complex[i-i1+1] = ae_c_add(y->ptr.p_complex[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_cdotproduct(&x->ptr.p_complex[bx1], 1, "N", &a->ptr.pp_complex[i][ba1], 1, "N", ae_v_len(bx1,bx2));
            y->ptr.p_complex[i-i1+1] = ae_c_add(y->ptr.p_complex[i-i1+1],v);
            
            /*
             * Add U*x to the result
             */
            v = x->ptr.p_complex[i-i1+1];
            by1 = 1;
            by2 = i-i1;
            ba1 = i1;
            ba2 = i-1;
            ae_v_caddc(&y->ptr.p_complex[by1], 1, &a->ptr.pp_complex[i][ba1], 1, "Conj", ae_v_len(by1,by2), v);
        }
    }
    ae_v_cmulc(&y->ptr.p_complex[1], 1, ae_v_len(1,n), alpha);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %rax
movq %rdx, 0x10(%rsp)
subq %rdx, %rax
js 0x18022
movq %r9, %r12
movl %esi, 0x20(%rsp)
movsd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x68(%rsp)
incq %rax
movq %rax, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
cmpq %rcx, 0x10(%rsp)
movq %r8, %r13
movq %rdi, %rbp
jg 0x17e91
movq 0x10(%rsp), %rax
leaq (,%rax,8), %rbx
movl $0x2, %r14d
movq 0x38(%rsp), %r15
movq 0x38(%rbp), %rax
movq (%rax,%rbx), %rax
movsd (%rax,%rbx,2), %xmm0
movsd 0x8(%rax,%rbx,2), %xmm1
movq 0x28(%r13), %rax
movsd (%rax,%r14,8), %xmm2
movsd 0x8(%rax,%r14,8), %xmm3
callq 0x27f95
movq 0x28(%r12), %rax
movsd %xmm0, (%rax,%r14,8)
movsd %xmm1, 0x8(%rax,%r14,8)
addq $0x2, %r14
addq $0x8, %rbx
decq %r15
jne 0x17e49
movq %r13, 0x18(%rsp)
cmpb $0x0, 0x20(%rsp)
je 0x18031
movq 0x10(%rsp), %rcx
cmpq 0x30(%rsp), %rcx
movq %r12, %rcx
movq 0x18(%rsp), %rbx
jge 0x1819d
movq %rbp, %rdx
movq 0x10(%rsp), %rax
shlq $0x4, %rax
movq %rax, 0x70(%rsp)
movl $0x20, %r12d
movl $0x2, %ebp
movq %rcx, 0x58(%rsp)
movq %rdx, 0x28(%rsp)
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd -0x8(%rax,%r12), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x10(%rsp), %r13
leaq 0x1(%r13), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rcx), %r14
addq %r12, %r14
movq 0x38(%rdx), %rax
movq (%rax,%r13,8), %rax
movq 0x70(%rsp), %r15
addq %r15, %rax
addq %r12, %rax
addq $-0x10, %rax
movq %rax, 0x40(%rsp)
movq %rbp, %rdi
movq 0x38(%rsp), %rbx
movq %rbx, %rsi
callq 0x2923f
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq 0x40(%rsp), %rdx
leaq 0x1ef07(%rip), %r8      # 0x36e5e
movq %rax, %r9
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
callq 0x28a25
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r14
addq %r12, %r14
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%r13,8), %rax
addq %r15, %rax
leaq (%r12,%rax), %r15
addq $-0x10, %r15
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rbx
callq 0x2923f
movq %rax, (%rsp)
movl $0x1, %esi
movl $0x1, %r8d
movq %r14, %rdi
leaq 0x1fb0c(%rip), %rdx     # 0x37ac4
movq %r15, %rcx
movq %rdx, %r9
callq 0x28174
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
callq 0x27f8c
movq 0x28(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x28(%rcx), %rax
movsd %xmm0, -0x10(%rax,%r12)
movsd %xmm1, -0x8(%rax,%r12)
addq $0x10, %r12
incq %rbp
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, 0x30(%rsp)
jne 0x17edf
jmp 0x1819d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rdx
subq 0x30(%rsp), %rdx
movq %r12, %rcx
movq 0x18(%rsp), %rsi
jge 0x1819d
movq %rbp, %rax
movq 0x10(%rsp), %r13
leaq (,%r13,8), %rdi
movq %rdi, 0x40(%rsp)
movl $0x1, %ebp
xorl %r12d, %r12d
shlq $0x4, %r13
movq %r13, 0x10(%rsp)
movq %rdx, 0x48(%rsp)
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %r13
movq 0x28(%rsi), %r14
addq $0x10, %r14
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
addq %r13, %rax
movq 0x8(%r12,%rax), %r15
addq 0x10(%rsp), %r15
movl $0x1, %edi
movq %rbp, %rsi
movq %rcx, %rbx
callq 0x2923f
movq %rax, (%rsp)
movl $0x1, %esi
movl $0x1, %r8d
movq %r14, %rdi
leaq 0x1f9ff(%rip), %rdx     # 0x37ac4
movq %r15, %rcx
movq %rdx, %r9
callq 0x28174
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movq 0x28(%rbx), %rax
movsd 0x20(%rax,%r12,2), %xmm0
movsd 0x28(%rax,%r12,2), %xmm1
callq 0x27f8c
movq 0x28(%rbx), %rax
movsd %xmm0, 0x20(%rax,%r12,2)
movsd %xmm1, 0x28(%rax,%r12,2)
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
movsd 0x20(%rax,%r12,2), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x28(%rax,%r12,2), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x28(%rbx), %r14
addq $0x10, %r14
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
addq %r13, %rax
movq 0x8(%r12,%rax), %r15
addq 0x10(%rsp), %r15
movl $0x1, %edi
movq %rbp, %rsi
callq 0x2923f
movl $0x1, %esi
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
leaq 0x1ecfa(%rip), %r8      # 0x36e5e
movq %rax, %r9
movsd 0x20(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
callq 0x28a25
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rcx
leaq (%rdx,%rbp), %rax
incq %rax
incq %rbp
addq $0x8, %r12
cmpq $0x1, %rax
jne 0x1807e
movq 0x28(%rcx), %rbx
addq $0x10, %rbx
movl $0x1, %edi
movq 0x38(%rsp), %rsi
callq 0x2923f
movl $0x1, %esi
movq %rbx, %rdi
movq %rax, %rdx
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28d48