// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_rmatrixrank1(long, long, double*, long, double*, double*)
ae_bool _ialglib_rmatrixrank1(ae_int_t m,
     ae_int_t n,
     double *_a,
     ae_int_t _a_stride,
     double *_u,
     double *_v)
{
    double *arow0, *arow1, *pu, *pv, *vtmp, *dst0, *dst1;
    ae_int_t m2 = m/2;
    ae_int_t n2 = n/2;
    ae_int_t stride  = _a_stride;
    ae_int_t stride2 = 2*_a_stride;
    ae_int_t i, j;

    /*
     * update pairs of rows
     */
    arow0 = _a;
    arow1 = arow0+stride;
    pu    = _u;
    vtmp  = _v;
    for(i=0; i<m2; i++,arow0+=stride2,arow1+=stride2,pu+=2)
    {
        /*
         * update by two
         */
        for(j=0,pv=vtmp, dst0=arow0, dst1=arow1; j<n2; j++, dst0+=2, dst1+=2, pv+=2)
        {
            dst0[0] += pu[0]*pv[0];
            dst0[1] += pu[0]*pv[1];
            dst1[0] += pu[1]*pv[0];
            dst1[1] += pu[1]*pv[1];
        }

        /*
         * final update
         */
        if( n%2!=0 )
        {
            dst0[0] += pu[0]*pv[0];
            dst1[0] += pu[1]*pv[0];
        }
    }

    /*
     * update last row
     */
    if( m%2!=0 )
    {
        /*
         * update by two
         */
        for(j=0,pv=vtmp, dst0=arow0; j<n2; j++, dst0+=2, pv+=2)
        {
            dst0[0] += pu[0]*pv[0];
            dst0[1] += pu[0]*pv[1];
        }

        /*
         * final update
         */
        if( n%2!=0 )
            dst0[0] += pu[0]*pv[0];
    }
    return ae_true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rax
shrq $0x3f, %rax
addq %rsi, %rax
sarq %rax
cmpq $0x2, %rdi
jl 0x323d3
movq %rdi, %r10
shrq $0x3f, %r10
addq %rdi, %r10
sarq %r10
leaq (%rdx,%rcx,8), %r11
shlq $0x4, %rcx
xorl %ebx, %ebx
movq %rdx, %r14
movq %r11, %r15
movq %r9, %r12
cmpq $0x2, %rsi
jl 0x3238c
xorl %r14d, %r14d
movq %rax, %r15
movsd (%r8), %xmm0
mulsd (%r9,%r14), %xmm0
addsd (%rdx,%r14), %xmm0
movsd %xmm0, (%rdx,%r14)
movsd (%r8), %xmm0
mulsd 0x8(%r9,%r14), %xmm0
addsd 0x8(%rdx,%r14), %xmm0
movsd %xmm0, 0x8(%rdx,%r14)
movsd 0x8(%r8), %xmm0
mulsd (%r9,%r14), %xmm0
addsd (%r11,%r14), %xmm0
movsd %xmm0, (%r11,%r14)
movsd 0x8(%r8), %xmm0
mulsd 0x8(%r9,%r14), %xmm0
addsd 0x8(%r11,%r14), %xmm0
movsd %xmm0, 0x8(%r11,%r14)
addq $0x10, %r14
decq %r15
jne 0x32314
leaq (%r9,%r14), %r12
leaq (%r11,%r14), %r15
addq %rdx, %r14
testb $0x1, %sil
je 0x323bd
movsd (%r8), %xmm0
mulsd (%r12), %xmm0
addsd (%r14), %xmm0
movsd %xmm0, (%r14)
movsd 0x8(%r8), %xmm0
mulsd (%r12), %xmm0
addsd (%r15), %xmm0
movsd %xmm0, (%r15)
incq %rbx
addq %rcx, %rdx
addq %rcx, %r11
addq $0x10, %r8
cmpq %r10, %rbx
jne 0x322ff
testb $0x1, %dil
je 0x3242b
cmpq $0x2, %rsi
jl 0x32413
movsd (%r8), %xmm0
mulsd (%r9), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
movsd (%r8), %xmm0
mulsd 0x8(%r9), %xmm0
addsd 0x8(%rdx), %xmm0
movsd %xmm0, 0x8(%rdx)
addq $0x10, %rdx
addq $0x10, %r9
decq %rax
jne 0x323df
testb $0x1, %sil
je 0x3242b
movsd (%r8), %xmm0
mulsd (%r9), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
retq