// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %r10
movabsq $0x2, %rbx
movq %rdi, %rax
cqto
idivq %rbx
movq %rax, %r11
movq %rsi, %rax
cqto
idivq %rbx
xorl %edx, %edx
testq %rax, %rax
cmovleq %rdx, %rax
testq %r11, %r11
cmovleq %rdx, %r11
movq %rcx, %rbx
shlq $0x4, %rbx
shlq $0x3, %rcx
cmpq %r11, %rdx
je 0x2df5c
leaq (%r10,%rcx), %r14
movq %rax, %r12
xorl %r15d, %r15d
subq $0x1, %r12
jb 0x2df18
movsd (%r8), %xmm0
mulsd (%r9,%r15), %xmm0
addsd (%r10,%r15), %xmm0
movsd %xmm0, (%r10,%r15)
movsd (%r8), %xmm0
mulsd 0x8(%r9,%r15), %xmm0
addsd 0x8(%r10,%r15), %xmm0
movsd %xmm0, 0x8(%r10,%r15)
movsd 0x8(%r8), %xmm0
mulsd (%r9,%r15), %xmm0
addsd (%r14,%r15), %xmm0
movsd %xmm0, (%r14,%r15)
movsd 0x8(%r8), %xmm0
mulsd 0x8(%r9,%r15), %xmm0
addsd 0x8(%r14,%r15), %xmm0
movsd %xmm0, 0x8(%r14,%r15)
addq $0x10, %r15
jmp 0x2dea8
testb $0x1, %sil
je 0x2df4d
movsd (%r8), %xmm0
mulsd (%r9,%r15), %xmm0
addsd (%r10,%r15), %xmm0
movsd %xmm0, (%r10,%r15)
movsd 0x8(%r8), %xmm0
mulsd (%r9,%r15), %xmm0
addsd (%r14,%r15), %xmm0
movsd %xmm0, (%r14,%r15)
incq %rdx
addq $0x10, %r8
addq %rbx, %r10
jmp 0x2de95
testb $0x1, %dil
je 0x2dfbe
xorl %ecx, %ecx
subq $0x1, %rax
jb 0x2dfa1
movsd (%r8), %xmm0
mulsd (%r9,%rcx), %xmm0
addsd (%r10,%rcx), %xmm0
movsd %xmm0, (%r10,%rcx)
movsd (%r8), %xmm0
mulsd 0x8(%r9,%rcx), %xmm0
addsd 0x8(%r10,%rcx), %xmm0
movsd %xmm0, 0x8(%r10,%rcx)
addq $0x10, %rcx
jmp 0x2df64
testb $0x1, %sil
je 0x2dfbe
movsd (%r8), %xmm0
mulsd (%r9,%rcx), %xmm0
addsd (%r10,%rcx), %xmm0
movsd %xmm0, (%r10,%rcx)
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
retq