// File: /workspace/github_cpp_makefile_star2_O2/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::applyrotationsfromtheright(bool, long, long, long, long, alglib_impl::ae_vector*, alglib_impl::ae_vector*, alglib_impl::ae_matrix*, alglib_impl::ae_vector*, alglib_impl::ae_state*)
void applyrotationsfromtheright(ae_bool isforward,
     ae_int_t m1,
     ae_int_t m2,
     ae_int_t n1,
     ae_int_t n2,
     /* Real    */ ae_vector* c,
     /* Real    */ ae_vector* s,
     /* Real    */ ae_matrix* a,
     /* Real    */ ae_vector* work,
     ae_state *_state)
{
    ae_int_t j;
    ae_int_t jp1;
    double ctemp;
    double stemp;
    double temp;


    
    /*
     * Form A * P'
     */
    if( isforward )
    {
        if( m1!=m2 )
        {
            
            /*
             * Common case: M1<>M2
             */
            for(j=n1; j<=n2-1; j++)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    jp1 = j+1;
                    ae_v_moved(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_subd(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_muld(&a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_addd(&a->ptr.pp_double[m1][j], a->stride, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_move(&a->ptr.pp_double[m1][jp1], a->stride, &work->ptr.p_double[m1], 1, ae_v_len(m1,m2));
                }
            }
        }
        else
        {
            
            /*
             * Special case: M1=M2
             */
            for(j=n1; j<=n2-1; j++)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    temp = a->ptr.pp_double[m1][j+1];
                    a->ptr.pp_double[m1][j+1] = ctemp*temp-stemp*a->ptr.pp_double[m1][j];
                    a->ptr.pp_double[m1][j] = stemp*temp+ctemp*a->ptr.pp_double[m1][j];
                }
            }
        }
    }
    else
    {
        if( m1!=m2 )
        {
            
            /*
             * Common case: M1<>M2
             */
            for(j=n2-1; j>=n1; j--)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    jp1 = j+1;
                    ae_v_moved(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_subd(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_muld(&a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_addd(&a->ptr.pp_double[m1][j], a->stride, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_move(&a->ptr.pp_double[m1][jp1], a->stride, &work->ptr.p_double[m1], 1, ae_v_len(m1,m2));
                }
            }
        }
        else
        {
            
            /*
             * Special case: M1=M2
             */
            for(j=n2-1; j>=n1; j--)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    temp = a->ptr.pp_double[m1][j+1];
                    a->ptr.pp_double[m1][j+1] = ctemp*temp-stemp*a->ptr.pp_double[m1][j];
                    a->ptr.pp_double[m1][j] = stemp*temp+ctemp*a->ptr.pp_double[m1][j];
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbp
movq %rsi, %r12
testl %edi, %edi
movq %r9, 0x50(%rsp)
movq %rcx, 0x28(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, 0x48(%rsp)
je 0x188d7
cmpq %rdx, %r12
jne 0x189b0
pushq $0x1
popq %rbx
cmpq %r15, %rbp
jge 0x18e01
movq 0x28(%r14), %rax
movsd (%rax,%rbx,8), %xmm0
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
movsd (%rax,%rbx,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x28(%rsp)
movsd 0x1799f(%rip), %xmm1    # 0x301f8
callq 0x24217
testb %al, %al
jne 0x18875
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x24217
testb %al, %al
je 0x188cc
movq 0x98(%rsp), %rcx
movq 0x38(%rcx), %rax
movq (%rax,%r12,8), %rax
movsd 0x8(%rax,%rbp,8), %xmm0
movsd (%rax,%rbp,8), %xmm1
movsd 0x8(%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x28(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rax,%rbp,8)
movq 0x38(%rcx), %rax
movq (%rax,%r12,8), %rax
mulsd (%rax,%rbp,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rax,%rbp,8)
incq %rbp
incq %rbx
jmp 0x18822
cmpq %rdx, %r12
jne 0x18bdb
leaq (,%rbp,8), %rbx
negq %rbx
cmpq %rbp, %r15
jle 0x18e01
movq 0x28(%r14), %rax
addq %rbx, %rax
movsd (%rax,%r15,8), %xmm0
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
addq %rbx, %rax
movsd (%rax,%r15,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd 0x178ce(%rip), %xmm1    # 0x301f8
callq 0x24217
testb %al, %al
jne 0x18946
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x24217
testb %al, %al
je 0x189a3
movq 0x98(%rsp), %rcx
movq 0x38(%rcx), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r15,8), %xmm0
movsd -0x8(%rax,%r15,8), %xmm1
movsd 0x8(%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, (%rax,%r15,8)
movq 0x38(%rcx), %rax
movq (%rax,%r12,8), %rax
mulsd -0x8(%rax,%r15,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, -0x8(%rax,%r15,8)
decq %r15
movq 0x28(%rsp), %rbp
jmp 0x188eb
leaq (,%r12,8), %rax
movq %rax, 0x18(%rsp)
movq %r15, 0x40(%rsp)
cmpq %r15, %rbp
jge 0x18e01
movq 0x28(%r14), %rax
movq %rbp, %rcx
subq 0x28(%rsp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
movsd 0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm0
movsd 0x177f1(%rip), %xmm1    # 0x301f8
callq 0x24217
testb %al, %al
jne 0x18a27
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x24217
testb %al, %al
je 0x18bd3
leaq 0x1(%rbp), %rax
movq %rax, 0x38(%rsp)
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
movq 0x18(%rsp), %rax
addq %rax, %rbx
movq %rax, %r14
movq 0x98(%rsp), %r12
movq 0x10(%r12), %r15
movq 0x38(%r12), %rax
leaq 0x8(,%rbp,8), %rdx
movq %rdx, 0x30(%rsp)
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %r13
addq %rdx, %r13
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %r12
movq %r12, %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x20(%rsp), %xmm0
callq 0x26888
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r14, %rbx
movq 0x98(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
leaq (,%rbp,8), %r13
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %r14
addq %r13, %r14
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x26afc
movq 0x98(%rsp), %rcx
movq 0x10(%rcx), %rbx
movq 0x38(%rcx), %rax
movq %rcx, %r14
movq 0x8(%rsp), %rcx
addq (%rax,%rcx,8), %r13
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x26b4d
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x20(%rsp), %xmm0
callq 0x26b08
movq 0x10(%r14), %rbx
movq 0x38(%r14), %rax
movq %r14, %r13
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rax,%rbp,8), %r14
leaq (%rax,%rbp,8), %r15
addq $0x8, %r15
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x26b4d
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq 0x40(%rsp), %r15
movq %rbx, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x269b8
movq 0x10(%r13), %rbx
movq 0x38(%r13), %rax
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %r13
addq (%rax,%rdi,8), %r13
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %r14
addq 0x18(%rsp), %r14
movq %r12, %rsi
callq 0x26b4d
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x50(%rsp), %r14
pushq $0x1
popq %rcx
movq %rax, %r8
callq 0x2675e
movq 0x38(%rsp), %rbp
jmp 0x189c2
incq %rbp
jmp 0x189c2
leaq (,%r15,8), %r13
leaq (,%rbp,8), %rax
negq %rax
movq %rax, 0x30(%rsp)
leaq (,%r12,8), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rbp
cmpq 0x28(%rsp), %r15
jle 0x18e01
movq 0x28(%r14), %rax
movq 0x30(%rsp), %rcx
addq %rcx, %rax
movsd (%r13,%rax), %xmm1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
addq %rcx, %rax
movsd (%r13,%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm0
movsd 0x175a7(%rip), %xmm1    # 0x301f8
callq 0x24217
testb %al, %al
jne 0x18c71
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x24217
testb %al, %al
je 0x18df5
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
movq 0x18(%rsp), %r14
addq %r14, %rbx
movq 0x98(%rsp), %r12
movq 0x10(%r12), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%r12), %rax
movq %r15, 0x40(%rsp)
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %r15
addq %r13, %r15
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq 0x38(%rsp), %rcx
movq %rax, %r8
movsd 0x20(%rsp), %xmm0
callq 0x26888
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r14, %rbx
movq 0x10(%r12), %r14
movq 0x38(%r12), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rax,%r13), %r15
addq $-0x8, %r15
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x26b4d
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x26afc
movq 0x10(%r12), %rbx
movq 0x38(%r12), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rax,%r13), %r14
addq $-0x8, %r14
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x26b4d
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x20(%rsp), %xmm0
callq 0x26b08
movq 0x10(%r12), %rbx
movq 0x38(%r12), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %r14
leaq (%r14,%r13), %r15
addq $-0x8, %r15
addq %r13, %r14
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x26b4d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x269b8
movq 0x10(%r12), %rbx
movq 0x38(%r12), %rax
movq 0x8(%rsp), %rdi
movq (%rax,%rdi,8), %r14
addq %r13, %r14
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %r15
addq 0x18(%rsp), %r15
movq %rbp, %rsi
callq 0x26b4d
movq %r14, %rdi
movq 0x50(%rsp), %r14
movq %rbx, %rsi
movq %r15, %rdx
movq 0x40(%rsp), %r15
pushq $0x1
popq %rcx
movq %rax, %r8
callq 0x2675e
addq $-0x8, %r13
decq %r15
jmp 0x18c05
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq