// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::xcdot(alglib_impl::ae_vector*, alglib_impl::ae_vector*, long, alglib_impl::ae_vector*, alglib_impl::ae_complex*, double*, alglib_impl::ae_state*)
void xcdot(/* Complex */ ae_vector* a,
     /* Complex */ ae_vector* b,
     ae_int_t n,
     /* Real    */ ae_vector* temp,
     ae_complex* r,
     double* rerr,
     ae_state *_state)
{
    ae_int_t i;
    double mx;
    double v;
    double rerrx;
    double rerry;

    r->x = 0;
    r->y = 0;
    *rerr = 0;

    
    /*
     * special cases:
     * * N=0
     */
    if( n==0 )
    {
        *r = ae_complex_from_d(0);
        *rerr = 0;
        return;
    }
    
    /*
     * calculate real part
     */
    mx = 0;
    for(i=0; i<=n-1; i++)
    {
        v = a->ptr.p_complex[i].x*b->ptr.p_complex[i].x;
        temp->ptr.p_double[2*i+0] = v;
        mx = ae_maxreal(mx, ae_fabs(v, _state), _state);
        v = -a->ptr.p_complex[i].y*b->ptr.p_complex[i].y;
        temp->ptr.p_double[2*i+1] = v;
        mx = ae_maxreal(mx, ae_fabs(v, _state), _state);
    }
    if( ae_fp_eq(mx,0) )
    {
        r->x = 0;
        rerrx = 0;
    }
    else
    {
        xblas_xsum(temp, mx, 2*n, &r->x, &rerrx, _state);
    }
    
    /*
     * calculate imaginary part
     */
    mx = 0;
    for(i=0; i<=n-1; i++)
    {
        v = a->ptr.p_complex[i].x*b->ptr.p_complex[i].y;
        temp->ptr.p_double[2*i+0] = v;
        mx = ae_maxreal(mx, ae_fabs(v, _state), _state);
        v = a->ptr.p_complex[i].y*b->ptr.p_complex[i].x;
        temp->ptr.p_double[2*i+1] = v;
        mx = ae_maxreal(mx, ae_fabs(v, _state), _state);
    }
    if( ae_fp_eq(mx,0) )
    {
        r->y = 0;
        rerry = 0;
    }
    else
    {
        xblas_xsum(temp, mx, 2*n, &r->y, &rerry, _state);
    }
    
    /*
     * total error
     */
    if( ae_fp_eq(rerrx,0)&&ae_fp_eq(rerry,0) )
    {
        *rerr = 0;
    }
    else
    {
        *rerr = ae_maxreal(rerrx, rerry, _state)*ae_sqrt(1+ae_sqr(ae_minreal(rerrx, rerry, _state)/ae_maxreal(rerrx, rerry, _state), _state), _state);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, (%r8)
andq $0x0, (%r9)
testq %rdx, %rdx
je 0x1e626
movq %rbx, 0x38(%rsp)
xorl %ebx, %ebx
testq %rdx, %rdx
movl $0x0, %ebp
movq %rdx, 0x30(%rsp)
cmovgq %rdx, %rbp
movq %r14, 0x20(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x28(%rsp)
xorpd %xmm0, %xmm0
movq %rbp, %r15
movq %rbp, 0x48(%rsp)
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r13
subq $0x1, %r15
movsd %xmm0, (%rsp)
jb 0x1e600
movq 0x28(%r14), %rax
movsd (%rax,%rbx), %xmm0
movq 0x28(%r13), %rax
mulsd (%rax,%rbx), %xmm0
movq 0x8(%rsp), %rbp
movq 0x28(%rbp), %rax
movsd %xmm0, (%rax,%rbx)
movq 0x90(%rsp), %r12
movq %r12, %rdi
callq 0x2440c
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %r12, %rdi
callq 0x244b6
movsd %xmm0, (%rsp)
movq 0x28(%r14), %rax
movsd 0x8(%rax,%rbx), %xmm0
xorpd 0x11beb(%rip), %xmm0    # 0x301b0
movq 0x28(%r13), %rax
mulsd 0x8(%rax,%rbx), %xmm0
movq 0x28(%rbp), %rax
movq 0x48(%rsp), %rbp
movsd %xmm0, 0x8(%rax,%rbx)
movq %r12, %rdi
callq 0x2440c
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %r12, %rdi
callq 0x244b6
addq $0x10, %rbx
jmp 0x1e55e
xorpd %xmm1, %xmm1
callq 0x241f5
testb %al, %al
je 0x1e645
movq 0x20(%rsp), %rax
andq $0x0, (%rax)
andq $0x0, 0x40(%rsp)
movq 0x90(%rsp), %r15
jmp 0x1e672
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x25861
movsd %xmm0, (%r14)
movsd %xmm1, 0x8(%r14)
jmp 0x1e817
movq 0x30(%rsp), %rax
leaq (%rax,%rax), %rsi
leaq 0x40(%rsp), %rcx
movq 0x8(%rsp), %rdi
movsd (%rsp), %xmm0
movq 0x20(%rsp), %rdx
movq 0x90(%rsp), %r15
movq %r15, %r8
callq 0x1e1c6
xorpd %xmm2, %xmm2
xorl %ebx, %ebx
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %r12
subq $0x1, %rbp
movsd %xmm2, (%rsp)
jb 0x1e711
movq 0x28(%r14), %rax
movsd (%rax,%rbx), %xmm0
movq 0x28(%r13), %rax
mulsd 0x8(%rax,%rbx), %xmm0
movq 0x28(%r12), %rax
movsd %xmm0, (%rax,%rbx)
movq %r15, %rdi
callq 0x2440c
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %r15, %rdi
callq 0x244b6
movsd %xmm0, (%rsp)
movq 0x28(%r14), %rax
movsd 0x8(%rax,%rbx), %xmm0
movq 0x28(%r13), %rax
mulsd (%rax,%rbx), %xmm0
movq 0x28(%r12), %rax
movsd %xmm0, 0x8(%rax,%rbx)
movq %r15, %rdi
callq 0x2440c
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %r15, %rdi
callq 0x244b6
movapd %xmm0, %xmm2
addq $0x10, %rbx
jmp 0x1e687
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
xorpd %xmm1, %xmm1
movapd %xmm2, %xmm0
callq 0x241f5
testb %al, %al
je 0x1e737
movq 0x28(%rsp), %rax
andq $0x0, (%rax)
jmp 0x1e768
movq 0x30(%rsp), %rsi
addq %rsi, %rsi
leaq 0x50(%rsp), %rbx
movq 0x8(%rsp), %rdi
movsd (%rsp), %xmm0
movq 0x28(%rsp), %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x1e1c6
movsd (%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x38(%rsp), %rbx
movsd 0x40(%rsp), %xmm0
xorpd %xmm1, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x18(%rsp)
callq 0x241f5
testb %al, %al
je 0x1e79f
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x241f5
testb %al, %al
jne 0x1e817
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rdi
callq 0x244b6
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rdi
callq 0x244bb
movsd %xmm0, (%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rdi
callq 0x244b6
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movq %r15, %rdi
callq 0x2441f
addsd 0x119f5(%rip), %xmm0    # 0x301f8
movq %r15, %rdi
callq 0x24424
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq