// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_mm22(double, double const*, double const*, long, double, double*, long, long)
void _ialglib_mm22(double alpha, const double *a, const double *b, ae_int_t k, double beta, double *r, ae_int_t stride, ae_int_t store_mode)
{
    double v00, v01, v10, v11;
    ae_int_t t;
    v00 = 0.0;
    v01 = 0.0;
    v10 = 0.0;
    v11 = 0.0;
    for(t=0; t<k; t++)
    {
        v00 += a[0]*b[0];
        v01 += a[0]*b[1];
        v10 += a[1]*b[0];
        v11 += a[1]*b[1];
        a+=2;
        b+=2;
    }
    if( store_mode==0 )
    {
        if( beta==0 )
        {
            r[0] = alpha*v00;
            r[1] = alpha*v01;
            r[stride+0] = alpha*v10;
            r[stride+1] = alpha*v11;
        }
        else
        {
            r[0] = beta*r[0] + alpha*v00;
            r[1] = beta*r[1] + alpha*v01;
            r[stride+0] = beta*r[stride+0] + alpha*v10;
            r[stride+1] = beta*r[stride+1] + alpha*v11;
        }
        return;
    }
    if( store_mode==1 )
    {
        if( beta==0 )
        {
            r[0] = alpha*v00;
            r[1] = alpha*v01;
        }
        else
        {
            r[0] = beta*r[0] + alpha*v00;
            r[1] = beta*r[1] + alpha*v01;
        }
        return;
    }
    if( store_mode==2 )
    {
        if( beta==0 )
        {
            r[0] =alpha*v00;
            r[stride+0] = alpha*v10;
        }
        else
        {
            r[0] = beta*r[0] + alpha*v00; 
            r[stride+0] = beta*r[stride+0] + alpha*v10;
        }
        return;
    }
    if( store_mode==3 )
    {
        if( beta==0 )
        {
            r[0] = alpha*v00;
        }
        else
        {
            r[0] = beta*r[0] + alpha*v00;
        }
        return;
    }
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
cmovleq %rax, %rdx
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
subq $0x1, %rdx
jb 0x2e462
movupd (%rsi,%rax), %xmm4
movsd (%rdi,%rax), %xmm5
movsd 0x8(%rdi,%rax), %xmm6
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm4, %xmm5
addpd %xmm5, %xmm2
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
mulpd %xmm4, %xmm6
addpd %xmm6, %xmm3
addq $0x10, %rax
jmp 0x2e42e
cmpq $0x3, %r9
ja 0x2e4de
leaq 0x4dd1(%rip), %rax      # 0x33240
movslq (%rax,%r9,4), %rdx
addq %rax, %rdx
jmpq *%rdx
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm1
jne 0x2e51d
jp 0x2e51d
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm0, %xmm2
movupd %xmm2, (%rcx)
mulpd %xmm0, %xmm3
movupd %xmm3, (%rcx,%r8,8)
retq
xorpd %xmm4, %xmm4
mulsd %xmm0, %xmm2
ucomisd %xmm4, %xmm1
jne 0x2e4f8
jp 0x2e4f8
movsd %xmm2, (%rcx)
mulsd %xmm0, %xmm3
movsd %xmm3, (%rcx,%r8,8)
retq
xorpd %xmm3, %xmm3
mulsd %xmm0, %xmm2
ucomisd %xmm3, %xmm1
jne 0x2e4d2
jnp 0x2e4da
mulsd (%rcx), %xmm1
addsd %xmm1, %xmm2
movsd %xmm2, (%rcx)
retq
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm1
jne 0x2e552
jp 0x2e552
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm0, %xmm2
movupd %xmm2, (%rcx)
retq
movsd (%rcx), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm2, %xmm4
movsd %xmm4, (%rcx)
mulsd %xmm0, %xmm3
mulsd (%rcx,%r8,8), %xmm1
addsd %xmm3, %xmm1
movsd %xmm1, (%rcx,%r8,8)
retq
movupd (%rcx), %xmm4
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm0, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm1, %xmm4
addpd %xmm2, %xmm4
movupd %xmm4, (%rcx)
movupd (%rcx,%r8,8), %xmm2
mulpd %xmm0, %xmm3
mulpd %xmm1, %xmm2
addpd %xmm3, %xmm2
movupd %xmm2, (%rcx,%r8,8)
retq
movupd (%rcx), %xmm3
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm0, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
addpd %xmm2, %xmm1
movupd %xmm1, (%rcx)
retq